1
0

Update Measurements form based on Targets

This commit is contained in:
cryptogopher
2021-05-06 21:52:35 +02:00
parent e301665b6a
commit 74b4dabf86
7 changed files with 76 additions and 79 deletions

View File

@@ -1,7 +1,5 @@
<% if goal_f.object.is_binding? %>
<p>
<%= goal_f.date_field :effective_from, value: @effective_from, required: true %>
</p>
<p><%= goal_f.date_field :effective_from, value: @effective_from, required: true %></p>
<% end %>
<%= goal_f.fields_for :targets, @targets, index: '', child_index: '' do |target_f| %>
@@ -21,10 +19,11 @@
last_quantity: target_f.object.thresholds.last.quantity} %>
<%= link_to t(".button_delete_target"), '#', class: 'icon icon-del',
style: (@targets.many? ? "" : "display:none"),
onclick: "deleteTarget(event); return false;" %>
style: (@targets.many? ? '' : 'display:none'),
onclick: 'deleteTarget(event); return false;' %>
</p>
<% end %>
<p>
<%= link_to t(".button_new_target"), '#', class: 'icon icon-add',
onclick: 'newTarget(event); return false;' %>
@@ -46,7 +45,7 @@
new_target.find('em').text('<%= t ".choose_quantity" %>');
new_target.find('label:first').hide();
new_target.find('input, select:first').val('');
new_target.find('input, select.threshold:first').change();
new_target.find('select.threshold:first').change();
form.find('p.target:visible a.icon-del').show();
}

View File

@@ -1,6 +1,5 @@
<h2><%= t ".heading_new_target" %></h2>
<%# url: project_targets_path(@project, @view_params), %>
<%= labelled_form_for @goal, url: goal_targets_path(@goal), method: :post, remote: true,
html: {id: 'new-target-form', name: 'new-target-form'} do |goal_f| %>