Commit c0e734e
Changed files (8)
app
controllers
views
application
dashboards
app/controllers/dashboards_controller.rb
@@ -0,0 +1,5 @@
+class DashboardsController < ApplicationController
+ def show
+ @completed_workout = current_user.workouts.any?
+ end
+end
app/views/dashboards/_import_address_modal.html.erb
@@ -0,0 +1,13 @@
+<div class="content is-large">
+ <p> <%= t('.blurb_html') %> </p>
+ <p> <%= text_field_tag :import_address, current_user.import_address, class: 'input is-large' %> </p>
+ <button class="button clipboard-button" data-clipboard-target="#import_address">
+ <i class="fa fa-copy"></i> <%= t('.copy') %>
+ </button>
+ <p> <%= mail_to(current_user.import_address, User.human_attribute_name(:import_address)) %> </p>
+ <% if current_user.default_time_zone? %>
+ <p> <i class="fa fa-warning"></i> <%= link_to t('.warning'), edit_profile_path(current_user.profile) %> </p>
+ <% end %>
+</div>
+
+<iframe width="560" height="560" src="https://www.youtube-nocookie.com/embed/vVowk0wSiwY?rel=0" frameborder="0" allowfullscreen></iframe>
app/views/dashboards/show.html.erb
@@ -0,0 +1,27 @@
+<div class="container">
+ <div class="columns">
+ <div class="column is-3">
+ <aside class="menu">
+ <p class="menu-label">
+ General
+ </p>
+ <ul class="menu-list">
+ <li><%= link_to t(".dashboard"), dashboard_path, class: 'is-active' %></li>
+ </ul>
+ <p class="menu-label">
+ Administration
+ </p>
+ <ul class="menu-list">
+ <li><%= link_to "Edit Profile", edit_profile_path(current_user) %></li>
+ </ul>
+ </aside>
+ </div>
+ <div class="column is-9">
+ <% unless @completed_workout %>
+ <p>welcome back</p>
+ <% else %>
+ <%= render partial: 'import_address_modal' %>
+ <% end %>
+ </div>
+ </div>
+</div>
app/views/workouts/_import_address_modal.html.erb
@@ -1,30 +0,0 @@
-<div class="container">
- <div class="columns">
- <div class="column is-8 is-offset-2">
- <div class="content is-large">
- <p>
- <%= t('.blurb_html') %>
- </p>
- <p>
- <%= text_field_tag :import_address, current_user.import_address, class: 'input is-large' %>
- </p>
- <button class="button clipboard-button" data-clipboard-target="#import_address">
- <i class="fa fa-copy"></i> <%= t('.copy') %>
- </button>
- <p>
- <%= mail_to(current_user.import_address, User.human_attribute_name(:import_address)) %>
- </p>
- <% if current_user.default_time_zone? %>
- <p>
- <i class="fa fa-warning"></i>
- <%= link_to t('.warning'), edit_profile_path(current_user.profile) %>
- </p>
- <% end %>
- </div>
-
- <div class="column is-4 is-offset-2">
- <iframe width="560" height="560" src="https://www.youtube-nocookie.com/embed/vVowk0wSiwY?rel=0" frameborder="0" allowfullscreen></iframe>
- </div>
- </div>
- </div>
-</div>
app/views/workouts/index.html.erb
@@ -1,81 +1,76 @@
-<% if @workouts.any? %>
- <div class="container">
- <div class="columns">
- <div class="column is-12">
- <nav class="level">
- <!-- Left side -->
- <div class="level-left">
- <div class="level-item">
- <%= search_form %>
- </div>
- <div class="level-item">
- <p class="subtitle is-5">
- <strong><%= @workouts.total_count %></strong> workouts
- </p>
- </div>
+<div class="container">
+ <div class="columns">
+ <div class="column is-12">
+ <nav class="level">
+ <!-- Left side -->
+ <div class="level-left">
+ <div class="level-item">
+ <%= search_form %>
</div>
+ <div class="level-item">
+ <p class="subtitle is-5">
+ <strong><%= @workouts.total_count %></strong> workouts
+ </p>
+ </div>
+ </div>
- <!-- Right side -->
- <div class="level-right">
+ <!-- Right side -->
+ <div class="level-right">
+ <p class="level-item">
+ <% if @exercise.nil? %>
+ <strong> <%= link_to 'All', workouts_path %> </strong>
+ <% else %>
+ <%= link_to 'All', workouts_path %>
+ <% end %>
+ </p>
+ <% Exercise::PRIMARY_LIFTS.each do |name| %>
<p class="level-item">
- <% if @exercise.nil? %>
- <strong> <%= link_to 'All', workouts_path %> </strong>
- <% else %>
- <%= link_to 'All', workouts_path %>
- <% end %>
- </p>
- <% Exercise::PRIMARY_LIFTS.each do |name| %>
- <p class="level-item">
- <% if name == @exercise.try(:name) %>
- <strong><%= link_to name, workouts_path(exercise: name) %></strong>
- <% else %>
- <%= link_to name, workouts_path(exercise: name) %>
- <% end %>
- </p>
+ <% if name == @exercise.try(:name) %>
+ <strong><%= link_to name, workouts_path(exercise: name) %></strong>
+ <% else %>
+ <%= link_to name, workouts_path(exercise: name) %>
<% end %>
- <p class="level-item"><%= link_to "New", new_workout_path, class: 'button is-success' %></p>
- </div>
- </nav>
- </div>
+ </p>
+ <% end %>
+ <p class="level-item"><%= link_to "New", new_workout_path, class: 'button is-success' %></p>
+ </div>
+ </nav>
</div>
+ </div>
- <div class="columns">
- <div class="column is-12">
- <table class="table is-striped">
- <thead>
- <tr>
- <th><abbr title="Routine"></abbr>Routine</th>
- <th><abbr title="Date"></abbr>Date</th>
- <th><abbr title="Body weight"></abbr>Body weight</th>
- <% @primary_exercises.each do |exercise| %>
- <th><abbr title="<%= exercise.name %>"></abbr><%= exercise.name %></th>
- <% end %>
- </tr>
- </thead>
- <tbody>
- <%= cache @workouts do %>
- <% @workouts.each do |workout| %>
- <tr>
- <td> <%= workout.name %> </td>
- <td> <%= I18n.l workout.occurred_at, format: :short %> </td>
- <td> <%= workout.body_weight.to(:lbs) %> lbs </td>
- <% @primary_exercises.each do |exercise| %>
- <td> <%= workout.progress_for(exercise).status %> </td>
- <% end %>
- </tr>
- <% end %>
+ <div class="columns">
+ <div class="column is-12">
+ <table class="table is-striped">
+ <thead>
+ <tr>
+ <th><abbr title="Routine"></abbr>Routine</th>
+ <th><abbr title="Date"></abbr>Date</th>
+ <th><abbr title="Body weight"></abbr>Body weight</th>
+ <% @primary_exercises.each do |exercise| %>
+ <th><abbr title="<%= exercise.name %>"></abbr><%= exercise.name %></th>
+ <% end %>
+ </tr>
+ </thead>
+ <tbody>
+ <%= cache @workouts do %>
+ <% @workouts.each do |workout| %>
+ <tr>
+ <td> <%= workout.name %> </td>
+ <td> <%= I18n.l workout.occurred_at, format: :short %> </td>
+ <td> <%= workout.body_weight.to(:lbs) %> lbs </td>
+ <% @primary_exercises.each do |exercise| %>
+ <td> <%= workout.progress_for(exercise).status %> </td>
+ <% end %>
+ </tr>
<% end %>
- </tbody>
- </table>
- </div>
+ <% end %>
+ </tbody>
+ </table>
</div>
- <div class="columns">
- <div class="column is-12">
- <%= paginate @workouts, remote: false %>
- </div>
+ </div>
+ <div class="columns">
+ <div class="column is-12">
+ <%= paginate @workouts, remote: false %>
</div>
</div>
-<% else %>
- <%= render partial: 'import_address_modal' %>
-<% end %>
-
+</div>
config/locales/en.yml
@@ -111,7 +111,7 @@ en:
password: "Password"
login_button: "Login"
register_link: "Create an account"
- workouts:
+ dashboards:
import_address_modal:
blurb_html: This is your custom email address for sending CSV exports from the <a href="http://stronglifts.com/apps/">StrongLifts 5x5 mobile application</a>.
copy: Copy
config/routes.rb
@@ -8,8 +8,9 @@ Rails.application.routes.draw do
resources :profiles, only: [:new, :create, :show, :edit, :update], constraints: { id: /[^\/]+/ }
resources :gyms, only: [:index, :show, :new, :create]
resources :graphs, only: [:show]
+ resource :dashboards, only: [:show]
get "/u/:id" => "profiles#show", constraints: { id: /[^\/]+/ }
- get "/dashboard" => "workouts#index", as: :dashboard
+ get "/dashboard" => "dashboards#show", as: :dashboard
get "/terms" => "static_pages#terms"
get "/stronglifts/export" => "static_pages#export"