Class: Decidim::Proposals::Admin::ProposalStatesController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Proposals::Admin::ProposalStatesController
- Includes:
- Decidim::Paginable
- Defined in:
- app/controllers/decidim/proposals/admin/proposal_states_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/decidim/proposals/admin/proposal_states_controller.rb', line 19 def create :create, :proposal_state @form = form(ProposalStateForm).from_params(params) CreateProposalState.call(@form) do on(:ok) do flash[:notice] = I18n.t("proposal_states.create.success", scope: "decidim.proposals.admin") redirect_to proposal_states_path end on(:invalid) do flash.keep[:alert] = I18n.t("proposal_states.create.error", scope: "decidim.proposals.admin") render action: :new end end end |
#destroy ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/decidim/proposals/admin/proposal_states_controller.rb', line 62 def destroy (:destroy, :proposal_state, proposal_state:) DestroyProposalState.call(proposal_state, current_user) do on(:ok) do flash[:notice] = I18n.t("proposal_states.destroy.success", scope: "decidim.proposals.admin") redirect_to proposal_states_path end end end |
#edit ⇒ Object
38 39 40 41 |
# File 'app/controllers/decidim/proposals/admin/proposal_states_controller.rb', line 38 def edit (:update, :proposal_state, proposal_state:) @form = form(Decidim::Proposals::Admin::ProposalStateForm).from_model(proposal_state) end |
#index ⇒ Object
10 11 12 |
# File 'app/controllers/decidim/proposals/admin/proposal_states_controller.rb', line 10 def index :read, :proposal_state end |
#new ⇒ Object
14 15 16 17 |
# File 'app/controllers/decidim/proposals/admin/proposal_states_controller.rb', line 14 def new :create, :proposal_state @form = form(Decidim::Proposals::Admin::ProposalStateForm).instance end |
#update ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/decidim/proposals/admin/proposal_states_controller.rb', line 43 def update (:update, :proposal_state, proposal_state:) @form = form(ProposalStateForm).from_params(params) UpdateProposalState.call(@form, proposal_state) do on(:ok) do flash[:notice] = I18n.t("proposal_states.update.success", scope: "decidim.proposals.admin") redirect_to proposal_states_path end on(:invalid) do flash.now[:alert] = I18n.t("proposal_states.update.error", scope: "decidim.proposals.admin") render action: :edit end end end |