Module: Decidim::Design::AuthorHelper

Defined in:
app/helpers/decidim/design/author_helper.rb

Defined Under Namespace

Classes: AuthoredItem

Instance Method Summary collapse

Instance Method Details

#author_sectionsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'app/helpers/decidim/design/author_helper.rb', line 6

def author_sections
  [
    {
      title: t("decidim.design.helpers.context"),
      contents: [
        {
          type: :text,
          values: [
            t("decidim.design.helpers.context_description"),
            t("decidim.design.helpers.context_description_2")
          ]
        }
      ]
    },
    {
      title: t("decidim.design.helpers.variations"),
      contents: [
        {
          type: :text,
          values: [t("decidim.design.helpers.variations_description")]
        },
        {
          values: section_subtitle(title: t("decidim.design.helpers.default"))
        },
        {
          values: cell("decidim/author", user_item, demo: true)
        },
        {
          type: :text,
          values: [t("decidim.design.helpers.default_description")]
        },
        {
          values: section_subtitle(title: t("decidim.design.helpers.compact"))
        },
        {
          values: cell("decidim/author", user_item, from: authored_item, context_actions: [:date], layout: :compact, demo: true)
        },
        {
          type: :text,
          values: [t("decidim.design.helpers.compact_description")]
        },
        {
          values: section_subtitle(title: t("decidim.design.helpers.avatar"))
        },
        {
          values: cell("decidim/author", user_item, layout: :avatar, demo: true)
        },
        {
          type: :text,
          values: [t("decidim.design.helpers.avatar_description")]
        }
      ]
    },
    {
      title: t("decidim.design.helpers.source_code"),
      contents: [
        {
          type: :text,
          values: [""],
          cell_snippet: {
            cell: "decidim/author",
            args: [user_item],
            call_string: [
              'cell("decidim/author", _USER_PRESENTER_)',
              'cell("decidim/author", _USER_PRESENTER_, from: _AUTHORABLE_OR_COAUTHORABLE_RESOURCE_, context_actions: [:date], layout: :compact)',
              'cell("decidim/author", _USER_PRESENTER_, layout: :avatar)'
            ]
          }
        }
      ]
    }
  ]
end

#authored_itemObject



106
107
108
109
110
# File 'app/helpers/decidim/design/author_helper.rb', line 106

def authored_item
  AuthoredItem.new(
    published_at: 1.day.ago
  )
end

#user_itemObject



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'app/helpers/decidim/design/author_helper.rb', line 80

def user_item
  Decidim::User.new(
    organization: current_organization,
    id: 2000,
    email: "alan_smith@example.org",
    confirmed_at: Time.current,
    name: "Alan Smith",
    nickname: "alan_smith",
    personal_url: "https://alan.example.org",
    about: "Hi, I am Alan",
    accepted_tos_version: Time.current
  ).presenter
end