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.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/decidim/design/activities_helper.rb +23 -23
  3. data/app/helpers/decidim/design/address_helper.rb +45 -20
  4. data/app/helpers/decidim/design/announcement_helper.rb +45 -21
  5. data/app/helpers/decidim/design/application_helper.rb +28 -9
  6. data/app/helpers/decidim/design/author_helper.rb +57 -35
  7. data/app/helpers/decidim/design/buttons_helper.rb +67 -11
  8. data/app/helpers/decidim/design/cards_helper.rb +504 -64
  9. data/app/helpers/decidim/design/colors_helper.rb +33 -29
  10. data/app/helpers/decidim/design/follow_helper.rb +6 -17
  11. data/app/helpers/decidim/design/report_helper.rb +6 -13
  12. data/app/helpers/decidim/design/share_helper.rb +6 -13
  13. data/app/helpers/decidim/design/tab_panels_helper.rb +57 -13
  14. data/app/helpers/decidim/design/typography_helper.rb +4 -3
  15. data/app/packs/entrypoints/decidim_design.js +1 -0
  16. data/app/packs/stylesheets/_datepicker.scss +9 -0
  17. data/app/packs/stylesheets/design.scss +6 -0
  18. data/app/views/decidim/design/components/accordions.html.erb +19 -17
  19. data/app/views/decidim/design/components/activities/_static-activities.html.erb +1 -1
  20. data/app/views/decidim/design/components/activities/_static-activity.html.erb +1 -1
  21. data/app/views/decidim/design/components/activities.html.erb +1 -1
  22. data/app/views/decidim/design/components/address.html.erb +1 -1
  23. data/app/views/decidim/design/components/announcement.html.erb +1 -1
  24. data/app/views/decidim/design/components/author.html.erb +1 -1
  25. data/app/views/decidim/design/components/buttons.html.erb +2 -2
  26. data/app/views/decidim/design/components/cards/_static-card-l-extra-data-2.html.erb +1 -1
  27. data/app/views/decidim/design/components/cards/_static-card-l-image.html.erb +1 -1
  28. data/app/views/decidim/design/components/cards/_static-card-l.html.erb +1 -1
  29. data/app/views/decidim/design/components/cards.html.erb +1 -1
  30. data/app/views/decidim/design/components/dialogs.html.erb +21 -21
  31. data/app/views/decidim/design/components/dropdowns.html.erb +14 -14
  32. data/app/views/decidim/design/components/follow.html.erb +1 -1
  33. data/app/views/decidim/design/components/forms.html.erb +35 -21
  34. data/app/views/decidim/design/components/report.html.erb +1 -1
  35. data/app/views/decidim/design/components/share.html.erb +1 -1
  36. data/app/views/decidim/design/components/tab_panels.html.erb +1 -1
  37. data/app/views/decidim/design/components/tooltips.html.erb +104 -0
  38. data/app/views/decidim/design/foundations/accessibility.html.erb +41 -41
  39. data/app/views/decidim/design/foundations/color.html.erb +6 -3
  40. data/app/views/decidim/design/foundations/iconography.html.erb +4 -3
  41. data/app/views/decidim/design/foundations/layout.html.erb +31 -30
  42. data/app/views/decidim/design/foundations/typography.html.erb +2 -2
  43. data/app/views/decidim/design/home/index.html.erb +6 -6
  44. data/app/views/decidim/design/shared/_cell_call_textarea.html.erb +5 -0
  45. data/app/views/decidim/design/shared/_cell_snippet.html.erb +1 -3
  46. data/app/views/decidim/design/shared/_cell_table.html.erb +12 -0
  47. data/app/views/decidim/design/shared/_table.html.erb +1 -1
  48. data/config/locales/am-ET.yml +1 -0
  49. data/config/locales/ar.yml +7 -0
  50. data/config/locales/bg.yml +309 -0
  51. data/config/locales/ca.yml +309 -0
  52. data/config/locales/cs.yml +258 -0
  53. data/config/locales/da.yml +1 -0
  54. data/config/locales/de.yml +309 -0
  55. data/config/locales/el.yml +1 -0
  56. data/config/locales/en.yml +309 -0
  57. data/config/locales/eo.yml +1 -0
  58. data/config/locales/es-MX.yml +309 -0
  59. data/config/locales/es-PY.yml +309 -0
  60. data/config/locales/es.yml +309 -0
  61. data/config/locales/et.yml +1 -0
  62. data/config/locales/eu.yml +309 -0
  63. data/config/locales/fa-IR.yml +1 -0
  64. data/config/locales/fi-plain.yml +309 -0
  65. data/config/locales/fi.yml +309 -0
  66. data/config/locales/fr-CA.yml +309 -0
  67. data/config/locales/fr.yml +309 -0
  68. data/config/locales/ga-IE.yml +1 -0
  69. data/config/locales/gl.yml +1 -0
  70. data/config/locales/gn-PY.yml +1 -0
  71. data/config/locales/he-IL.yml +1 -0
  72. data/config/locales/hr.yml +1 -0
  73. data/config/locales/hu.yml +1 -0
  74. data/config/locales/id-ID.yml +1 -0
  75. data/config/locales/is-IS.yml +1 -0
  76. data/config/locales/it.yml +1 -0
  77. data/config/locales/ja.yml +309 -0
  78. data/config/locales/ka-GE.yml +1 -0
  79. data/config/locales/kaa.yml +1 -0
  80. data/config/locales/ko.yml +1 -0
  81. data/config/locales/lb.yml +1 -0
  82. data/config/locales/lo-LA.yml +1 -0
  83. data/config/locales/lt.yml +1 -0
  84. data/config/locales/lv.yml +1 -0
  85. data/config/locales/mt.yml +1 -0
  86. data/config/locales/nl.yml +1 -0
  87. data/config/locales/no.yml +9 -0
  88. data/config/locales/oc-FR.yml +1 -0
  89. data/config/locales/om-ET.yml +1 -0
  90. data/config/locales/pl.yml +309 -0
  91. data/config/locales/pt-BR.yml +1 -0
  92. data/config/locales/pt.yml +1 -0
  93. data/config/locales/ro-RO.yml +45 -0
  94. data/config/locales/ru.yml +1 -0
  95. data/config/locales/si-LK.yml +1 -0
  96. data/config/locales/sk.yml +1 -0
  97. data/config/locales/sl.yml +1 -0
  98. data/config/locales/so-SO.yml +1 -0
  99. data/config/locales/sq-AL.yml +1 -0
  100. data/config/locales/sr-CS.yml +1 -0
  101. data/config/locales/sv.yml +1 -0
  102. data/config/locales/sw-KE.yml +1 -0
  103. data/config/locales/th-TH.yml +1 -0
  104. data/config/locales/ti-ER.yml +1 -0
  105. data/config/locales/tr-TR.yml +78 -0
  106. data/config/locales/uk.yml +1 -0
  107. data/config/locales/val-ES.yml +1 -0
  108. data/config/locales/vi.yml +1 -0
  109. data/config/locales/zh-CN.yml +1 -0
  110. data/config/locales/zh-TW.yml +1 -0
  111. data/decidim-design.gemspec +1 -1
  112. data/lib/decidim/design/version.rb +1 -1
  113. metadata +77 -18
  114. data/app/views/decidim/design/components/address/_static-address-online.html.erb +0 -26
  115. data/app/views/decidim/design/components/address/_static-address-person.html.erb +0 -25
  116. data/app/views/decidim/design/components/author/_static-avatar.html.erb +0 -38
  117. data/app/views/decidim/design/components/author/_static-compact.html.erb +0 -46
  118. data/app/views/decidim/design/components/author/_static-default.html.erb +0 -35
  119. data/app/views/decidim/design/components/follow/_static-follow-default.html.erb +0 -4
  120. data/app/views/decidim/design/components/follow/_static-follow-unfollow.html.erb +0 -4
  121. data/app/views/decidim/design/components/report/_static-report.html.erb +0 -34
