1
0

Quantity#destroy changed to AJAX

This commit is contained in:
cryptogopher 2019-10-27 20:05:57 +01:00
parent daf0bd421e
commit 3cec0847df
3 changed files with 7 additions and 2 deletions

View File

@ -23,7 +23,8 @@ class QuantitiesController < ApplicationController
if @quantity.destroy
flash[:notice] = 'Deleted quantity'
end
redirect_to project_quantities_url(@project)
@quantities = @project.quantities
render :toggle
end
def toggle

View File

@ -76,7 +76,9 @@
</td>
<td class="domain"><%= q.domain %></td>
<td class="description"><%= q.description %></td>
<td class="action"><%= delete_link quantity_path(q), data: {} %></td>
<td class="action">
<%= delete_link quantity_path(q), {remote: true, data: {}} %>
</td>
</tr>
<% end %>
</tbody>

View File

@ -1 +1,3 @@
$('div[id^=flash_]').remove();
$('#content').prepend('<%= escape_javascript(render_flash_messages) %>');
$('#quantities').html('<%= escape_javascript(render :partial => 'quantities/list') %>');