<% @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 %>

Routine <%= @routine.name %>

<%= 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| %>

<%= exercise.name %>

<% sets.each do |set| %> <%= f.fields_for :exercise_sets, set do |s| %>
"> <% if set.target_duration.present? %>
<%= s.label :target_duration, class: 'label' %>

<%= s.number_field :target_duration, class: 'input' %>

<%= s.hidden_field :target_repetitions, class: 'input' %> <%= s.hidden_field :target_weight, class: 'input' %>
<% else %>
<%= s.label :target_repetitions, class: 'label' %>

<%= s.number_field :target_repetitions, class: 'input' %>

<%= s.label :target_weight, class: 'label' %>

<%= s.number_field :target_weight, class: 'input' %>

<% end %>

<%= s.hidden_field :exercise_id %> <%= s.hidden_field :type %>
<% end %> <% end %> <% end %> <%= f.submit "Start", class: "button is-primary is-fullwidth", data: { disable_with: 'Saving' } %> <% end %>