1
0

Fixed creating/updating with MeasurementRoutine

Updated Measurement links with :view
This commit is contained in:
cryptogopher
2020-04-03 18:34:39 +02:00
parent 9f63c14f8a
commit 14f4c063de
7 changed files with 24 additions and 20 deletions

View File

@@ -1,3 +0,0 @@
<% unless @routine.description.empty? %>
<p><%= @routine.description %></p>
<% end %>

View File

@@ -1,18 +1,19 @@
<div>
<%= f.fields_for :routine do |ff| %>
<%= fields_for 'measurement[routine_attributes]', @routine do |ff| %>
<p>
<%= ff.select :id,
options_from_collection_for_select(@project.measurement_routines,
:id, :name, @routine.id),
{label: :field_measurement_routine, required: true},
onchange: "var mr_id = $('#measurement_routine_attributes_id option:selected').val();
autocomplete: 'off',
onchange: "var mr_id = $('#measurement_routine_attributes_id').val();
$.ajax({
url: '#{measurement_routine_path(id: :mr_id)}'.replace('mr_id', mr_id),
dataType: 'script'
});
return false;" %>
<%= link_to l(:button_edit), '#',
onclick: "var mr_id = $('#measurement_routine_attributes_id option:selected').val();
onclick: "var mr_id = $('#measurement_routine_attributes_id').val();
$.ajax({
url: '#{edit_measurement_routine_path(id: :mr_id)}'.replace('mr_id', mr_id),
dataType: 'script'
@@ -21,7 +22,7 @@
class: 'icon icon-edit' %>
</p>
<% end %>
<div id='measurement-routine'>
<%= render partial: 'measurement_routines/show' %>
</div>
<% unless @routine.description.empty? %>
<p><%= @routine.description %></p>
<% end %>
</div>

View File

@@ -1 +1 @@
$('#measurement-routine').html('<%= j render partial: 'measurement_routines/show' %>');
$('#measurement-routine-form').html('<%= j render partial: 'measurement_routines/show_form' %>');

View File

@@ -27,7 +27,7 @@
</div>
</td>
<td class="source"><%= m.source.name if m.source.present? %></td>
<td class="action unwrappable"><%= action_links(m) %></td>
<td class="action unwrappable"><%= action_links(m, :index) %></td>
</tr>
<% end %>
</tbody>

View File

@@ -38,7 +38,7 @@
<% @requested_r[index].each do |*, value| %>
<td class="primary value ellipsible"><%= format_value(value) %></td>
<% end %>
<td class="action unwrappable"><%= action_links(m) %></td>
<td class="action unwrappable"><%= action_links(m, :readouts) %></td>
</tr>
<tr class="<%= row_class %>" style="display:none">
@@ -57,7 +57,9 @@
<p class="value"><%= format_value(value) %></p>
</td>
<% end %>
<td rowspan="<%= rows %>" class="action unwrappable"><%= action_links(m) %></td>
<td rowspan="<%= rows %>" class="action unwrappable">
<%= action_links(m, :readouts) %>
</td>
</tr>
<% next unless @quantities.length > 0 %>