Class: Decidim::Elections::TrusteeZone::TrusteesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Decidim::Elections::TrusteeZone::TrusteesController
- Includes:
- FormFactory
- Defined in:
- app/controllers/decidim/elections/trustee_zone/trustees_controller.rb
Overview
Exposes the trustee zone for trustee users
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/decidim/elections/trustee_zone/trustees_controller.rb', line 10 def show (:view, :trustee, trustee:) trustee.name ||= current_user.name end |
#update ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/decidim/elections/trustee_zone/trustees_controller.rb', line 16 def update (:update, :trustee, trustee:) form = form(TrusteeForm).from_params(params, trustee:) UpdateTrustee.call(form) do on(:ok) do flash[:notice] = I18n.t("trustees.update.success", scope: "decidim.elections.trustee_zone") end on(:invalid) do flash[:alert] = form.errors..to_sentence end end redirect_to trustee_path end |