Sha256: 979f910d56aaa524f88c499d6b000ed568d3faa8214ff563a53d4857e704d5f7
Contents?: true
Size: 1.54 KB
Versions: 45
Compression:
Stored size: 1.54 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 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
45 entries across 45 versions & 1 rubygems