Sha256: f0940704d3919b08b870b8ac4336d341e800bd28782bf97ed8b8f59615418413
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true module Decidim module Proposals module Admin # This controller allows admins to make private notes on proposals in a participatory process. class ProposalNotesController < Admin::ApplicationController helper_method :proposal def index authorize! :create, ProposalNote @form = form(ProposalNoteForm).instance end def create authorize! :create, ProposalNote @form = form(ProposalNoteForm).from_params(params) CreateProposalNote.call(@form, proposal, current_user) do on(:ok) do flash[:notice] = I18n.t("proposals.create.success", scope: "decidim") redirect_to proposal_proposal_notes_path(proposal_id: proposal.id) end on(:invalid) do flash.now[:alert] = I18n.t("proposals.create.error", scope: "decidim") render :index end end end private def proposal @proposals ||= Proposal.where(feature: current_feature).find(params[:proposal_id]) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems