1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<div class="container">
<div class="columns">
<div class="column is-6 is-offset-3 content">
<% @all_routines.each do |routine| %>
<%= link_to "Switch to Routine #{routine.name}", new_workout_path(routine_id: routine.id), class: 'button is-link is-pulled-right' %>
<% end %>
<h1 class="title">Routine <%= @routine.name %></h1>
<%= form_for @workout, remote: true, data: { 'autoview-name': 'new-workout-view' } do |f| %>
<%= f.hidden_field :routine_id %>
<%= f.label :body_weight, class: 'label' %>
<%= f.number_field :body_weight, class: 'input' %>
<% @workout.sets.group_by(&:exercise).each do |exercise, sets| %>
<h2 class="subtitle"><%= exercise.name %></h2>
<% sets.each do |set| %>
<%= f.fields_for :exercise_sets, set do |s| %>
<div name="<%= set.id %>" class="columns" style="<%= "display:none;" if set.warm_up? %>">
<% if set.target_duration.present? %>
<div class="column">
<%= s.label :target_duration, class: 'label' %>
<p class="control">
<%= s.number_field :target_duration, class: 'input' %>
</p>
<%= s.hidden_field :target_repetitions, class: 'input' %>
<%= s.hidden_field :target_weight, class: 'input' %>
</div>
<% else %>
<div class="column">
<%= s.label :target_repetitions, class: 'label' %>
<p class="control">
<%= s.number_field :target_repetitions, class: 'input' %>
</p>
</div>
<div class="column">
<%= s.label :target_weight, class: 'label' %>
<p class="control">
<%= s.number_field :target_weight, class: 'input' %>
</p>
</div>
<% end %>
<div class="column has-text-centered is-narrow">
<br />
<%= s.hidden_field :exercise_id %>
<%= s.hidden_field :type %>
<button type="button" class="button delete skip"></button>
</div>
</div>
<% end %>
<% end %>
<% end %>
<%= f.submit "Start", class: "button is-primary is-fullwidth", data: { disable_with: 'Saving' } %>
<% end %>
</div>
</div>
</div>
|