diff --git a/app/controllers/quantities_controller.rb b/app/controllers/quantities_controller.rb index 953a43e..34cfe3f 100644 --- a/app/controllers/quantities_controller.rb +++ b/app/controllers/quantities_controller.rb @@ -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 diff --git a/app/views/quantities/_list.html.erb b/app/views/quantities/_list.html.erb index 7cb0ea8..2a1bb3f 100644 --- a/app/views/quantities/_list.html.erb +++ b/app/views/quantities/_list.html.erb @@ -76,7 +76,9 @@ <%= q.domain %> <%= q.description %> - <%= delete_link quantity_path(q), data: {} %> + + <%= delete_link quantity_path(q), {remote: true, data: {}} %> + <% end %> diff --git a/app/views/quantities/toggle.js.erb b/app/views/quantities/toggle.js.erb index 6501902..eb6067e 100644 --- a/app/views/quantities/toggle.js.erb +++ b/app/views/quantities/toggle.js.erb @@ -1 +1,3 @@ +$('div[id^=flash_]').remove(); +$('#content').prepend('<%= escape_javascript(render_flash_messages) %>'); $('#quantities').html('<%= escape_javascript(render :partial => 'quantities/list') %>');