Class: Decidim::ActionDelegator::Admin::DelegationsController
- Inherits:
-
ApplicationController
- Object
- Decidim::Admin::ApplicationController
- ApplicationController
- Decidim::ActionDelegator::Admin::DelegationsController
- Includes:
- NeedsPermission, Paginable
- Defined in:
- app/controllers/decidim/action_delegator/admin/delegations_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/decidim/action_delegator/admin/delegations_controller.rb', line 25 def create :create, :delegation @form = form(DelegationForm).from_params(params) CreateDelegation.call(@form, current_user, current_setting) do on(:ok) do notice = I18n.t("delegations.create.success", scope: "decidim.action_delegator.admin") redirect_to setting_delegations_path(current_setting), notice: notice end on(:error) do |error| flash.now[:error] = error render :new end end end |
#destroy ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/decidim/action_delegator/admin/delegations_controller.rb', line 43 def destroy :destroy, :delegation, resource: delegation if delegation.destroy notice = I18n.t("delegations.destroy.success", scope: "decidim.action_delegator.admin") redirect_to setting_delegations_path(current_setting), notice: notice else error = I18n.t("delegations.destroy.error", scope: "decidim.action_delegator.admin") redirect_to setting_delegations_path(current_setting), flash: { error: error } end end |
#index ⇒ Object
15 16 17 |
# File 'app/controllers/decidim/action_delegator/admin/delegations_controller.rb', line 15 def index :index, :delegation end |
#new ⇒ Object
19 20 21 22 23 |
# File 'app/controllers/decidim/action_delegator/admin/delegations_controller.rb', line 19 def new :create, :delegation @form = form(DelegationForm).instance end |