1
0

Preliminary Target #new support

This commit is contained in:
cryptogopher
2020-06-27 21:52:32 +02:00
parent 1dd2e2b596
commit 0df2c6ec4f
18 changed files with 177 additions and 26 deletions

View File

@@ -0,0 +1,13 @@
<div class="tabular">
<%= fields_for 'measurement[routine_attributes]', routine do |ff| %>
<%= ff.hidden_field :id %>
<p>
<label><%= l(:field_name) %><span class="required"> *</span></label>
<%= ff.text_field :name, required: true, style: "width: 95%;" %>
</p>
<p>
<label><%= l(:field_description) %></label>
<%= ff.text_area :description, cols: 40, rows: 3, style: "width: 95%;" %>
</p>
<% end %>
</div>

View File

@@ -0,0 +1,27 @@
<div>
<%= fields_for 'target[goal_attributes]', goal do |ff| %>
<p>
<label><%= l(:field_goal) %><span class="required"> *</span></label>
<%= ff.select :id,
options_from_collection_for_select(@project.goals, :id, :name, goal.id),
{required: true}, autocomplete: 'off',
onchange: "var goal_id = $('#target_goal_attributes_id').val();
$.ajax({
url: '#{goal_path(id: :goal_id)}'.replace('goal_id', goal_id),
dataType: 'script'
});
return false;" %>
<%= link_to l(:button_edit), '#',
onclick: "var goal_id = $('#target_goal_attributes_id').val();
$.ajax({
url: '#{edit_goal_path(id: :goal_id)}'.replace('goal_id', goal_id),
dataType: 'script'
});
return false;",
class: 'icon icon-edit' %>
</p>
<% end %>
<% if goal.description? %>
<p style='white-space: pre-wrap;' ><%= goal.description %></p>
<% end %>
</div>