decidim-design 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +29 -0
- data/Rakefile +3 -0
- data/app/controllers/concerns/decidim/design/has_templates.rb +20 -0
- data/app/controllers/decidim/design/application_controller.rb +28 -0
- data/app/controllers/decidim/design/components_controller.rb +21 -0
- data/app/controllers/decidim/design/foundations_controller.rb +14 -0
- data/app/controllers/decidim/design/home_controller.rb +11 -0
- data/app/helpers/decidim/design/activities_helper.rb +65 -0
- data/app/helpers/decidim/design/address_helper.rb +59 -0
- data/app/helpers/decidim/design/announcement_helper.rb +73 -0
- data/app/helpers/decidim/design/application_helper.rb +100 -0
- data/app/helpers/decidim/design/author_helper.rb +91 -0
- data/app/helpers/decidim/design/buttons_helper.rb +148 -0
- data/app/helpers/decidim/design/cards_helper.rb +195 -0
- data/app/helpers/decidim/design/colors_helper.rb +96 -0
- data/app/helpers/decidim/design/follow_helper.rb +42 -0
- data/app/helpers/decidim/design/iconography_helper.rb +72 -0
- data/app/helpers/decidim/design/report_helper.rb +38 -0
- data/app/helpers/decidim/design/share_helper.rb +38 -0
- data/app/helpers/decidim/design/tab_panels_helper.rb +103 -0
- data/app/helpers/decidim/design/typography_helper.rb +112 -0
- data/app/packs/entrypoints/decidim_design.js +2 -0
- data/app/packs/stylesheets/design.scss +121 -0
- data/app/views/decidim/design/components/accordions.html.erb +66 -0
- data/app/views/decidim/design/components/activities/_static-activities.html.erb +79 -0
- data/app/views/decidim/design/components/activities/_static-activity.html.erb +56 -0
- data/app/views/decidim/design/components/activities.html.erb +11 -0
- data/app/views/decidim/design/components/address/_static-address-online.html.erb +9 -0
- data/app/views/decidim/design/components/address/_static-address-person.html.erb +8 -0
- data/app/views/decidim/design/components/address.html.erb +11 -0
- data/app/views/decidim/design/components/announcement.html.erb +11 -0
- data/app/views/decidim/design/components/author/_static-avatar.html.erb +38 -0
- data/app/views/decidim/design/components/author/_static-compact.html.erb +46 -0
- data/app/views/decidim/design/components/author/_static-default.html.erb +35 -0
- data/app/views/decidim/design/components/author.html.erb +11 -0
- data/app/views/decidim/design/components/buttons.html.erb +15 -0
- data/app/views/decidim/design/components/cards/_static-card-g-highlight.html.erb +18 -0
- data/app/views/decidim/design/components/cards/_static-card-g-metadata-2.html.erb +17 -0
- data/app/views/decidim/design/components/cards/_static-card-g-metadata.html.erb +14 -0
- data/app/views/decidim/design/components/cards/_static-card-g.html.erb +17 -0
- data/app/views/decidim/design/components/cards/_static-card-l-description.html.erb +28 -0
- data/app/views/decidim/design/components/cards/_static-card-l-extra-data-2.html.erb +31 -0
- data/app/views/decidim/design/components/cards/_static-card-l-extra-data.html.erb +16 -0
- data/app/views/decidim/design/components/cards/_static-card-l-image.html.erb +66 -0
- data/app/views/decidim/design/components/cards/_static-card-l-meetings.html.erb +30 -0
- data/app/views/decidim/design/components/cards/_static-card-l.html.erb +60 -0
- data/app/views/decidim/design/components/cards/_static-card-s.html.erb +15 -0
- data/app/views/decidim/design/components/cards.html.erb +11 -0
- data/app/views/decidim/design/components/dialogs.html.erb +89 -0
- data/app/views/decidim/design/components/dropdowns.html.erb +64 -0
- data/app/views/decidim/design/components/follow/_static-follow-default.html.erb +4 -0
- data/app/views/decidim/design/components/follow/_static-follow-unfollow.html.erb +4 -0
- data/app/views/decidim/design/components/follow.html.erb +11 -0
- data/app/views/decidim/design/components/forms.html.erb +235 -0
- data/app/views/decidim/design/components/report/_static-report.html.erb +34 -0
- data/app/views/decidim/design/components/report.html.erb +11 -0
- data/app/views/decidim/design/components/share.html.erb +11 -0
- data/app/views/decidim/design/components/tab_panels.html.erb +11 -0
- data/app/views/decidim/design/foundations/accessibility.html.erb +99 -0
- data/app/views/decidim/design/foundations/color/_table.html.erb +26 -0
- data/app/views/decidim/design/foundations/color.html.erb +16 -0
- data/app/views/decidim/design/foundations/iconography/_icons.html.erb +8 -0
- data/app/views/decidim/design/foundations/iconography.html.erb +16 -0
- data/app/views/decidim/design/foundations/layout.html.erb +128 -0
- data/app/views/decidim/design/foundations/typography.html.erb +15 -0
- data/app/views/decidim/design/home/index.html.erb +17 -0
- data/app/views/decidim/design/shared/_card_grid.html.erb +3 -0
- data/app/views/decidim/design/shared/_cell_snippet.html.erb +6 -0
- data/app/views/decidim/design/shared/_sections.html.erb +9 -0
- data/app/views/decidim/design/shared/_table.html.erb +12 -0
- data/app/views/layouts/decidim/design/_head.html.erb +5 -0
- data/app/views/layouts/decidim/design/_layout.html.erb +86 -0
- data/app/views/layouts/decidim/design/application.html.erb +15 -0
- data/config/assets.rb +8 -0
- data/config/routes.rb +10 -0
- data/lib/decidim/design/engine.rb +35 -0
- data/lib/decidim/design/version.rb +9 -0
- data/lib/decidim/design.rb +10 -0
- metadata +154 -0
@@ -0,0 +1,195 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Design
|
5
|
+
module CardsHelper
|
6
|
+
# rubocop:disable Layout/LineLength
|
7
|
+
def cards_sections
|
8
|
+
[
|
9
|
+
{
|
10
|
+
id: "types",
|
11
|
+
contents: [
|
12
|
+
{
|
13
|
+
values: section_subtitle(title: "Card L", label: "list")
|
14
|
+
},
|
15
|
+
{
|
16
|
+
type: :partial,
|
17
|
+
template: "decidim/design/components/cards/static-card-l"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
type: :partial,
|
21
|
+
template: "decidim/design/components/cards/static-card-l"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
values: section_subtitle(title: "Card G", label: "grid")
|
25
|
+
},
|
26
|
+
{
|
27
|
+
type: :partial,
|
28
|
+
layout: "decidim/design/shared/card_grid",
|
29
|
+
template: ["decidim/design/components/cards/static-card-g", "decidim/design/components/cards/static-card-g"]
|
30
|
+
},
|
31
|
+
{
|
32
|
+
values: section_subtitle(title: "Card S", label: "search")
|
33
|
+
},
|
34
|
+
{
|
35
|
+
type: :partial,
|
36
|
+
template: "decidim/design/components/cards/static-card-s"
|
37
|
+
},
|
38
|
+
{
|
39
|
+
type: :partial,
|
40
|
+
template: "decidim/design/components/cards/static-card-s"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
},
|
44
|
+
{
|
45
|
+
id: "variations",
|
46
|
+
contents: [
|
47
|
+
{
|
48
|
+
type: :text,
|
49
|
+
values: ["Each card will look like different regarding the properties of the resource displayed. You can override such behaviour in the specific cell."]
|
50
|
+
},
|
51
|
+
{
|
52
|
+
values: section_subtitle(title: "Metadata items")
|
53
|
+
},
|
54
|
+
{
|
55
|
+
type: :partial,
|
56
|
+
layout: "decidim/design/shared/card_grid",
|
57
|
+
template: ["decidim/design/components/cards/static-card-g-metadata", "decidim/design/components/cards/static-card-g-metadata-2"]
|
58
|
+
},
|
59
|
+
{
|
60
|
+
type: :text,
|
61
|
+
values: ["Each resource define its own metadata items"]
|
62
|
+
},
|
63
|
+
{
|
64
|
+
values: section_subtitle(title: "Highlight")
|
65
|
+
},
|
66
|
+
{
|
67
|
+
type: :partial,
|
68
|
+
template: "decidim/design/components/cards/static-card-g-highlight"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
type: :text,
|
72
|
+
values: ["Used by resources who allow to highlight"]
|
73
|
+
},
|
74
|
+
{
|
75
|
+
values: section_subtitle(title: "Image and description")
|
76
|
+
},
|
77
|
+
{
|
78
|
+
type: :partial,
|
79
|
+
template: "decidim/design/components/cards/static-card-l-image"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
type: :text,
|
83
|
+
values: ["Used by <i>Blogs</i> cards"]
|
84
|
+
},
|
85
|
+
{
|
86
|
+
values: section_subtitle(title: "Description")
|
87
|
+
},
|
88
|
+
{
|
89
|
+
type: :partial,
|
90
|
+
template: "decidim/design/components/cards/static-card-l-description"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
type: :text,
|
94
|
+
values: ["Used by <i>Debates</i> cards"]
|
95
|
+
},
|
96
|
+
{
|
97
|
+
values: section_subtitle(title: "Use different template for the image block")
|
98
|
+
},
|
99
|
+
{
|
100
|
+
type: :partial,
|
101
|
+
template: "decidim/design/components/cards/static-card-l-meetings"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
type: :text,
|
105
|
+
values: ["Used by <i>Meetings</i> cards"]
|
106
|
+
},
|
107
|
+
{
|
108
|
+
values: section_subtitle(title: "Use the extra_data block")
|
109
|
+
},
|
110
|
+
{
|
111
|
+
type: :partial,
|
112
|
+
template: "decidim/design/components/cards/static-card-l-extra-data"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
type: :text,
|
116
|
+
values: ["Used by <i>Accountability projects</i> cards. This card requires the module assets to display properly, i.e. <code>append_stylesheet_pack_tag \"decidim_accountability\"</code>"]
|
117
|
+
},
|
118
|
+
{
|
119
|
+
type: :partial,
|
120
|
+
template: "decidim/design/components/cards/static-card-l-extra-data-2"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
type: :text,
|
124
|
+
values: ["Used by <i>Budget projects</i> cards. This card requires the module assets to display properly, i.e. <code>append_stylesheet_pack_tag \"decidim_budgets\"</code>"]
|
125
|
+
}
|
126
|
+
]
|
127
|
+
},
|
128
|
+
{
|
129
|
+
id: "sourcecode",
|
130
|
+
contents: [
|
131
|
+
{
|
132
|
+
type: :table,
|
133
|
+
options: { headings: %w(Card Code Usage) },
|
134
|
+
items: cards_table(
|
135
|
+
{ name: "Card L (core)", url: "https://github.com/decidim/decidim/tree/develop/decidim-core/app/cells/decidim/card_l_cell.rb", usage: "--" },
|
136
|
+
{ name: "Card G (core)", url: "https://github.com/decidim/decidim/tree/develop/decidim-core/app/cells/decidim/card_g_cell.rb", usage: "--" },
|
137
|
+
{ name: "Card S (core)", url: "https://github.com/decidim/decidim/tree/develop/decidim-core/app/cells/decidim/card_s_cell.rb", usage: "--" },
|
138
|
+
{ name: "Result L", url: "https://github.com/decidim/decidim/blob/develop/decidim-accountability/app/cells/decidim/accountability/result_l_cell.rb",
|
139
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-accountability/app/cells/decidim/accountability/results/show.erb#L3" },
|
140
|
+
{ name: "Post L", url: "https://github.com/decidim/decidim/blob/develop/decidim-blogs/app/cells/decidim/blogs/post_l_cell.rb",
|
141
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-blogs/app/views/decidim/blogs/posts/index.html.erb#L16" },
|
142
|
+
{ name: "Project L", url: "https://github.com/decidim/decidim/blob/develop/decidim-budgets/app/cells/decidim/budgets/project_l_cell.rb",
|
143
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb#L2" },
|
144
|
+
{ name: "Debate L", url: "https://github.com/decidim/decidim/blob/develop/decidim-debates/app/cells/decidim/debates/debate_l_cell.rb",
|
145
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-debates/app/views/decidim/debates/debates/_debates.html.erb#L6" },
|
146
|
+
{ name: "Meeting L", url: "https://github.com/decidim/decidim/blob/develop/decidim-meetings/app/cells/decidim/meetings/meeting_l_cell.rb",
|
147
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-meetings/app/views/decidim/meetings/shared/_meetings.html.erb#L20" },
|
148
|
+
{ name: "Collaborative Draft L",
|
149
|
+
url: "https://github.com/decidim/decidim/blob/develop/decidim-proposals/app/cells/decidim/proposals/collaborative_draft_l_cell.rb", usage: "https://github.com/decidim/decidim/blob/develop/decidim-proposals/app/views/decidim/proposals/collaborative_drafts/_collaborative_drafts.html.erb#L10" },
|
150
|
+
{ name: "Proposal L", url: "https://github.com/decidim/decidim/blob/develop/decidim-proposals/app/cells/decidim/proposals/proposal_l_cell.rb",
|
151
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb#L15" },
|
152
|
+
{ name: "Sortition L", url: "https://github.com/decidim/decidim/blob/develop/decidim-sortitions/app/cells/decidim/sortitions/sortition_l_cell.rb",
|
153
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-sortitions/app/views/decidim/sortitions/sortitions/_sortitions.html.erb#L6" },
|
154
|
+
{ name: "Assembly G", url: "https://github.com/decidim/decidim/blob/develop/decidim-assemblies/app/cells/decidim/assemblies/assembly_g_cell.rb",
|
155
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-assemblies/app/views/decidim/assemblies/assemblies/_collection.html.erb#L4" },
|
156
|
+
{ name: "Post G", url: "https://github.com/decidim/decidim/blob/develop/decidim-blogs/app/cells/decidim/blogs/post_g_cell.rb",
|
157
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-blogs/app/cells/decidim/blogs/content_blocks/highlighted_posts/content.erb#L15" },
|
158
|
+
{ name: "Conference G", url: "https://github.com/decidim/decidim/blob/develop/decidim-conferences/app/cells/decidim/conferences/conference_g_cell.rb",
|
159
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-conferences/app/views/decidim/conferences/conferences/index.html.erb#L30" },
|
160
|
+
{ name: "Election G", url: "https://github.com/decidim/decidim/blob/develop/decidim-elections/app/cells/decidim/elections/election_g_cell.rb",
|
161
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-elections/app/views/decidim/elections/elections/_elections.html.erb#L13" },
|
162
|
+
{ name: "Voting G", url: "https://github.com/decidim/decidim/blob/develop/decidim-elections/app/cells/decidim/votings/voting_g_cell.rb",
|
163
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-elections/app/views/decidim/votings/votings/_votings.html.erb#L14" },
|
164
|
+
{ name: "Initiative G", url: "https://github.com/decidim/decidim/blob/develop/decidim-initiatives/app/cells/decidim/initiatives/initiative_g_cell.rb",
|
165
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-initiatives/app/views/decidim/initiatives/initiatives/_initiatives.html.erb#L12" },
|
166
|
+
{ name: "Process G",
|
167
|
+
url: "https://github.com/decidim/decidim/blob/develop/decidim-participatory_processes/app/cells/decidim/participatory_processes/process_g_cell.rb", usage: "https://github.com/decidim/decidim/blob/develop/decidim-participatory_processes/app/views/decidim/participatory_processes/participatory_processes/_collection.html.erb#L5" },
|
168
|
+
{ name: "Process Group G",
|
169
|
+
url: "https://github.com/decidim/decidim/blob/develop/decidim-participatory_processes/app/cells/decidim/participatory_processes/process_group_g_cell.rb", usage: "https://github.com/decidim/decidim/blob/develop/decidim-participatory_processes/app/views/decidim/participatory_process_groups/_participatory_process_group.html.erb#L1" },
|
170
|
+
{ name: "Proposal G", url: "https://github.com/decidim/decidim/blob/develop/decidim-proposals/app/cells/decidim/proposals/proposal_g_cell.rb",
|
171
|
+
usage: "https://github.com/decidim/decidim/blob/develop/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb#L15" }
|
172
|
+
)
|
173
|
+
}
|
174
|
+
]
|
175
|
+
}
|
176
|
+
]
|
177
|
+
end
|
178
|
+
# rubocop:enable Layout/LineLength
|
179
|
+
|
180
|
+
def cards_table(*table_rows, **_opts)
|
181
|
+
table_rows.map do |table_cell|
|
182
|
+
[
|
183
|
+
table_cell[:name],
|
184
|
+
link_to(table_cell[:url].split("/").last, table_cell[:url], target: "_blank", class: "text-secondary underline", rel: "noopener"),
|
185
|
+
if table_cell[:usage].to_s.start_with?("http")
|
186
|
+
link_to(table_cell[:usage].split("/").last, table_cell[:usage], target: "_blank", class: "text-secondary underline", rel: "noopener")
|
187
|
+
else
|
188
|
+
table_cell[:usage]
|
189
|
+
end
|
190
|
+
]
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Design
|
5
|
+
module ColorsHelper
|
6
|
+
def colors_sections
|
7
|
+
[
|
8
|
+
{
|
9
|
+
id: "base",
|
10
|
+
contents: [
|
11
|
+
{
|
12
|
+
type: :table,
|
13
|
+
options: { headings: ["Value", "Tailwind name", "Usage"] },
|
14
|
+
items: colors_table(
|
15
|
+
{ value: "var(--primary)", name: "primary", usage: "Main nav component background\nNav menus in homepage and space home" },
|
16
|
+
{ value: "var(--secondary)", name: "secondary", usage: "Main color for links and buttons" },
|
17
|
+
{ value: "var(--tertiary)", name: "tertiary", usage: "Graphic ornaments and accent color\nCards and list items hover state border" }
|
18
|
+
)
|
19
|
+
}
|
20
|
+
]
|
21
|
+
},
|
22
|
+
{
|
23
|
+
id: "state",
|
24
|
+
contents: [
|
25
|
+
{
|
26
|
+
type: :table,
|
27
|
+
options: { headings: ["Value", "Tailwind name", "Hex code", "RGBA code", "Usage"] },
|
28
|
+
items: colors_table(
|
29
|
+
{ value: "#28A745", name: "success", rgba: "rgba(40,167,69,1)", usage: "Success notice border\nAlert notice icon fill\nButton background on success message" },
|
30
|
+
{ value: "#FFB703", name: "warning", rgba: "rgba(255,183,3,1)", usage: "Warning notice border" },
|
31
|
+
{ value: "#ED1C24", name: "alert", rgba: "rgba(237,28,36,1)", usage: "Alert notice border\nAlert notice icon fill" }
|
32
|
+
)
|
33
|
+
}
|
34
|
+
]
|
35
|
+
},
|
36
|
+
{
|
37
|
+
id: "main_colors",
|
38
|
+
contents: [
|
39
|
+
{
|
40
|
+
values: section_subtitle(title: "Typography and texts")
|
41
|
+
},
|
42
|
+
{
|
43
|
+
type: :table,
|
44
|
+
options: { headings: ["Value", "Tailwind name", "Hex code", "RGBA code", "Usage"] },
|
45
|
+
items: colors_table(
|
46
|
+
{ value: "#020203", name: "black", rgba: "rgba(2,2,3,1)", usage: "Headings and section titles" },
|
47
|
+
{ value: "#3E4C5C", name: "gray-2", rgba: "rgba(62,76,92,1)", usage: "Inline text" },
|
48
|
+
{ value: "#FFFFFF", name: "white", rgba: "rgba(255,255,255,1)", usage: "Text over dark background" },
|
49
|
+
{ value: "#155ABF", name: "secondary", rgba: "rgba(21,90,191,1)", usage: "Links and buttons" }
|
50
|
+
)
|
51
|
+
},
|
52
|
+
{
|
53
|
+
values: section_subtitle(title: "Background and borders")
|
54
|
+
},
|
55
|
+
{
|
56
|
+
type: :table,
|
57
|
+
options: { headings: ["Value", "Tailwind name", "Hex code", "RGBA code", "Usage"] },
|
58
|
+
items: colors_table(
|
59
|
+
{ value: "#F3F4F7", name: "background", rgba: "rgba(243,244,247,1)", usage: "Aside background" },
|
60
|
+
{ value: "#E4EEFF99", name: "background-4", rgba: "rgba(228,238,255,0.8)", usage: "Selected sidebar filter background" },
|
61
|
+
{ value: "#6B7280CC", name: "gray", rgba: "rgba(107,114,128,0.3)", usage: "Default icon color" },
|
62
|
+
{ value: "#E1E5EF", name: "gray-3", rgba: "rgba(225,229,239,1)", usage: "Lines and separators" },
|
63
|
+
{ value: "#242424", name: "gray-4", rgba: "rgba(36,36,36,1)", usage: "Footer background" },
|
64
|
+
{ value: "#F6F8FA", name: "gray-5", rgba: "rgb(246,248,250,1)", usage: "Admin layout background" }
|
65
|
+
)
|
66
|
+
},
|
67
|
+
{
|
68
|
+
values: section_subtitle(title: "Form elements")
|
69
|
+
},
|
70
|
+
{
|
71
|
+
type: :table,
|
72
|
+
options: { headings: ["Value", "Tailwind name", "Hex code", "RGBA code", "Usage"] },
|
73
|
+
items: colors_table(
|
74
|
+
{ value: "#FAFBFC", name: "background-2", rgba: "rgba(250,251,252,1)", usage: "Input elements default background" },
|
75
|
+
{ value: "#EFEFEF", name: "background-3", rgba: "rgba(239,239,239,1))", usage: "Input elements disabled state background" }
|
76
|
+
)
|
77
|
+
}
|
78
|
+
]
|
79
|
+
}
|
80
|
+
]
|
81
|
+
end
|
82
|
+
|
83
|
+
def colors_table(*table_rows, **_opts)
|
84
|
+
table_rows.map do |table_cell|
|
85
|
+
row = []
|
86
|
+
row << content_tag(:div, nil, class: "w-8 h-8 rounded shadow", style: "background-color: #{table_cell[:value]};")
|
87
|
+
row << table_cell[:name]
|
88
|
+
row << table_cell[:value] if table_cell[:rgba].present?
|
89
|
+
row << table_cell[:rgba] if table_cell[:rgba].present?
|
90
|
+
row << table_cell[:usage]
|
91
|
+
row
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Design
|
5
|
+
module FollowHelper
|
6
|
+
def follow_sections
|
7
|
+
[
|
8
|
+
{
|
9
|
+
id: "usage",
|
10
|
+
contents: [
|
11
|
+
{
|
12
|
+
type: :text,
|
13
|
+
values: ["Make sure the partial <code>decidim/shared/login_modal</code> is present in the DOM.
|
14
|
+
This partial is placed in the application layout when the user is logged in."]
|
15
|
+
},
|
16
|
+
{
|
17
|
+
type: :table,
|
18
|
+
options: { headings: ["Follow Button"] },
|
19
|
+
items: follow_table(
|
20
|
+
{ partial: "decidim/design/components/follow/static-follow-default" },
|
21
|
+
{ partial: "decidim/design/components/follow/static-follow-unfollow" }
|
22
|
+
),
|
23
|
+
cell_snippet: {
|
24
|
+
cell: "decidim/follow_button",
|
25
|
+
args: [Decidim::User.first]
|
26
|
+
}
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def follow_table(*table_rows, **_opts)
|
34
|
+
table_rows.map do |table_cell|
|
35
|
+
row = []
|
36
|
+
row << render(partial: table_cell[:partial])
|
37
|
+
row
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Design
|
5
|
+
module IconographyHelper
|
6
|
+
include Decidim::IconHelper
|
7
|
+
include Decidim::SocialShareButtonHelper
|
8
|
+
|
9
|
+
def iconography_sections
|
10
|
+
(remix_icons + social_share_icons).sort_by { |section| section[:id] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def iconography_table(table_rows)
|
14
|
+
options = { class: "mx-auto w-4 h-4 text-gray fill-current flex-none" }
|
15
|
+
table_rows.map do |table_cell|
|
16
|
+
row = []
|
17
|
+
|
18
|
+
row << icon(table_cell[:name], **options)
|
19
|
+
row << content_tag(:code, table_cell[:icon])
|
20
|
+
row << table_cell[:category]
|
21
|
+
row << table_cell[:description]
|
22
|
+
|
23
|
+
row
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def remix_icons
|
28
|
+
Decidim.icons.categories.map do |category, values|
|
29
|
+
{
|
30
|
+
id: category,
|
31
|
+
contents: [
|
32
|
+
{
|
33
|
+
type: :table,
|
34
|
+
options: { headings: %w(Icon Code Category Description) },
|
35
|
+
items: iconography_table(values.sort_by { |v| v[:icon] })
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def social_share_icons
|
43
|
+
[
|
44
|
+
{
|
45
|
+
id: "social-share",
|
46
|
+
contents: [
|
47
|
+
{
|
48
|
+
type: :table,
|
49
|
+
options: { headings: %w(Icon Code Category Description) },
|
50
|
+
items: social_share_iconography_table
|
51
|
+
}
|
52
|
+
]
|
53
|
+
}
|
54
|
+
]
|
55
|
+
end
|
56
|
+
|
57
|
+
def social_share_iconography_table
|
58
|
+
options = { class: "mx-auto w-4 h-4 text-gray fill-current flex-none" }
|
59
|
+
Decidim.social_share_services_registry.manifests.map do |service|
|
60
|
+
row = []
|
61
|
+
|
62
|
+
row << render_social_share_icon(service, **options)
|
63
|
+
row << content_tag(:code, service.name)
|
64
|
+
row << "social-share"
|
65
|
+
row << t("decidim.shared.share_modal.share_to", service: service.name)
|
66
|
+
|
67
|
+
row
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Design
|
5
|
+
module ReportHelper
|
6
|
+
def report_sections
|
7
|
+
[
|
8
|
+
{
|
9
|
+
id: "usage",
|
10
|
+
contents: [
|
11
|
+
{
|
12
|
+
type: :text,
|
13
|
+
values: ["Report button launches a modal window to flag the current resource."]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
type: :table,
|
17
|
+
options: { headings: ["Report Button"] },
|
18
|
+
items: report_table({}),
|
19
|
+
cell_snippet: {
|
20
|
+
cell: "decidim/report_button",
|
21
|
+
args: [Decidim::User.first]
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
def report_table(*table_rows, **_opts)
|
30
|
+
table_rows.each_with_index.map do
|
31
|
+
row = []
|
32
|
+
row << render(partial: "decidim/design/components/report/static-report")
|
33
|
+
row
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Design
|
5
|
+
module ShareHelper
|
6
|
+
def share_sections
|
7
|
+
[
|
8
|
+
{
|
9
|
+
id: "usage",
|
10
|
+
contents: [
|
11
|
+
{
|
12
|
+
type: :text,
|
13
|
+
values: ["Make sure the partial <code>decidim/shared/share_modal</code> is present in the DOM. This partial is placed in the application layout."]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
type: :table,
|
17
|
+
options: { headings: ["Share Button"] },
|
18
|
+
items: share_table({}),
|
19
|
+
cell_snippet: {
|
20
|
+
cell: "decidim/share_button",
|
21
|
+
args: []
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
def share_table(*table_rows, **_opts)
|
30
|
+
table_rows.each_with_index.map do
|
31
|
+
row = []
|
32
|
+
row << { method: :cell, args: ["decidim/share_button", nil] }
|
33
|
+
row
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Design
|
5
|
+
module TabPanelsHelper
|
6
|
+
def tab_panels_sections
|
7
|
+
[
|
8
|
+
{
|
9
|
+
id: "context",
|
10
|
+
contents: [
|
11
|
+
{
|
12
|
+
type: :text,
|
13
|
+
values: [
|
14
|
+
"This tab-panel component gathers all the related contents or another resources of the main element displayed,
|
15
|
+
in order to save vertical space. Clicking on the tab will activate the reated panel to show the content.",
|
16
|
+
"Mainly is used within the <i>layout_item</i> or the <i>layout_center</i>, after the main content of the resource."
|
17
|
+
]
|
18
|
+
}
|
19
|
+
]
|
20
|
+
},
|
21
|
+
{
|
22
|
+
id: "usage",
|
23
|
+
contents: [
|
24
|
+
{
|
25
|
+
type: :text,
|
26
|
+
values: [
|
27
|
+
"This component receives an array of hashes, and rearrange the output of each item into a tab-panel structure. Available properties for each panel:",
|
28
|
+
"<strong>enabled</strong>: <i>Boolean</i>. Conditionally render the tab",
|
29
|
+
"<strong>id</strong>: <i>String</i>. Unique id",
|
30
|
+
"<strong>text</strong>: <i>String</i>. Tab title",
|
31
|
+
"<strong>icon</strong>: <i>String</i>. Remixicon key",
|
32
|
+
"<strong>method</strong>: <i>Symbol</i>. Any function rails understands",
|
33
|
+
"<strong>args</strong>: <i>Array</i>. Arguments for the previous method"
|
34
|
+
]
|
35
|
+
},
|
36
|
+
{
|
37
|
+
type: :table,
|
38
|
+
options: { headings: %w(Display Values), style: "--cell-width: 50%;" },
|
39
|
+
items: tab_panels_table(
|
40
|
+
{ values: tab_panels_items },
|
41
|
+
{ values: tab_panels_items_alt }
|
42
|
+
),
|
43
|
+
cell_snippet: {
|
44
|
+
cell: "decidim/tab_panels",
|
45
|
+
args: [tab_panels_items]
|
46
|
+
}
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
def tab_panels_table(*table_rows, **_opts)
|
54
|
+
table_rows.each_with_index.map do |table_cell, _ix|
|
55
|
+
row = []
|
56
|
+
row << { method: :cell, args: ["decidim/tab_panels", table_cell[:values]] }
|
57
|
+
row << content_tag(:pre, content_tag(:code, JSON.pretty_generate(table_cell[:values])), class: "text-left")
|
58
|
+
row
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def tab_panels_items
|
63
|
+
[
|
64
|
+
{
|
65
|
+
enabled: true,
|
66
|
+
id: "button",
|
67
|
+
text: "Button",
|
68
|
+
icon: resource_type_icon_key("images"),
|
69
|
+
method: :cell,
|
70
|
+
args: ["decidim/button", { text: "Send" }]
|
71
|
+
},
|
72
|
+
{
|
73
|
+
enabled: true,
|
74
|
+
id: "announce",
|
75
|
+
text: "Announcement",
|
76
|
+
icon: resource_type_icon_key("documents"),
|
77
|
+
method: :cell,
|
78
|
+
args: ["decidim/announcement", "I am an annoucement"]
|
79
|
+
}
|
80
|
+
]
|
81
|
+
end
|
82
|
+
|
83
|
+
def tab_panels_items_alt
|
84
|
+
[
|
85
|
+
{
|
86
|
+
enabled: true,
|
87
|
+
id: "icon",
|
88
|
+
text: "Icon",
|
89
|
+
method: :icon,
|
90
|
+
args: ["question-line", { class: "w-4 h-4" }]
|
91
|
+
},
|
92
|
+
{
|
93
|
+
enabled: true,
|
94
|
+
id: "text",
|
95
|
+
text: "Plain",
|
96
|
+
method: :content_tag,
|
97
|
+
args: ["p", "plain text", { class: "text-left" }]
|
98
|
+
}
|
99
|
+
]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|