Class: Decidim::Admin::OrganizationController
Overview
Controller that allows managing the user organization.
Instance Method Summary
collapse
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
Instance Method Details
#edit ⇒ Object
12
13
14
15
|
# File 'app/controllers/decidim/admin/organization_controller.rb', line 12
def edit
enforce_permission_to :update, :organization, organization: current_organization
@form = form(OrganizationForm).from_model(current_organization)
end
|
#update ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/decidim/admin/organization_controller.rb', line 17
def update
enforce_permission_to :update, :organization, organization: current_organization
@form = form(OrganizationForm).from_params(params)
@form.id = current_organization.id
UpdateOrganization.call(@form, current_organization) do
on(:ok) do
flash[:notice] = I18n.t("organization.update.success", scope: "decidim.admin")
redirect_to edit_organization_path
end
on(:invalid) do
flash.now[:alert] = I18n.t("organization.update.error", scope: "decidim.admin")
render :edit
end
end
end
|
#user_entities ⇒ Object
39
40
41
|
# File 'app/controllers/decidim/admin/organization_controller.rb', line 39
def user_entities
search(current_organization.user_entities.available)
end
|
#users ⇒ Object
35
36
37
|
# File 'app/controllers/decidim/admin/organization_controller.rb', line 35
def users
search(current_organization.users.available)
end
|