app/controllers/decidim/accountability/admin/results_controller.rb in decidim-accountability-0.21.0 vs app/controllers/decidim/accountability/admin/results_controller.rb in decidim-accountability-0.22.0
- old
+ new
@@ -5,10 +5,12 @@
module Admin
# 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
+
helper_method :results, :parent_result, :parent_results, :statuses, :present
def new
enforce_permission_to :create, :result
@@ -64,29 +66,9 @@
DestroyResult.call(result, current_user) do
on(:ok) do
flash[:notice] = I18n.t("results.destroy.success", scope: "decidim.accountability.admin")
redirect_to results_path(parent_id: result.parent_id)
- end
- end
- end
-
- def proposals
- respond_to do |format|
- format.html do
- render partial: "proposals"
- end
- format.json do
- query = Decidim.find_resource_manifest(:proposals)
- .try(:resource_scope, current_component)&.order(title: :asc)
- term = params[:term]
- if term&.start_with?("#")
- term.delete!("#")
- query = query.where("CAST(id AS TEXT) LIKE ?", "#{term}%")
- else
- query = query.where("title ilike ?", "%#{params[:term]}%")
- end
- render json: query.all.collect { |p| [decidim_html_escape(present(p).title), p.id] }
end
end
end
private