Class: Decidim::Admin::ManagedUsers::PromotionsController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- ApplicationController
- Decidim::Admin::ManagedUsers::PromotionsController
- Defined in:
- app/controllers/decidim/admin/managed_users/promotions_controller.rb
Overview
Controller that allows promoting managed users at the admin panel.
Instance Method Summary collapse
Methods inherited from ApplicationController
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/decidim/admin/managed_users/promotions_controller.rb', line 16 def create :promote, :managed_user, user: user @form = form(ManagedUserPromotionForm).from_params(params) PromoteManagedUser.call(@form, user, current_user) do on(:ok) do flash[:notice] = I18n.t("managed_users.promotion.success", scope: "decidim.admin") redirect_to impersonatable_users_path end on(:invalid) do flash.now[:alert] = I18n.t("managed_users.promotion.error", scope: "decidim.admin") render :new end end end |
#new ⇒ Object
11 12 13 14 |
# File 'app/controllers/decidim/admin/managed_users/promotions_controller.rb', line 11 def new :promote, :managed_user, user: user @form = form(ManagedUserPromotionForm).instance end |