@@ -3,14 +3,30 @@
3
3
  module Decidim
4
4
  module Design
5
5
  module CardsHelper
6
- # rubocop:disable Layout/LineLength
6
+ include ::Decidim::CardHelper
7
+
8
+ class DummyClass < ApplicationRecord
9
+ self.table_name = Decidim::Pages::Page.table_name
10
+
11
+ attr_accessor :organization, :title, :description
12
+
13
+ def resource_locator
14
+ Class.new do
15
+ def path(*_args)
16
+ "#"
17
+ end
18
+ end.new
19
+ end
20
+ end
21
+
7
22
  def cards_sections
8
23
  [
9
24
  {
10
25
  id: "types",
26
+ title: t("decidim.design.helpers.types"),
11
27
  contents: [
12
28
  {
13
- values: section_subtitle(title: "Card L", label: "list")
29
+ values: section_subtitle(title: t("decidim.design.helpers.card_l"), label: t("decidim.design.helpers.list"))
14
30
  },
15
31
  {
16
32
  type: :partial,
@@ -21,7 +37,7 @@ module Decidim
21
37
  template: "decidim/design/components/cards/static-card-l"
22
38
  },
23
39
  {
24
- values: section_subtitle(title: "Card G", label: "grid")
40
+ values: section_subtitle(title: t("decidim.design.helpers.card_g"), label: t("decidim.design.helpers.grid"))
25
41
  },
26
42
  {
27
43
  type: :partial,
@@ -29,7 +45,7 @@ module Decidim
29
45
  template: ["decidim/design/components/cards/static-card-g", "decidim/design/components/cards/static-card-g"]
30
46
  },
31
47
  {
32
- values: section_subtitle(title: "Card S", label: "search")
48
+ values: section_subtitle(title: t("decidim.design.helpers.card_s"), label: t("decidim.design.helpers.search"))
33
49
  },
34
50
  {
35
51
  type: :partial,
@@ -43,13 +59,14 @@ module Decidim
43
59
  },
44
60
  {
45
61
  id: "variations",
62
+ title: t("decidim.design.helpers.variations"),
46
63
  contents: [
47
64
  {
48
65
  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."]
66
+ values: [t("decidim.design.helpers.variations_cards_description")]
50
67
  },
51
68
  {
52
- values: section_subtitle(title: "Metadata items")
69
+ values: section_subtitle(title: t("decidim.design.helpers.metadata_items"))
53
70
  },
54
71
  {
55
72
  type: :partial,
@@ -58,10 +75,10 @@ module Decidim
58
75
  },
59
76
  {
60
77
  type: :text,
61
- values: ["Each resource define its own metadata items"]
78
+ values: [t("decidim.design.helpers.metadata_text")]
62
79
  },
63
80
  {
64
- values: section_subtitle(title: "Highlight")
81
+ values: section_subtitle(title: t("decidim.design.helpers.highlight"))
65
82
  },
66
83
  {
67
84
  type: :partial,
@@ -69,10 +86,10 @@ module Decidim
69
86
  },
70
87
  {
71
88
  type: :text,
72
- values: ["Used by resources who allow to highlight"]
89
+ values: [t("decidim.design.helpers.highlight_description")]
73
90
  },
74
91
  {
75
- values: section_subtitle(title: "Image and description")
92
+ values: section_subtitle(title: t("decidim.design.helpers.image_and_description"))
76
93
  },
77
94
  {
78
95
  type: :partial,
@@ -80,10 +97,10 @@ module Decidim
80
97
  },
81
98
  {
82
99
  type: :text,
83
- values: ["Used by <i>Blogs</i> cards"]
100
+ values: [t("decidim.design.helpers.blog_cards_html")]
84
101
  },
85
102
  {
86
- values: section_subtitle(title: "Description")
103
+ values: section_subtitle(title: t("decidim.design.helpers.description"))
87
104
  },
88
105
  {
89
106
  type: :partial,
@@ -91,10 +108,10 @@ module Decidim
91
108
  },
92
109
  {
93
110
  type: :text,
94
- values: ["Used by <i>Debates</i> cards"]
111
+ values: [t("decidim.design.helpers.debates_cards_html")]
95
112
  },
96
113
  {
97
- values: section_subtitle(title: "Use different template for the image block")
114
+ values: section_subtitle(title: t("decidim.design.helpers.debates_cards_text"))
98
115
  },
99
116
  {
100
117
  type: :partial,
@@ -102,10 +119,10 @@ module Decidim
102
119
  },
103
120
  {
104
121
  type: :text,
105
- values: ["Used by <i>Meetings</i> cards"]
122
+ values: [t("decidim.design.helpers.meetings_html")]
106
123
  },
107
124
  {
108
- values: section_subtitle(title: "Use the extra_data block")
125
+ values: section_subtitle(title: t("decidim.design.helpers.block_text"))
109
126
  },
110
127
  {
111
128
  type: :partial,
@@ -113,7 +130,7 @@ module Decidim
113
130
  },
114
131
  {
115
132
  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>"]
133
+ values: [t("decidim.design.helpers.accountability_cards_html")]
117
134
  },
118
135
  {
119
136
  type: :partial,
@@ -121,61 +138,484 @@ module Decidim
121
138
  },
122
139
  {
123
140
  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>"]
141
+ values: [t("decidim.design.helpers.budget_card_html")]
125
142
  }
126
143
  ]
127
144
  },
128
145
  {
129
- id: "sourcecode",
130
- contents: [
146
+ id: "source_code",
147
+ title: t("decidim.design.helpers.source_code"),
148
+ contents: source_contents
149
+ }
150
+ ]
151
+ end
152
+
153
+ def source_contents
154
+ dummy_resource = DummyClass.new(
155
+ id: 1000,
156
+ organization: current_organization,
157
+ title: t("decidim.design.helpers.dummy_title"),
158
+ description: t("decidim.design.helpers.dummy_description")
159
+ )
160
+
161
+ contents = [
162
+ { values: section_subtitle(title: t("decidim.design.helpers.generic_cards")) },
163
+ cell_table_item(t("decidim.design.helpers.card_g"), { cell: "decidim/card_l", args: [dummy_resource], call_string: 'cell("decidim/card_l", _RESOURCE_)' }),
164
+ cell_table_item(t("decidim.design.helpers.card_l"), { cell: "decidim/card_l", args: [dummy_resource], call_string: 'cell("decidim/card_g", _RESOURCE_)' }),
165
+ cell_table_item(t("decidim.design.helpers.card_s"), { cell: "decidim/card_l", args: [dummy_resource], call_string: 'cell("decidim/card_s", _RESOURCE_)' })
166
+ ]
167
+
168
+ contents += accountability_items
169
+ contents += blogs_items
170
+ contents += budgets_items
171
+ contents += debates_items
172
+ contents += meetings_items
173
+ contents += proposals_items
174
+ contents += sortitions_items
175
+ contents += assemblies_items
176
+ contents += conferences_items
177
+ contents += initiatives_items
178
+ contents += participatory_processes_items
179
+
180
+ contents
181
+ end
182
+
183
+ private
184
+
185
+ def accountability_items
186
+ return [] unless Decidim.module_installed?(:accountability) && (resource = Decidim::Accountability::Result.last).present?
187
+
188
+ [
189
+ { values: section_subtitle(title: t("decidim.design.helpers.accountability")) },
190
+ cell_table_item(
191
+ t("decidim.design.helpers.result_l"),
192
+ {
193
+ cell: "decidim/accountability/result_l",
194
+ args: [resource],
195
+ call_string: [
196
+ "card_for(_RESOURCE_)",
197
+ "card_for(_RESOURCE_, size: :l)",
198
+ 'cell("decidim/accountability/result", _RESOURCE_)',
199
+ 'cell("decidim/accountability/result", _RESOURCE_, size: :l)',
200
+ 'cell("decidim/accountability/result_l", _RESOURCE_)'
201
+ ]
202
+ }
203
+ )
204
+ ]
205
+ end
206
+
207
+ def blogs_items
208
+ return [] unless Decidim.module_installed?(:blogs) && (resource = Decidim::Blogs::Post.last).present?
209
+
210
+ [
211
+ { values: section_subtitle(title: t("decidim.design.helpers.blogs")) },
212
+ cell_table_item(
213
+ t("decidim.design.helpers.post_l"),
214
+ {
215
+ cell: "decidim/blogs/post_l",
216
+ args: [resource],
217
+ call_string: [
218
+ "card_for(_RESOURCE_)",
219
+ "card_for(_RESOURCE_, size: :l)",
220
+ 'cell("decidim/blogs/post", _RESOURCE_)',
221
+ 'cell("decidim/blogs/post", _RESOURCE_, size: :l)',
222
+ 'cell("decidim/blogs/post_l", _RESOURCE_)'
223
+ ]
224
+ }
225
+ ),
226
+ cell_table_item(
227
+ t("decidim.design.helpers.post_g"),
228
+ {
229
+ cell: "decidim/blogs/post_g",
230
+ args: [resource],
231
+ call_string: [
232
+ "card_for(_RESOURCE_, size: :g)",
233
+ 'cell("decidim/blogs/post", _RESOURCE_, size: :g)',
234
+ 'cell("decidim/blogs/post_g", _RESOURCE_)'
235
+ ]
236
+ }
237
+ ),
238
+ cell_table_item(
239
+ t("decidim.design.helpers.post_s"),
240
+ {
241
+ cell: "decidim/blogs/post_s",
242
+ args: [resource],
243
+ call_string: [
244
+ "card_for(_RESOURCE_, size: :s)",
245
+ 'cell("decidim/blogs/post", _RESOURCE_, size: :s)',
246
+ 'cell("decidim/blogs/post_s", _RESOURCE_)'
247
+ ]
248
+ }
249
+ )
250
+ ]
251
+ end
252
+
253
+ def budgets_items
254
+ return [] unless Decidim.module_installed?(:budgets) && (resource = Decidim::Budgets::Project.last).present?
255
+
256
+ [
257
+ { values: section_subtitle(title: t("decidim.design.helpers.budgets")) },
258
+ cell_table_item(
259
+ t("decidim.design.helpers.project_l"),
260
+ {
261
+ cell: "decidim/budgets/project_l",
262
+ args: [resource],
263
+ call_string: [
264
+ "card_for(_RESOURCE_)",
265
+ "card_for(_RESOURCE_), size: :l",
266
+ 'cell("decidim/budgets/project", _RESOURCE_)',
267
+ 'cell("decidim/budgets/project", _RESOURCE_, size: :l)',
268
+ 'cell("decidim/budgets/project_l", _RESOURCE_)'
269
+ ]
270
+ }
271
+ ),
272
+ cell_table_item(
273
+ t("decidim.design.helpers.project_s"),
274
+ {
275
+ cell: "decidim/budgets/project_s",
276
+ args: [resource],
277
+ call_string: [
278
+ "card_for(_RESOURCE_), size: :s",
279
+ 'cell("decidim/budgets/project", _RESOURCE_, size: :s)',
280
+ 'cell("decidim/budgets/project_s", _RESOURCE_)'
281
+ ]
282
+ }
283
+ )
284
+ ]
285
+ end
286
+
287
+ def debates_items
288
+ return [] unless Decidim.module_installed?(:debates) && (resource = Decidim::Debates::Debate.last).present?
289
+
290
+ [
291
+ { values: section_subtitle(title: t("decidim.design.helpers.debates")) },
292
+ cell_table_item(
293
+ t("decidim.design.helpers.debate_l"),
294
+ {
295
+ cell: "decidim/debates/debate_l",
296
+ args: [resource],
297
+ call_string: [
298
+ "card_for(_RESOURCE_)",
299
+ "card_for(_RESOURCE_), size: :l",
300
+ 'cell("decidim/debates/debate", _RESOURCE_)',
301
+ 'cell("decidim/debates/debate", _RESOURCE_, size: :l)',
302
+ 'cell("decidim/debates/debate_l", _RESOURCE_)'
303
+ ]
304
+ }
305
+ ),
306
+ cell_table_item(
307
+ t("decidim.design.helpers.debate_s"),
308
+ {
309
+ cell: "decidim/debates/debate_s",
310
+ args: [resource],
311
+ call_string: [
312
+ "card_for(_RESOURCE_), size: :s",
313
+ 'cell("decidim/debates/debate", _RESOURCE_, size: :s)',
314
+ 'cell("decidim/debates/debate_s", _RESOURCE_)'
315
+ ]
316
+ }
317
+ )
318
+ ]
319
+ end
320
+
321
+ def meetings_items
322
+ return [] unless Decidim.module_installed?(:meetings) && (resource = Decidim::Meetings::Meeting.last).present?
323
+
324
+ [
325
+ { values: section_subtitle(title: t("decidim.design.helpers.meetings")) },
326
+ cell_table_item(
327
+ t("decidim.design.helpers.meeting_l"),
328
+ {
329
+ cell: "decidim/meetings/meeting_l",
330
+ args: [resource],
331
+ call_string: [
332
+ "card_for(_RESOURCE_)",
333
+ "card_for(_RESOURCE_, size: :l)",
334
+ 'cell("decidim/meetings/meeting", _RESOURCE_)',
335
+ 'cell("decidim/meetings/meeting", _RESOURCE_, size: :l)',
336
+ 'cell("decidim/meetings/meeting_l", _RESOURCE_)'
337
+ ]
338
+ }
339
+ ),
340
+ cell_table_item(
341
+ t("decidim.design.helpers.meeting_s"),
342
+ {
343
+ cell: "decidim/meetings/meeting_s",
344
+ args: [resource],
345
+ call_string: [
346
+ "card_for(_RESOURCE_, size: :s)",
347
+ 'cell("decidim/meetings/meeting", _RESOURCE_, size: :s)',
348
+ 'cell("decidim/meetings/meeting_s", _RESOURCE_)'
349
+ ]
350
+ }
351
+ )
352
+ ]
353
+ end
354
+
355
+ def proposals_items
356
+ items = []
357
+ return items unless Decidim.module_installed?(:proposals)
358
+
359
+ proposal_resource = Decidim::Proposals::Proposal.last
360
+ collaborative_draft_resource = Decidim::Proposals::CollaborativeDraft.last
361
+
362
+ items << { values: section_subtitle(title: t("decidim.design.helpers.proposals")) } if [proposal_resource, collaborative_draft_resource].any?(&:present?)
363
+
364
+ if (resource = proposal_resource).present?
365
+ items += [
366
+ cell_table_item(
367
+ t("decidim.design.helpers.proposal_l"),
131
368
  {
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
- )
369
+ cell: "decidim/proposals/proposal_l",
370
+ args: [resource],
371
+ call_string: [
372
+ "card_for(_RESOURCE_)",
373
+ "card_for(_RESOURCE_, size: :l)",
374
+ 'cell("decidim/proposals/proposal", _RESOURCE_)',
375
+ 'cell("decidim/proposals/proposal", _RESOURCE_, size: :l)',
376
+ 'cell("decidim/proposals/proposal_l", _RESOURCE_)'
377
+ ]
173
378
  }
174
- ]
175
- }
379
+ ),
380
+ cell_table_item(
381
+ t("decidim.design.helpers.proposal_s"),
382
+ {
383
+ cell: "decidim/proposals/proposal_s",
384
+ args: [resource],
385
+ call_string: [
386
+ "card_for(_RESOURCE_, size: :s)",
387
+ 'cell("decidim/proposals/proposal", _RESOURCE_, size: :s)',
388
+ 'cell("decidim/proposals/proposal_s", _RESOURCE_)'
389
+ ]
390
+ }
391
+ )
392
+ ]
393
+ end
394
+
395
+ if (resource = collaborative_draft_resource).present?
396
+ items += [
397
+ cell_table_item(
398
+ t("decidim.design.helpers.collaborative_draft_l"),
399
+ {
400
+ cell: "decidim/proposals/collaborative_draft_l",
401
+ args: [resource],
402
+ call_string: [
403
+ "card_for(_RESOURCE_)",
404
+ 'cell("decidim/proposals/collaborative_draft", _RESOURCE_)',
405
+ 'cell("decidim/proposals/collaborative_draft_l", _RESOURCE_)'
406
+ ]
407
+ }
408
+ )
409
+ ]
410
+ end
411
+
412
+ items
413
+ end
414
+
415
+ def sortitions_items
416
+ return [] unless Decidim.module_installed?(:sortitions) && (resource = Decidim::Sortitions::Sortition.last).present?
417
+
418
+ [
419
+ { values: section_subtitle(title: t("decidim.design.helpers.sortitions")) },
420
+ cell_table_item(
421
+ t("decidim.design.helpers.sortition_l"),
422
+ {
423
+ cell: "decidim/sortitions/sortition_l",
424
+ args: [resource],
425
+ call_string: [
426
+ "card_for(_RESOURCE_)",
427
+ 'cell("decidim/sortitions/sortition", _RESOURCE_)',
428
+ 'cell("decidim/sortitions/sortition_l", _RESOURCE_)'
429
+ ]
430
+ }
431
+ )
176
432
  ]
