Edit/update improvements
This commit is contained in:
parent
681c0279fb
commit
32ad182870
@ -31,9 +31,11 @@ class MeasurementsController < ApplicationController
|
||||
def update
|
||||
if @measurement.update(measurement_params)
|
||||
flash[:notice] = 'Updated measurement'
|
||||
prepare_measurements
|
||||
render :index
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
prepare_measurements
|
||||
render :index
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
@ -32,15 +32,6 @@
|
||||
<%= delete_link measurement_path(m), {remote: true, data: {}} %>
|
||||
</td>
|
||||
</tr>
|
||||
<% if (m == @measurement) && @measurement.errors.present? %>
|
||||
<tr>
|
||||
<td class="form" colspan="5">
|
||||
<div id="edit-measurement">
|
||||
<%= render partial: 'measurements/edit_form' %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -1,3 +1,4 @@
|
||||
$('div[id^=flash_]').remove();
|
||||
$('#content').prepend('<%= j render_flash_messages %>');
|
||||
$('tr[id=measurement-<%= @measurement.id %>]').nextUntil('tr.measurement').remove();
|
||||
$('tr[id=measurement-<%= @measurement.id %>]').after('<tr><td class="form" colspan="5"><div id="edit-measurement"><%= j render partial: "measurements/edit_form" %></div></td></tr>');
|
||||
|
Reference in New Issue
Block a user