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