Sha256: 3cde751ced5a9b184b2de96869d17b8e2d55d9f9ae84c9d68d819fd1a9eb0ac2
Contents?: true
Size: 1.67 KB
Versions: 7
Compression:
Stored size: 1.67 KB
Contents
# frozen_string_literal: true module Decidim module Initiatives module Admin # Controller used to manage the initiatives answers class AnswersController < Decidim::Initiatives::Admin::ApplicationController include Decidim::Initiatives::NeedsInitiative include Decidim::Admin::ParticipatorySpaceAdminBreadcrumb add_breadcrumb_item_from_menu :admin_initiative_actions_menu helper Decidim::Initiatives::InitiativeHelper layout "decidim/admin/initiatives" # GET /admin/initiatives/:id/answer/edit def edit enforce_permission_to :answer, :initiative, initiative: current_initiative @form = form(Decidim::Initiatives::Admin::InitiativeAnswerForm) .from_model( current_initiative, initiative: current_initiative ) end # PUT /admin/initiatives/:id/answer def update enforce_permission_to :answer, :initiative, initiative: current_initiative @form = form(Decidim::Initiatives::Admin::InitiativeAnswerForm) .from_params(params, initiative: current_initiative) UpdateInitiativeAnswer.call(current_initiative, @form, current_user) do on(:ok) do flash[:notice] = I18n.t("initiatives.update.success", scope: "decidim.initiatives.admin") redirect_to initiatives_path end on(:invalid) do flash[:alert] = I18n.t("initiatives.update.error", scope: "decidim.initiatives.admin") redirect_to edit_initiative_answer_path end end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems