app/controllers/decidim/accountability/admin/results_controller.rb in decidim-accountability-0.23.6 vs app/controllers/decidim/accountability/admin/results_controller.rb in decidim-accountability-0.24.0.rc1

- old
+ new

@@ -6,13 +6,19 @@ # This controller allows an admin to manage results from a Participatory Process class ResultsController < Admin::ApplicationController include Decidim::ApplicationHelper include Decidim::SanitizeHelper include Decidim::Proposals::Admin::Picker + include Decidim::Accountability::Admin::Filterable helper_method :results, :parent_result, :parent_results, :statuses, :present + def collection + parent_id = params[:parent_id].presence + @collection ||= Result.where(component: current_component, parent_id: parent_id).page(params[:page]).per(15) + end + def new enforce_permission_to :create, :result @form = form(ResultForm).instance @form.parent_id = params[:parent_id] @@ -73,11 +79,10 @@ end private def results - parent_id = params[:parent_id].presence - @results ||= Result.where(component: current_component, parent_id: parent_id).page(params[:page]).per(15) + @results ||= filtered_collection end def result @result ||= Result.where(component: current_component).find(params[:id]) end