Module: Decidim::Admin::ResourceScopeHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/decidim/admin/resource_scope_helper.rb

Overview

This module includes helpers to show scopes in admin

Instance Method Summary collapse

Instance Method Details

#td_resource_scope_for(current_scope) ⇒ Object

Public: This helper shows the td for the given scope.

current_scope - Scope object to show



21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/decidim/admin/resource_scope_helper.rb', line 21

def td_resource_scope_for(current_scope)
  return unless resource_with_scopes_enabled?

  scope_name = if current_scope
                 translated_attribute(current_scope.name)
               else
                 t("decidim.scopes.global")
               end
  (:td, scope_name)
end

#th_resource_scope_label(scope_label = t("decidim.admin.resources.index.headers.scope")) ⇒ Object

Public: This helper shows the th with the scope label.

scope_label - I18n translation to show



11
12
13
14
15
# File 'app/helpers/decidim/admin/resource_scope_helper.rb', line 11

def th_resource_scope_label(scope_label = t("decidim.admin.resources.index.headers.scope"))
  return unless resource_with_scopes_enabled?

  (:th, scope_label)
end

Public: This helper shows th with the sort link element.



33
34
35
36
37
38
39
# File 'app/helpers/decidim/admin/resource_scope_helper.rb', line 33

def th_scope_sort_link
  return unless resource_with_scopes_enabled?

  (:th) do
    sort_link(query, :scope_name, t("decidim.admin.resources.index.headers.scope"))
  end
end