Module: Decidim::Design::IconographyHelper

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

Instance Method Summary collapse

Instance Method Details

#iconography_sectionsObject



9
10
11
# File '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 '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 '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 '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 '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