177
433
  end
178
- # rubocop:enable Layout/LineLength
434
+
435
+ def assemblies_items
436
+ return [] unless Decidim.module_installed?(:assemblies) && (resource = Decidim::Assembly.last).present?
437
+
438
+ [
439
+ { values: section_subtitle(title: t("decidim.design.helpers.assemblies")) },
440
+ cell_table_item(
441
+ t("decidim.design.helpers.assembly_g"),
442
+ {
443
+ cell: "decidim/assemblies/assembly_g",
444
+ args: [resource],
445
+ call_string: [
446
+ "card_for(_RESOURCE_)",
447
+ "card_for(_RESOURCE_, size: :g)",
448
+ 'cell("decidim/assemblies/assembly", _RESOURCE_)',
449
+ 'cell("decidim/assemblies/assembly", _RESOURCE_, size: :g)',
450
+ 'cell("decidim/assemblies/assembly_g", _RESOURCE_)'
451
+ ]
452
+ }
453
+ ),
454
+ cell_table_item(
455
+ t("decidim.design.helpers.assembly_s"),
456
+ {
457
+ cell: "decidim/assemblies/assembly_s",
458
+ args: [resource],
459
+ call_string: [
460
+ "card_for(_RESOURCE_, size: :s)",
461
+ 'cell("decidim/assemblies/assembly", _RESOURCE_, size: :s)',
462
+ 'cell("decidim/assemblies/assembly_s", _RESOURCE_)'
463
+ ]
464
+ }
465
+ )
466
+ ]
467
+ end
468
+
469
+ def conferences_items
470
+ return [] unless Decidim.module_installed?(:conferences) && (resource = Decidim::Conference.last).present?
471
+
472
+ [
473
+ { values: section_subtitle(title: t("decidim.design.helpers.conferences")) },
474
+ cell_table_item(
475
+ t("decidim.design.helpers.conference_g"),
476
+ {
477
+ cell: "decidim/conferences/conference_g",
478
+ args: [resource],
479
+ call_string: [
480
+ "card_for(_RESOURCE_)",
481
+ "card_for(_RESOURCE_, size: :g)",
482
+ 'cell("decidim/conferences/conference", _RESOURCE_)',
483
+ 'cell("decidim/conferences/conference", _RESOURCE_, size: :g)',
484
+ 'cell("decidim/conferences/conference_g", _RESOURCE_)'
485
+ ]
486
+ }
487
+ ),
488
+ cell_table_item(
489
+ t("decidim.design.helpers.conference_s"),
490
+ {
491
+ cell: "decidim/conferences/conference_s",
492
+ args: [resource],
493
+ call_string: [
494
+ "card_for(_RESOURCE_, size: :s)",
495
+ 'cell("decidim/conferences/conference", _RESOURCE_, size: :s)',
496
+ 'cell("decidim/conferences/conference_s", _RESOURCE_)'
497
+ ]
498
+ }
499
+ )
500
+ ]
501
+ end
502
+
503
+ def initiatives_items
504
+ return [] unless Decidim.module_installed?(:initiatives) && (resource = Decidim::Initiative.last).present?
505
+
506
+ [
507
+ { values: section_subtitle(title: t("decidim.design.helpers.initiatives")) },
508
+ cell_table_item(
509
+ t("decidim.design.helpers.initiative_g"),
510
+ {
511
+ cell: "decidim/initiatives/initiative_g",
512
+ args: [resource],
513
+ call_string: [
514
+ "card_for(_RESOURCE_)",
515
+ "card_for(_RESOURCE_, size: :g)",
516
+ 'cell("decidim/initiatives/initiative", _RESOURCE_)',
517
+ 'cell("decidim/initiatives/initiative", _RESOURCE_, size: :g)',
518
+ 'cell("decidim/initiatives/initiative_g", _RESOURCE_)'
519
+ ]
520
+ }
521
+ ),
522
+ cell_table_item(
523
+ t("decidim.design.helpers.initiative_s"),
524
+ {
525
+ cell: "decidim/initiatives/initiative_s",
526
+ args: [resource],
527
+ call_string: [
528
+ "card_for(_RESOURCE_, size: :s)",
529
+ 'cell("decidim/initiatives/initiative", _RESOURCE_, size: :s)',
530
+ 'cell("decidim/initiatives/initiative_s", _RESOURCE_)'
531
+ ]
532
+ }
533
+ )
534
+ ]
535
+ end
536
+
537
+ def participatory_processes_items
538
+ items = []
539
+ return items unless Decidim.module_installed?(:participatory_processes)
540
+
541
+ process_resource = Decidim::ParticipatoryProcess.last
542
+ process_group_resource = Decidim::ParticipatoryProcessGroup.last
543
+
544
+ items << { values: section_subtitle(title: t("decidim.design.helpers.participatory_processes")) } if [process_resource, process_group_resource].any?(&:present?)
545
+
546
+ if (resource = process_resource).present?
547
+ items += [
548
+ cell_table_item(
549
+ t("decidim.design.helpers.participatory_process_g"),
550
+ {
551
+ cell: "decidim/participatory_processes/process_g",
552
+ args: [resource],
553
+ call_string: [
554
+ "card_for(_RESOURCE_)",
555
+ "card_for(_RESOURCE_, size: :g)",
556
+ 'cell("decidim/participatory_processes/process", _RESOURCE_)',
557
+ 'cell("decidim/participatory_processes/process", _RESOURCE_, size: :g)',
558
+ 'cell("decidim/participatory_processes/process_g", _RESOURCE_)'
559
+ ]
560
+ }
561
+ ),
562
+ cell_table_item(
563
+ t("decidim.design.helpers.participatory_process_s"),
564
+ {
565
+ cell: "decidim/participatory_processes/process_s",
566
+ args: [resource],
567
+ call_string: [
568
+ "card_for(_RESOURCE_, size: :s)",
569
+ 'cell("decidim/participatory_processes/process", _RESOURCE_, size: :s)',
570
+ 'cell("decidim/participatory_processes/process_s", _RESOURCE_)'
571
+ ]
572
+ }
573
+ )
574
+ ]
575
+ end
576
+
577
+ if (resource = process_group_resource).present?
578
+ items += [
579
+ cell_table_item(
580
+ t("decidim.design.helpers.participatory_process_group_g"),
581
+ {
582
+ cell: "decidim/participatory_processes/process_group_g",
583
+ args: [resource],
584
+ call_string: [
585
+ "card_for(_RESOURCE_)",
586
+ "card_for(_RESOURCE_, size: :g)",
587
+ 'cell("decidim/participatory_processes/process_group", _RESOURCE_)',
588
+ 'cell("decidim/participatory_processes/process_group", _RESOURCE_, size: :g)',
589
+ 'cell("decidim/participatory_processes/process_group_g", _RESOURCE_)'
590
+ ]
591
+ }
592
+ ),
593
+ cell_table_item(
594
+ t("decidim.design.helpers.participatory_process_group_s"),
595
+ {
596
+ cell: "decidim/participatory_processes/process_group_s",
597
+ args: [resource],
598
+ call_string: [
599
+ "card_for(_RESOURCE_, size: :s)",
600
+ 'cell("decidim/participatory_processes/process_group", _RESOURCE_, size: :s)',
601
+ 'cell("decidim/participatory_processes/process_group_s", _RESOURCE_)'
602
+ ]
603
+ }
604
+ )
605
+ ]
606
+ end
607
+
608
+ items
609
+ end
610
+
611
+ def cell_table_item(heading, cell_snippet = {})
612
+ {
613
+ type: :cell_table,
614
+ options: { headings: [heading] },
615
+ values: [""],
616
+ cell_snippet:
617
+ }
618
+ end
179
619
 
180
620
  def cards_table(*table_rows, **_opts)
181
621
  table_rows.map do |table_cell|