Class: Decidim::Admin::UpdateFeaturePermissions
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Admin::UpdateFeaturePermissions
- Defined in:
- decidim-admin/app/commands/decidim/admin/update_feature_permissions.rb
Overview
This command gets called when permissions for a feature are updated in the admin panel.
Instance Attribute Summary collapse
-
#feature ⇒ Object
readonly
Returns the value of attribute feature.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
Instance Method Summary collapse
-
#call ⇒ Object
Public: Sets the permissions for a feature.
-
#initialize(form, feature) ⇒ UpdateFeaturePermissions
constructor
Public: Initializes the command.
Constructor Details
#initialize(form, feature) ⇒ UpdateFeaturePermissions
Public: Initializes the command.
form - The form from which the data in this feature comes from. feature - The feature to update.
13 14 15 16 |
# File 'decidim-admin/app/commands/decidim/admin/update_feature_permissions.rb', line 13 def initialize(form, feature) @form = form @feature = feature end |
Instance Attribute Details
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
7 8 9 |
# File 'decidim-admin/app/commands/decidim/admin/update_feature_permissions.rb', line 7 def feature @feature end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
7 8 9 |
# File 'decidim-admin/app/commands/decidim/admin/update_feature_permissions.rb', line 7 def form @form end |
Instance Method Details
#call ⇒ Object
Public: Sets the permissions for a feature.
Broadcasts :ok if created, :invalid otherwise.
21 22 23 24 25 26 |
# File 'decidim-admin/app/commands/decidim/admin/update_feature_permissions.rb', line 21 def call return broadcast(:invalid) unless @form.valid? broadcast(:ok) end |