Edit/update improvements
This commit is contained in:
parent
681c0279fb
commit
32ad182870
@ -31,9 +31,11 @@ class MeasurementsController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
if @measurement.update(measurement_params)
|
if @measurement.update(measurement_params)
|
||||||
flash[:notice] = 'Updated measurement'
|
flash[:notice] = 'Updated measurement'
|
||||||
|
prepare_measurements
|
||||||
|
render :index
|
||||||
|
else
|
||||||
|
render :edit
|
||||||
end
|
end
|
||||||
prepare_measurements
|
|
||||||
render :index
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
@ -32,15 +32,6 @@
|
|||||||
<%= delete_link measurement_path(m), {remote: true, data: {}} %>
|
<%= delete_link measurement_path(m), {remote: true, data: {}} %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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 %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
$('div[id^=flash_]').remove();
|
$('div[id^=flash_]').remove();
|
||||||
$('#content').prepend('<%= j render_flash_messages %>');
|
$('#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>');
|
$('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