Class: Decidim::Votings::Admin::MonitoringCommitteeMembersController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Votings::Admin::MonitoringCommitteeMembersController
- Includes:
- VotingAdmin
- Defined in:
- app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb
Overview
This controller allows to create or delete a monitoring committee member.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb', line 23 def create :create, :monitoring_committee_member, voting: current_voting @form = form(VotingUserRoleForm).from_params(params, voting: current_voting) CreateMonitoringCommitteeMember.call(@form, current_user, current_voting) do on(:ok) do flash[:notice] = I18n.t("monitoring_committee_members.create.success", scope: "decidim.votings.admin") redirect_to voting_monitoring_committee_members_path(current_voting) end on(:invalid) do flash.now[:alert] = I18n.t("monitoring_committee_members.create.invalid", scope: "decidim.votings.admin") render action: "new" end end end |
#destroy ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb', line 40 def destroy (:delete, :monitoring_committee_member, voting: current_voting, monitoring_committee_member:) DestroyMonitoringCommitteeMember.call(monitoring_committee_member, current_user) do on(:ok) do flash[:notice] = I18n.t("monitoring_committee_members.destroy.success", scope: "decidim.votings.admin") end on(:invalid) do flash.now[:alert] = I18n.t("monitoring_committee_members.destroy.invalid", scope: "decidim.votings.admin") end end redirect_to voting_monitoring_committee_members_path(current_voting) end |
#index ⇒ Object
14 15 16 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb', line 14 def index :read, :monitoring_committee_members, voting: current_voting end |
#new ⇒ Object
18 19 20 21 |
# File 'app/controllers/decidim/votings/admin/monitoring_committee_members_controller.rb', line 18 def new :create, :monitoring_committee_member, voting: current_voting @form = form(VotingUserRoleForm).instance end |