Module: Decidim::Design::IconographyHelper

Includes:
IconHelper, SocialShareButtonHelper
Defined in:
decidim-design/app/helpers/decidim/design/iconography_helper.rb

Instance Method Summary collapse

Methods included from SocialShareButtonHelper

#render_social_share_button, #render_social_share_buttons, #render_social_share_icon, #social_share_button_tag

Methods included from IconHelper

#component_icon, #manifest_icon, #resource_icon, #resource_type_icon, #resource_type_icon_key, #text_with_resource_icon

Methods included from LayoutHelper

#_icon_classes, #apple_favicon, #application_path, #current_url, #current_user_unread_data, #extended_navigation_bar, #external_icon, #favicon, #icon, #legacy_favicon, #role

Methods included from TooltipHelper

#with_tooltip

Methods included from ModalHelper

#decidim_drawer, #decidim_modal

Methods included from OrganizationHelper

#current_organization_name, #organization_colors, #organization_description_label, #organization_name

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#iconography_sectionsObject



9
10
11
# File 'decidim-design/app/helpers/decidim/design/iconography_helper.rb', line 9

def iconography_sections
  (remix_icons + social_share_icons).sort_by { |section| section[:id] }
end

#iconography_table(table_rows) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'decidim-design/app/helpers/decidim/design/iconography_helper.rb', line 13

def iconography_table(table_rows)
  options = { class: "mx-auto w-4 h-4 text-gray fill-current flex-none" }
  table_rows.map do |table_cell|
    row = []

    row << icon(table_cell[:name], **options)
    row << (:code, table_cell[:icon])
    row << table_cell[:category]
    row << table_cell[:description]

    row
  end
end

#remix_iconsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'decidim-design/app/helpers/decidim/design/iconography_helper.rb', line 27

def remix_icons
  Decidim.icons.categories.map do |category, values|
    {
      id: category,
      contents: [
        {
          type: :table,
          options: { headings: %w(Icon Code Category Description) },
          items: iconography_table(values.sort_by { |v| v[:icon] })
        }
      ]
    }
  end
end

#social_share_iconography_tableObject



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'decidim-design/app/helpers/decidim/design/iconography_helper.rb', line 57

def social_share_iconography_table
  options = { class: "mx-auto w-4 h-4 text-gray fill-current flex-none" }
  Decidim.social_share_services_registry.manifests.map do |service|
    row = []

    row << render_social_share_icon(service, **options)
    row << (:code, service.name)
    row << "social-share"
    row << t("decidim.shared.share_modal.share_to", service: service.name)

    row
  end
end

#social_share_iconsObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'decidim-design/app/helpers/decidim/design/iconography_helper.rb', line 42

def social_share_icons
  [
    {
      id: "social-share",
      contents: [
        {
          type: :table,
          options: { headings: %w(Icon Code Category Description) },
          items: social_share_iconography_table
        }
      ]
    }
  ]
end