decidim-design 0.28.3 → 0.29.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/decidim/design/activities_helper.rb +23 -23
- data/app/helpers/decidim/design/address_helper.rb +45 -20
- data/app/helpers/decidim/design/announcement_helper.rb +45 -21
- data/app/helpers/decidim/design/application_helper.rb +28 -9
- data/app/helpers/decidim/design/author_helper.rb +57 -35
- data/app/helpers/decidim/design/buttons_helper.rb +67 -11
- data/app/helpers/decidim/design/cards_helper.rb +504 -64
- data/app/helpers/decidim/design/colors_helper.rb +33 -29
- data/app/helpers/decidim/design/follow_helper.rb +6 -17
- data/app/helpers/decidim/design/report_helper.rb +6 -13
- data/app/helpers/decidim/design/share_helper.rb +6 -13
- data/app/helpers/decidim/design/tab_panels_helper.rb +57 -13
- data/app/helpers/decidim/design/typography_helper.rb +4 -3
- data/app/packs/entrypoints/decidim_design.js +1 -0
- data/app/packs/stylesheets/_datepicker.scss +9 -0
- data/app/packs/stylesheets/design.scss +6 -0
- data/app/views/decidim/design/components/accordions.html.erb +19 -17
- data/app/views/decidim/design/components/activities/_static-activities.html.erb +1 -1
- data/app/views/decidim/design/components/activities/_static-activity.html.erb +1 -1
- data/app/views/decidim/design/components/activities.html.erb +1 -1
- data/app/views/decidim/design/components/address.html.erb +1 -1
- data/app/views/decidim/design/components/announcement.html.erb +1 -1
- data/app/views/decidim/design/components/author.html.erb +1 -1
- data/app/views/decidim/design/components/buttons.html.erb +2 -2
- data/app/views/decidim/design/components/cards/_static-card-l-extra-data-2.html.erb +1 -1
- data/app/views/decidim/design/components/cards/_static-card-l-image.html.erb +1 -1
- data/app/views/decidim/design/components/cards/_static-card-l.html.erb +1 -1
- data/app/views/decidim/design/components/cards.html.erb +1 -1
- data/app/views/decidim/design/components/dialogs.html.erb +21 -21
- data/app/views/decidim/design/components/dropdowns.html.erb +14 -14
- data/app/views/decidim/design/components/follow.html.erb +1 -1
- data/app/views/decidim/design/components/forms.html.erb +35 -21
- data/app/views/decidim/design/components/report.html.erb +1 -1
- data/app/views/decidim/design/components/share.html.erb +1 -1
- data/app/views/decidim/design/components/tab_panels.html.erb +1 -1
- data/app/views/decidim/design/components/tooltips.html.erb +104 -0
- data/app/views/decidim/design/foundations/accessibility.html.erb +41 -41
- data/app/views/decidim/design/foundations/color.html.erb +6 -3
- data/app/views/decidim/design/foundations/iconography.html.erb +4 -3
- data/app/views/decidim/design/foundations/layout.html.erb +31 -30
- data/app/views/decidim/design/foundations/typography.html.erb +2 -2
- data/app/views/decidim/design/home/index.html.erb +6 -6
- data/app/views/decidim/design/shared/_cell_call_textarea.html.erb +5 -0
- data/app/views/decidim/design/shared/_cell_snippet.html.erb +1 -3
- data/app/views/decidim/design/shared/_cell_table.html.erb +12 -0
- data/app/views/decidim/design/shared/_table.html.erb +1 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +7 -0
- data/config/locales/bg.yml +309 -0
- data/config/locales/ca.yml +309 -0
- data/config/locales/cs.yml +258 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +309 -0
- data/config/locales/el.yml +1 -0
- data/config/locales/en.yml +309 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +309 -0
- data/config/locales/es-PY.yml +309 -0
- data/config/locales/es.yml +309 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +309 -0
- data/config/locales/fa-IR.yml +1 -0
- data/config/locales/fi-plain.yml +309 -0
- data/config/locales/fi.yml +309 -0
- data/config/locales/fr-CA.yml +309 -0
- data/config/locales/fr.yml +309 -0
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +1 -0
- data/config/locales/gn-PY.yml +1 -0
- data/config/locales/he-IL.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +1 -0
- data/config/locales/id-ID.yml +1 -0
- data/config/locales/is-IS.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/ja.yml +309 -0
- data/config/locales/ka-GE.yml +1 -0
- data/config/locales/kaa.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +1 -0
- data/config/locales/lo-LA.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/no.yml +9 -0
- data/config/locales/oc-FR.yml +1 -0
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +309 -0
- data/config/locales/pt-BR.yml +1 -0
- data/config/locales/pt.yml +1 -0
- data/config/locales/ro-RO.yml +45 -0
- data/config/locales/ru.yml +1 -0
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +1 -0
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sq-AL.yml +1 -0
- data/config/locales/sr-CS.yml +1 -0
- data/config/locales/sv.yml +1 -0
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/th-TH.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +78 -0
- data/config/locales/uk.yml +1 -0
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1 -0
- data/config/locales/zh-TW.yml +1 -0
- data/decidim-design.gemspec +1 -1
- data/lib/decidim/design/version.rb +1 -1
- metadata +77 -18
- data/app/views/decidim/design/components/address/_static-address-online.html.erb +0 -26
- data/app/views/decidim/design/components/address/_static-address-person.html.erb +0 -25
- data/app/views/decidim/design/components/author/_static-avatar.html.erb +0 -38
- data/app/views/decidim/design/components/author/_static-compact.html.erb +0 -46
- data/app/views/decidim/design/components/author/_static-default.html.erb +0 -35
- data/app/views/decidim/design/components/follow/_static-follow-default.html.erb +0 -4
- data/app/views/decidim/design/components/follow/_static-follow-unfollow.html.erb +0 -4
- data/app/views/decidim/design/components/report/_static-report.html.erb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4af1cbd5a726cd380668994af88a6d8a8485741fe7179885331bd5e26a30824a
|
4
|
+
data.tar.gz: d3d79bd876604656fd248eb9b6e97db5617d11a48b86e3beeaddf93fa316cbdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 495faab14fdfd9e2bccd36505acc1bf76824f48a40f702b77d4fa770ab4fbbe52a3fcd4779a7d584a6f04f830885a2864dd2a66b3fb07a8139b72986481eae9c
|
7
|
+
data.tar.gz: 0e859664089048cdd39ab2f5eb73cb899c3f937f655410551926e4c13098c81182bf25bcceb5a5635fa02677a4cec7c525430af0fc89ecfdb8fe680a23549ff8
|
@@ -6,29 +6,28 @@ module Decidim
|
|
6
6
|
def activities_sections
|
7
7
|
[
|
8
8
|
{
|
9
|
-
id: "demo",
|
9
|
+
id: t("decidim.design.helpers.demo"),
|
10
10
|
contents: [
|
11
11
|
{
|
12
12
|
type: :text,
|
13
|
-
values: ["
|
13
|
+
values: [t("decidim.design.helpers.demo_text")]
|
14
14
|
},
|
15
15
|
{
|
16
16
|
type: :partial,
|
17
|
-
template: "decidim/design/components/activities/static-
|
17
|
+
template: "decidim/design/components/activities/static-activity"
|
18
18
|
},
|
19
19
|
{
|
20
20
|
type: :text,
|
21
|
-
values: ["
|
21
|
+
values: [t("decidim.design.helpers.demo_text_2")]
|
22
22
|
}
|
23
23
|
]
|
24
24
|
},
|
25
25
|
{
|
26
|
-
id: "variations",
|
26
|
+
id: t("decidim.design.helpers.variations"),
|
27
27
|
contents: [
|
28
28
|
{
|
29
29
|
type: :text,
|
30
|
-
values: ["
|
31
|
-
whether belong to a participatory space or not, has an author or not."]
|
30
|
+
values: [t("decidim.design.helpers.variations_text")]
|
32
31
|
},
|
33
32
|
{
|
34
33
|
type: :partial,
|
@@ -37,29 +36,30 @@ module Decidim
|
|
37
36
|
]
|
38
37
|
},
|
39
38
|
{
|
40
|
-
id: "
|
39
|
+
id: t("decidim.design.helpers.source_code"),
|
41
40
|
contents: [
|
42
41
|
{
|
43
|
-
type: :
|
44
|
-
options: { headings:
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
type: :cell_table,
|
43
|
+
options: { headings: [t("decidim.design.components.activities.activities")] },
|
44
|
+
cell_snippet: {
|
45
|
+
cell: "decidim/activities",
|
46
|
+
args: [Decidim::ActionLog.where(resource_type: "Decidim::ParticipatoryProcess", organization: current_organization).first(5)],
|
47
|
+
call_string: 'cell("decidim/activities", _ACTION_LOG_ITEMS_LIST)'
|
48
|
+
}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
type: :cell_table,
|
52
|
+
options: { headings: [t("decidim.design.helpers.activity")] },
|
53
|
+
cell_snippet: {
|
54
|
+
cell: "decidim/activity",
|
55
|
+
args: [Decidim::ActionLog.where(resource_type: "Decidim::ParticipatoryProcess", organization: current_organization).last],
|
56
|
+
call_string: 'cell("decidim/activity", _ACTION_LOG_ITEM_)'
|
57
|
+
}
|
49
58
|
}
|
50
59
|
]
|
51
60
|
}
|
52
61
|
]
|
53
62
|
end
|
54
|
-
|
55
|
-
def activities_table(*table_rows, **_opts)
|
56
|
-
table_rows.map do |table_cell|
|
57
|
-
row = []
|
58
|
-
row << table_cell[:name]
|
59
|
-
row << link_to(table_cell[:url].split("/").last, table_cell[:url], target: "_blank", class: "text-secondary underline", rel: "noopener")
|
60
|
-
row
|
61
|
-
end
|
62
|
-
end
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -6,54 +6,79 @@ module Decidim
|
|
6
6
|
def address_sections
|
7
7
|
[
|
8
8
|
{
|
9
|
-
id: "demo",
|
9
|
+
id: t("decidim.design.helpers.demo"),
|
10
10
|
contents: [
|
11
11
|
{
|
12
12
|
type: :text,
|
13
13
|
values: [
|
14
|
-
"
|
14
|
+
t("decidim.design.helpers.address_description")
|
15
15
|
]
|
16
16
|
},
|
17
17
|
{
|
18
|
-
|
19
|
-
template: "decidim/design/components/address/static-address-person"
|
18
|
+
values: cell("decidim/address", address_item)
|
20
19
|
},
|
21
20
|
{
|
22
21
|
type: :text,
|
23
22
|
values: [
|
24
|
-
"
|
25
|
-
For such cases, the displayed information is quite the same but shaped to fit."
|
23
|
+
t("decidim.design.helpers.address_description_2")
|
26
24
|
]
|
27
25
|
},
|
28
26
|
{
|
29
|
-
|
30
|
-
template: "decidim/design/components/address/static-address-online"
|
27
|
+
values: cell("decidim/address", online_item, online: true)
|
31
28
|
}
|
32
29
|
]
|
33
30
|
},
|
34
31
|
{
|
35
|
-
id: "
|
32
|
+
id: t("decidim.design.helpers.source_code"),
|
36
33
|
contents: [
|
37
34
|
{
|
38
|
-
type: :
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
type: :text,
|
36
|
+
values: [""],
|
37
|
+
cell_snippet: {
|
38
|
+
cell: "decidim/address",
|
39
|
+
args: [address_item],
|
40
|
+
call_string: [
|
41
|
+
'cell("decidim/address", _RESOURCE_)',
|
42
|
+
'cell("decidim/address", _RESOURCE_, online: true)'
|
43
|
+
]
|
44
|
+
}
|
43
45
|
}
|
44
46
|
]
|
45
47
|
}
|
46
48
|
]
|
47
49
|
end
|
48
50
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
def addressable_class
|
52
|
+
Class.new(ApplicationRecord) do
|
53
|
+
self.table_name = Decidim::Pages::Page.table_name
|
54
|
+
|
55
|
+
attr_accessor :organization, :location, :address, :latitude, :longitude, :online_meeting_url, :type_of_meeting, :start_time, :end_time
|
56
|
+
|
57
|
+
geocoded_by :address
|
55
58
|
end
|
56
59
|
end
|
60
|
+
|
61
|
+
def address_item
|
62
|
+
addressable_class.new(
|
63
|
+
organization: current_organization,
|
64
|
+
location: "Barcelona",
|
65
|
+
address: "Carrer del Pare Llaurador, 113",
|
66
|
+
latitude: 40.1234,
|
67
|
+
longitude: 2.1234,
|
68
|
+
start_time: 2.days.from_now,
|
69
|
+
end_time: 2.days.from_now + 4.hours
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
def online_item
|
74
|
+
addressable_class.new(
|
75
|
+
organization: current_organization,
|
76
|
+
type_of_meeting: "online",
|
77
|
+
online_meeting_url: "https://meet.jit.si/DecidimTry",
|
78
|
+
start_time: 2.days.from_now,
|
79
|
+
end_time: 2.days.from_now + 4.hours
|
80
|
+
)
|
81
|
+
end
|
57
82
|
end
|
58
83
|
end
|
59
84
|
end
|
@@ -6,52 +6,76 @@ module Decidim
|
|
6
6
|
def announcement_sections
|
7
7
|
[
|
8
8
|
{
|
9
|
-
|
9
|
+
title: t("decidim.design.helpers.callout_class"),
|
10
10
|
contents: [
|
11
11
|
{
|
12
12
|
type: :text,
|
13
|
-
values: ["
|
13
|
+
values: [t("decidim.design.helpers.callout_description")]
|
14
14
|
},
|
15
15
|
{
|
16
16
|
type: :table,
|
17
|
-
options: { headings: ["
|
17
|
+
options: { headings: [t("decidim.design.components.announcement.title"), t("decidim.design.helpers.callout_class")] },
|
18
18
|
items: announcement_table(
|
19
|
-
{ text: "
|
20
|
-
{ text: "
|
21
|
-
{ text: "
|
22
|
-
{ text: "
|
19
|
+
{ text: t("decidim.design.components.announcement.iam_an_announcement"), callout_class: "success" },
|
20
|
+
{ text: t("decidim.design.components.announcement.iam_an_announcement"), callout_class: "warning" },
|
21
|
+
{ text: t("decidim.design.components.announcement.iam_an_announcement"), callout_class: "alert" },
|
22
|
+
{ text: t("decidim.design.components.announcement.iam_an_announcement"), callout_class: "secondary" },
|
23
|
+
{ text: t("decidim.design.components.announcement.iam_an_announcement"), callout_class: nil }
|
23
24
|
),
|
24
25
|
cell_snippet: {
|
25
26
|
cell: "decidim/announcement",
|
26
|
-
args: ["
|
27
|
+
args: [t("decidim.design.components.announcement.iam_an_announcement"), { callout_class: "success" }],
|
28
|
+
call_string: [
|
29
|
+
'cell("decidim/announcement", "I am an announcement", callout_class: "success")',
|
30
|
+
'cell("decidim/announcement", "I am an announcement", callout_class: "warning")',
|
31
|
+
'cell("decidim/announcement", "I am an announcement", callout_class: "alert")',
|
32
|
+
'cell("decidim/announcement", "I am an announcement", callout_class: "secondary")',
|
33
|
+
'cell("decidim/announcement", "I am an announcement")'
|
34
|
+
]
|
27
35
|
}
|
28
36
|
}
|
29
37
|
]
|
30
38
|
},
|
31
39
|
{
|
32
|
-
|
40
|
+
title: t("decidim.design.helpers.plain_text_vs_hash"),
|
33
41
|
contents: [
|
34
42
|
{
|
35
43
|
type: :text,
|
36
|
-
values: ["
|
44
|
+
values: [t("decidim.design.helpers.plain_text_description")]
|
37
45
|
},
|
38
46
|
{
|
39
47
|
type: :table,
|
40
|
-
options: { headings: ["
|
48
|
+
options: { headings: [t("decidim.design.components.announcement.title"), t("decidim.design.helpers.callout_class"), t("decidim.design.helpers.argument")] },
|
41
49
|
items: announcement_table(
|
42
|
-
{ text:
|
43
|
-
|
50
|
+
{ text: { title: t("decidim.design.components.announcement.this_is_the_title"), body: t("decidim.design.components.announcement.this_is_the_body") },
|
51
|
+
callout_class: "success",
|
52
|
+
argument: '{ title: "This is the title", body: "This is the body" }, callout_class: "success"' },
|
53
|
+
{ text: { title: t("decidim.design.components.announcement.this_is_the_title"), body: t("decidim.design.components.announcement.this_is_the_body") },
|
54
|
+
callout_class: "warning",
|
55
|
+
argument: '{ title: "This is the title", body: "This is the body" }, callout_class: "warning"' },
|
56
|
+
{ text: { title: t("decidim.design.components.announcement.this_is_the_title"), body: t("decidim.design.components.announcement.this_is_the_body") },
|
57
|
+
callout_class: "alert",
|
58
|
+
argument: '{ title: "This is the title", body: "This is the body" }, callout_class: "alert"' },
|
59
|
+
{ text: { title: t("decidim.design.components.announcement.this_is_the_title"), body: t("decidim.design.components.announcement.this_is_the_body") },
|
60
|
+
callout_class: "secondary",
|
61
|
+
argument: '{ title: "This is the title", body: "This is the body" }, callout_class: "secondary"' },
|
62
|
+
{ text: { title: t("decidim.design.components.announcement.this_is_the_title"), body: t("decidim.design.components.announcement.this_is_the_body") },
|
63
|
+
callout_class: nil,
|
44
64
|
argument: '{ title: "This is the title", body: "This is the body" }' },
|
45
|
-
{ text:
|
46
|
-
argument: '{ text: { title: "This is the title", body: "This is the body" }, callout_class: "warning" }' },
|
47
|
-
{ text: { title: "This is the title", body: "This is the body" }, callout_class: "alert",
|
48
|
-
argument: '{ text: { title: "This is the title", body: "This is the body" }, callout_class: "alert" }' },
|
49
|
-
{ text: { title: "This is the title", body: "This is the body" }, callout_class: "success",
|
50
|
-
argument: '{ text: { title: "This is the title", body: "This is the body" }, callout_class: "success" }' }
|
65
|
+
{ text: t("decidim.design.helpers.plain_text"), callout_class: nil, argument: '"I am just plain text"' }
|
51
66
|
),
|
52
67
|
cell_snippet: {
|
53
68
|
cell: "decidim/announcement",
|
54
|
-
args: [{ title: "
|
69
|
+
args: [{ title: t("decidim.design.components.announcement.this_is_the_title"), body: t("decidim.design.components.announcement.this_is_the_body") },
|
70
|
+
{ callout_class: "success" }],
|
71
|
+
call_string: [
|
72
|
+
%{cell("decidim/announcement", { title: "This is the title", body: "This is the body" }, callout_class: "success")},
|
73
|
+
'cell("decidim/announcement", { title: "This is the title", body: "This is the body" }, callout_class: "warning")',
|
74
|
+
'cell("decidim/announcement", { title: "This is the title", body: "This is the body" }, callout_class: "alert")',
|
75
|
+
'cell("decidim/announcement", { title: "This is the title", body: "This is the body" }, callout_class: "secondary")',
|
76
|
+
'cell("decidim/announcement", { title: "This is the title", body: "This is the body" })',
|
77
|
+
'cell("decidim/announcement", "I am just plain text")'
|
78
|
+
]
|
55
79
|
}
|
56
80
|
}
|
57
81
|
]
|
@@ -63,7 +87,7 @@ module Decidim
|
|
63
87
|
table_rows.each_with_index.map do |table_cell, _ix|
|
64
88
|
row = []
|
65
89
|
row << { method: :cell, args: ["decidim/announcement", table_cell[:text], { callout_class: table_cell[:callout_class] }] }
|
66
|
-
row << table_cell[:callout_class]
|
90
|
+
row << table_cell[:callout_class]
|
67
91
|
row << table_cell[:argument] if table_cell[:argument].present?
|
68
92
|
row
|
69
93
|
end
|
@@ -33,6 +33,8 @@ module Decidim
|
|
33
33
|
html += content_tag(:p, value.html_safe, class: content[:class])
|
34
34
|
end
|
35
35
|
html.html_safe
|
36
|
+
when :cell_table
|
37
|
+
render partial: "decidim/design/shared/cell_table", locals: content.slice(:cell_snippet).merge(content[:options] || {})
|
36
38
|
when :table
|
37
39
|
render partial: "decidim/design/shared/table", locals: content.slice(:items).merge(content[:options] || {})
|
38
40
|
when :partial
|
@@ -63,17 +65,34 @@ module Decidim
|
|
63
65
|
def render_cell_snippet(content)
|
64
66
|
return "" if content[:cell_snippet].blank?
|
65
67
|
|
66
|
-
render partial: "decidim/design/shared/cell_snippet", locals: cell_snippet_locals(content[:cell_snippet]
|
68
|
+
render partial: "decidim/design/shared/cell_snippet", locals: cell_snippet_locals(content[:cell_snippet])
|
67
69
|
end
|
68
70
|
|
69
|
-
def
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
def render_cell_call_textarea(cell_data)
|
72
|
+
render partial: "decidim/design/shared/cell_call_textarea", locals: cell_snippet_locals(cell_data)
|
73
|
+
end
|
74
|
+
|
75
|
+
def cell_snippet_locals(args)
|
76
|
+
path = args.delete(:path) || File.join("decidim-core/app/cells/", args[:cell])
|
77
|
+
url = "https://github.com/decidim/decidim/blob/#{RELEASE_ID}/#{path}_cell.rb"
|
78
|
+
call_string = args.delete(:call_string) || ""
|
79
|
+
args_texts = call_string.present? ? [] : inspect_args(args[:args])
|
80
|
+
|
81
|
+
args.merge(text: path, url:, call_string:, args_texts:)
|
82
|
+
end
|
83
|
+
|
84
|
+
def inspect_args(args = [])
|
85
|
+
return ["nil"] if args.blank?
|
86
|
+
|
87
|
+
args.map do |arg|
|
88
|
+
next arg.inspect if arg.is_a?(String)
|
89
|
+
next arg.except(:context).inspect if arg.is_a?(Hash)
|
90
|
+
|
91
|
+
class_name = arg.class.name
|
92
|
+
next "#{class_name}.take" if arg.is_a?(Decidim::ApplicationRecord)
|
93
|
+
|
94
|
+
class_name
|
95
|
+
end
|
77
96
|
end
|
78
97
|
|
79
98
|
def render_row(row)
|
@@ -6,86 +6,108 @@ module Decidim
|
|
6
6
|
def author_sections
|
7
7
|
[
|
8
8
|
{
|
9
|
-
|
9
|
+
title: t("decidim.design.helpers.context"),
|
10
10
|
contents: [
|
11
11
|
{
|
12
12
|
type: :text,
|
13
13
|
values: [
|
14
|
-
"
|
15
|
-
|
16
|
-
"For resources, this cell appears beneath the main heading. For other contents, it appears next to the content itself."
|
14
|
+
t("decidim.design.helpers.context_description"),
|
15
|
+
t("decidim.design.helpers.context_description_2")
|
17
16
|
]
|
18
17
|
}
|
19
18
|
]
|
20
19
|
},
|
21
20
|
{
|
22
|
-
|
21
|
+
title: t("decidim.design.helpers.variations"),
|
23
22
|
contents: [
|
24
23
|
{
|
25
24
|
type: :text,
|
26
|
-
values: ["
|
25
|
+
values: [t("decidim.design.helpers.variations_description")]
|
27
26
|
},
|
28
27
|
{
|
29
|
-
values: section_subtitle(title: "
|
28
|
+
values: section_subtitle(title: t("decidim.design.helpers.default"))
|
30
29
|
},
|
31
30
|
{
|
32
|
-
|
33
|
-
template: "decidim/design/components/author/static-default"
|
31
|
+
values: cell("decidim/author", user_item)
|
34
32
|
},
|
35
33
|
{
|
36
34
|
type: :text,
|
37
|
-
values: ["
|
35
|
+
values: [t("decidim.design.helpers.default_description")]
|
38
36
|
},
|
39
37
|
{
|
40
|
-
values: section_subtitle(title: "
|
38
|
+
values: section_subtitle(title: t("decidim.design.helpers.compact"))
|
41
39
|
},
|
42
40
|
{
|
43
|
-
|
44
|
-
template: "decidim/design/components/author/static-compact"
|
41
|
+
values: cell("decidim/author", user_item, from: authored_item, context_actions: [:date], layout: :compact)
|
45
42
|
},
|
46
43
|
{
|
47
44
|
type: :text,
|
48
|
-
values: ["
|
45
|
+
values: [t("decidim.design.helpers.compact_description")]
|
49
46
|
},
|
50
47
|
{
|
51
|
-
values: section_subtitle(title: "
|
48
|
+
values: section_subtitle(title: t("decidim.design.helpers.avatar"))
|
52
49
|
},
|
53
50
|
{
|
54
|
-
|
55
|
-
template: "decidim/design/components/author/static-avatar"
|
51
|
+
values: cell("decidim/author", user_item, layout: :avatar)
|
56
52
|
},
|
57
53
|
{
|
58
54
|
type: :text,
|
59
|
-
values: ["
|
55
|
+
values: [t("decidim.design.helpers.avatar_description")]
|
60
56
|
}
|
61
57
|
]
|
62
58
|
},
|
63
59
|
{
|
64
|
-
|
60
|
+
title: t("decidim.design.helpers.source_code"),
|
65
61
|
contents: [
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
62
|
+
{
|
63
|
+
type: :text,
|
64
|
+
values: [""],
|
65
|
+
cell_snippet: {
|
66
|
+
cell: "decidim/author",
|
67
|
+
args: [user_item],
|
68
|
+
call_string: [
|
69
|
+
'cell("decidim/author", _USER_PRESENTER_)',
|
70
|
+
'cell("decidim/author", _USER_PRESENTER_, from: _AUTHORABLE_OR_COAUTHORABLE_RESOURCE_, context_actions: [:date], layout: :compact)',
|
71
|
+
'cell("decidim/author", _USER_PRESENTER_, layout: :avatar)'
|
72
|
+
]
|
73
|
+
}
|
74
|
+
}
|
75
75
|
]
|
76
76
|
}
|
77
77
|
]
|
78
78
|
end
|
79
79
|
|
80
|
-
def
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
80
|
+
def user_item
|
81
|
+
Decidim::User.new(
|
82
|
+
organization: current_organization,
|
83
|
+
id: 2000,
|
84
|
+
email: "alan_smith@example.org",
|
85
|
+
confirmed_at: Time.current,
|
86
|
+
name: "Alan Smith",
|
87
|
+
nickname: "alan_smith",
|
88
|
+
personal_url: "https://alan.example.org",
|
89
|
+
about: "Hi, I am Alan",
|
90
|
+
accepted_tos_version: Time.current
|
91
|
+
).presenter
|
92
|
+
end
|
93
|
+
|
94
|
+
class AuthoredItem
|
95
|
+
ATTRS = [:published_at].freeze
|
96
|
+
|
97
|
+
attr_reader(*ATTRS)
|
98
|
+
|
99
|
+
def initialize(args = {})
|
100
|
+
args.slice(*ATTRS).each do |var, val|
|
101
|
+
instance_variable_set(:"@#{var}", val)
|
102
|
+
end
|
87
103
|
end
|
88
104
|
end
|
105
|
+
|
106
|
+
def authored_item
|
107
|
+
AuthoredItem.new(
|
108
|
+
published_at: 1.day.ago
|
109
|
+
)
|
110
|
+
end
|
89
111
|
end
|
90
112
|
end
|
91
113
|
end
|