Module: Decidim::Admin::ResourcePermissionsHelper

Defined in:
decidim-admin/app/helpers/decidim/admin/resource_permissions_helper.rb

Instance Method Summary collapse

Instance Method Details

Public: Render a link to the permissions page for a resource not related with a component and participatory space.

resource - The resource which permissions are going to be modified


27
28
29
30
31
32
33
34
35
# File 'decidim-admin/app/helpers/decidim/admin/resource_permissions_helper.rb', line 27

def free_resource_permissions_link(resource)
  resource_key = resource.resource_manifest.name.to_sym
  return unless resource.allow_resource_permissions? && allowed_to?(:update, resource_key, resource_key => resource)

  icon_link_to "key",
               send("edit_#{resource_key}_permissions_path", resource, resource_name: resource.resource_manifest.name),
               t("actions.permissions", scope: "decidim.admin"),
               class: "action-icon--permissions #{"action-icon--highlighted" if resource.permissions.present?}"
end

Public: Render a link to the permissions page for the resource.

resource - The resource which permissions are going to be modified


9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'decidim-admin/app/helpers/decidim/admin/resource_permissions_helper.rb', line 9

def resource_permissions_link(resource)
  return unless resource.allow_resource_permissions? && allowed_to?(:update, :component, component: resource.component)

  current_participatory_space_admin_proxy = ::Decidim::EngineRouter.admin_proxy(current_participatory_space)
  icon_link_to "key",
               current_participatory_space_admin_proxy.edit_component_permissions_path(
                 current_component.id,
                 resource_name: resource.resource_manifest.name,
                 resource_id: resource.id
               ),
               t("actions.permissions", scope: "decidim.admin"),
               class: "action-icon--permissions #{"action-icon--highlighted" if resource.permissions.present?}"
end