diff options
| author | mo khan <mo@mokhan.ca> | 2017-02-12 16:17:49 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2017-02-12 16:17:49 -0700 |
| commit | c0e734edccdcd60c71feaef48d97b0f03736ca73 (patch) | |
| tree | badfb1be511d02ebbb32c253029d70841b42e528 | |
| parent | 4ac0ecf89aa6294281ed1a5a12f8b34059b69f5b (diff) | |
move getting started guide to dashboard controller.
| -rw-r--r-- | app/controllers/dashboards_controller.rb | 5 | ||||
| -rw-r--r-- | app/views/application/_navigation.html.erb | 1 | ||||
| -rw-r--r-- | app/views/dashboards/_import_address_modal.html.erb | 13 | ||||
| -rw-r--r-- | app/views/dashboards/show.html.erb | 27 | ||||
| -rw-r--r-- | app/views/workouts/_import_address_modal.html.erb | 30 | ||||
| -rw-r--r-- | app/views/workouts/index.html.erb | 137 | ||||
| -rw-r--r-- | config/locales/en.yml | 2 | ||||
| -rw-r--r-- | config/routes.rb | 3 |
8 files changed, 115 insertions, 103 deletions
diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb new file mode 100644 index 0000000..fccbe87 --- /dev/null +++ b/app/controllers/dashboards_controller.rb @@ -0,0 +1,5 @@ +class DashboardsController < ApplicationController + def show + @completed_workout = current_user.workouts.any? + end +end diff --git a/app/views/application/_navigation.html.erb b/app/views/application/_navigation.html.erb index da6ec9c..a36b537 100644 --- a/app/views/application/_navigation.html.erb +++ b/app/views/application/_navigation.html.erb @@ -5,6 +5,7 @@ <%= image_tag("logos.svg") %> </a> <%= link_to t(".home"), dashboard_path, class: 'nav-item' %> + <%= link_to t(".workouts"), workouts_path, class: 'nav-item' %> <a class="nav-item" href="http://slog.stronglifters.com"> Blog </a> diff --git a/app/views/dashboards/_import_address_modal.html.erb b/app/views/dashboards/_import_address_modal.html.erb new file mode 100644 index 0000000..67f0247 --- /dev/null +++ b/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> diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb new file mode 100644 index 0000000..77f2654 --- /dev/null +++ b/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> diff --git a/app/views/workouts/_import_address_modal.html.erb b/app/views/workouts/_import_address_modal.html.erb deleted file mode 100644 index 6cf7040..0000000 --- a/app/views/workouts/_import_address_modal.html.erb +++ /dev/null @@ -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> diff --git a/app/views/workouts/index.html.erb b/app/views/workouts/index.html.erb index dcfe543..dc9cf06 100644 --- a/app/views/workouts/index.html.erb +++ b/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> diff --git a/config/locales/en.yml b/config/locales/en.yml index 0eb785a..01ef841 100644 --- a/config/locales/en.yml +++ b/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 diff --git a/config/routes.rb b/config/routes.rb index 36cf826..698b70f 100644 --- a/config/routes.rb +++ b/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" |
