Commit 0e36bd4
Changed files (4)
app
views
config
locales
app/views/profiles/show.html.erb
@@ -1,52 +1,43 @@
<% names = ["Squat", "Bench Press", "Barbell Row", "Overhead Press", "Deadlift"] %>
<div class="container">
<div class="columns">
- <div class="column is-4">
- <p>
- <%= link_to profile_path(@user) do %>
- <%= gravatar_for(@user, size: 128) %>
- <% end %>
- </p>
- <h1><%= link_to @user.username, profile_path(@user) %></h1>
- <% if @user.workouts.any? %>
- <p>
- <%= t('.workouts_completed', count: @user.workouts.count, first_session: l(@user.workouts.order(occurred_at: :asc).limit(1).first.occurred_at, format: :long)) %>
- </p>
- <% else %>
- <p><%= t('.no_workouts_completed') %></p>
- <% end %>
- <% if @profile.gym.present? %>
- <p><%= link_to @profile.gym.name, @profile.gym %></p>
- <% end %>
- <p><%= @user.time_zone %></p>
+ <div class="column is-6 is-offset-3 content">
+ <div class="has-text-centered">
+ <figure class="image is-square">
+ <%= gravatar_for(@user, size: 128) %>
+ </figure>
+ <h1 class="title"><%= link_to @user.username, profile_path(@user) %></h1>
+ <% if @user.workouts.any? %>
+ <p> <%= t('.workouts_completed_html', count: @user.workouts.count, first_session: l(@user.workouts.order(occurred_at: :asc).limit(1).first.occurred_at, format: :long)) %> </p>
+ <% else %>
+ <p><%= t('.no_workouts_completed') %></p>
+ <% end %>
+ <% if @profile.gym.present? %>
+ <p><%= link_to @profile.gym.name, @profile.gym %></p>
+ <% end %>
+ <p><%= @user.time_zone %></p>
+ </div>
</div>
+ </div>
- <div class="column is-8">
- <h2><%= t('.personal_records') %></h2>
- <table class="table is-striped">
- <thead>
- <tr>
- <th><%= t('.exercise_header') %></th>
- <th><%= t('.maximum_achieved') %></th>
- </tr>
- </thead>
- <tbody>
- <% @program.each_exercise(exercise_names: names) do |exercise| %>
- <tr>
- <% if @user.personal_record_for(exercise) %>
- <td><strong><%= exercise.name %></strong></td><td><%= "#{@user.personal_record_for(exercise)} lbs" %></td>
- <% else %>
- <td><strong><%= exercise.name %></strong></td><td><%= t('.not_available') %></td>
- <% end %>
- </tr>
- <% end %>
- </tbody>
- </table>
+ <div class="columns">
+ <div class="column is-8 is-offset-2">
+ <div class="level">
+ <% @program.each_exercise(exercise_names: names) do |exercise| %>
+ <% personal_record = @user.personal_record_for(exercise) %>
+ <div class="level-item has-text-centered">
+ <div>
+ <p class="heading"><%= exercise.name %></p>
+ <p class="title"><%= personal_record ? "#{personal_record} lbs" : t('.not_available') %></p>
+ </div>
+ </div>
+ <% end %>
+ </div>
</div>
</div>
<div class="columns">
- <div class="column is-12">
+ <div class="column is-12 content">
<% @program.each_exercise(exercise_names: names) do |exercise| %>
<%= render @user.history_for(exercise) %>
<% end %>
app/views/training_histories/_training_history.html.erb
@@ -1,4 +1,4 @@
<% if training_history.completed_any? %>
- <p> <%= training_history.exercise.name %> </p>
+ <p class="has-text-centered"> <%= training_history.exercise.name %> </p>
<%= line_chart training_history.to_line_chart %>
<% end %>
app/views/workouts/index.html.erb
@@ -21,8 +21,12 @@
<th><abbr title="Routine"></abbr>Routine</th>
<th><abbr title="Date"></abbr>Date</th>
<th><abbr title="Body weight"></abbr>Body weight</th>
- <% exercises.each do |exercise_name| %>
- <th><abbr title="<%= exercise_name %>"></abbr><%= exercise_name %></th>
+ <% if @exercise.present? %>
+ <th><abbr title="<%= @exercise.name %>"></abbr><%= @exercise.name %></th>
+ <% else %>
+ <% exercises.each do |exercise_name| %>
+ <th><abbr title="<%= exercise_name %>"></abbr><%= exercise_name %></th>
+ <% end %>
<% end %>
</tr>
</thead>
@@ -32,12 +36,19 @@
<td> <%= workout.name %> </td>
<td> <%= I18n.l workout.occurred_at, format: :short %> </td>
<td> <%= workout.body_weight.to(:lbs) %> lbs </td>
+ <% if @exercise.present? %>
+ <td>
+ <% progress = workout.progress_for(@exercise) %>
+ <%= progress.status %>
+ </td>
+ <% else %>
<% exercises.each do |exercise_name| %>
<td>
<% progress = workout.progress_for(Exercise.find_by(name: exercise_name)) %>
<%= progress.status %>
</td>
<% end %>
+ <% end %>
</tr>
<% end %>
</tbody>
config/locales/en.yml
@@ -102,7 +102,7 @@ en:
not_available: N/A
no_workouts_completed: 0 workouts completed
personal_records: Personal Records
- workouts_completed: "%{count} workouts completed since %{first_session}."
+ workouts_completed_html: "<strong>%{count}</strong> workouts completed since <strong>%{first_session}</strong>."
sessions:
create:
invalid_login: "Sorry, we cannot find that account."