1
0

Targets form allows only targets within one Goal

This commit is contained in:
cryptogopher 2020-08-24 15:33:17 +02:00
parent cf0e14d87d
commit 7e8508f9d4

View File

@ -1,20 +1,19 @@
<%= error_messages_for *@targets %>
<% @targets.group_by(&:goal).each do |goal, targets| %>
<div class="box">
<div id='goal-form' class="tabular">
<% if goal.persisted? || goal.is_binding? %>
<p><%= render partial: 'goals/show_form', locals: {goal: goal} %></p>
<p><%= f.date_field :effective_from, disabled: !goal.is_binding? %></p>
<% if current_goal.persisted? %>
<p><%= render partial: 'goals/show_form', locals: {goal: current_goal} %></p>
<p><%= f.date_field :effective_from, disabled: !current_goal.is_binding? %></p>
<% else %>
<%= render partial: 'goals/form', locals: {goal: goal} %>
<%= render partial: 'goals/form', locals: {goal: current_goal} %>
<% end %>
</div>
<hr style="width: 95%;">
<div class="tabular">
<% targets.each do |target| %>
<% @targets.each do |target| %>
<p class="target">
<%= f.fields_for 'targets', target, index: '' do |target_f| %>
<%= target_f.hidden_field :id %>
@ -47,7 +46,6 @@
</p>
</div>
</div>
<% end %>
<%= javascript_tag do %>
function showQuantityPath(event) {