decidim-consultations 0.24.1 → 0.25.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/consultations/consultation_m_cell.rb +1 -1
  3. data/app/cells/decidim/consultations/content_blocks/highlighted_consultations/show.erb +1 -1
  4. data/app/commands/decidim/consultations/admin/update_consultation.rb +5 -13
  5. data/app/commands/decidim/consultations/admin/update_question.rb +5 -13
  6. data/app/controllers/concerns/decidim/consultations/needs_question.rb +1 -1
  7. data/app/forms/decidim/consultations/admin/consultation_form.rb +2 -2
  8. data/app/forms/decidim/consultations/admin/question_form.rb +3 -3
  9. data/app/models/decidim/consultation.rb +4 -4
  10. data/app/models/decidim/consultations/question.rb +13 -5
  11. data/app/packs/entrypoints/decidim_consultations.js +8 -0
  12. data/app/{assets/images/decidim/consultations/icon.svg → packs/images/decidim/consultations/decidim_consultations.svg} +0 -0
  13. data/app/packs/src/decidim/consultations/show_more.js +10 -0
  14. data/app/{assets/javascripts/decidim/consultations/utils.js.es6 → packs/src/decidim/consultations/utils.js} +5 -5
  15. data/app/{assets/javascripts → packs/src}/decidim/consultations/utils_multiple.js +2 -1
  16. data/app/{assets/javascripts → packs/src}/decidim/consultations/vote_dialog.js +1 -1
  17. data/app/{assets → packs}/stylesheets/decidim/consultations/_question.scss +0 -0
  18. data/app/{assets → packs}/stylesheets/decidim/consultations/_question_multiple_votes.scss +0 -0
  19. data/app/{assets → packs}/stylesheets/decidim/consultations/_stats.scss +0 -0
  20. data/app/{assets → packs}/stylesheets/decidim/consultations/_video_wrapper.scss +0 -0
  21. data/app/{assets → packs}/stylesheets/decidim/consultations/banners/_block-banner.scss +0 -0
  22. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/_consultations-banner.scss +0 -0
  23. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/_consultations-card.scss +0 -0
  24. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/_consultations-header.scss +0 -0
  25. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/_consultations-home-banner.scss +0 -0
  26. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/_consultations-home-intro.scss +0 -0
  27. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/_consultations-intro.scss +0 -0
  28. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/_consultations-title.scss +0 -0
  29. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/_consultations_nav.scss +0 -0
  30. data/app/{assets → packs}/stylesheets/decidim/consultations/consultations/introductory_image.scss +0 -0
  31. data/app/packs/stylesheets/decidim/consultations/consultations.scss +14 -0
  32. data/app/{assets/stylesheets/decidim/consultations/highlighted-content-banner.css.scss → packs/stylesheets/decidim/consultations/highlighted-content-banner.scss} +0 -0
  33. data/app/queries/decidim/consultations/admin/admin_users.rb +16 -12
  34. data/app/views/decidim/consultations/_consultation.html.erb +1 -1
  35. data/app/views/decidim/consultations/admin/consultations/_form.html.erb +1 -1
  36. data/app/views/decidim/consultations/admin/consultations/index.html.erb +1 -1
  37. data/app/views/decidim/consultations/admin/question_configuration/_form.html.erb +1 -1
  38. data/app/views/decidim/consultations/admin/questions/_form.html.erb +1 -1
  39. data/app/views/decidim/consultations/consultations/_consultation_card.html.erb +1 -1
  40. data/app/views/decidim/consultations/consultations/_consultation_details.html.erb +1 -1
  41. data/app/views/decidim/consultations/consultations/_filters.html.erb +1 -0
  42. data/app/views/decidim/consultations/consultations/index.html.erb +1 -2
  43. data/app/views/decidim/consultations/question_multiple_votes/_voting_rules.html.erb +1 -1
  44. data/app/views/decidim/consultations/questions/_right_column.html.erb +1 -1
  45. data/app/views/decidim/consultations/questions/_vote_button.html.erb +1 -2
  46. data/app/views/decidim/consultations/questions/show.html.erb +3 -2
  47. data/app/views/layouts/decidim/_consultation_header.html.erb +1 -1
  48. data/app/views/layouts/decidim/_question_components.html.erb +1 -1
  49. data/app/views/layouts/decidim/_question_header.html.erb +1 -1
  50. data/app/views/layouts/decidim/admin/consultation.html.erb +1 -1
  51. data/app/views/layouts/decidim/admin/question.html.erb +4 -83
  52. data/config/assets.rb +9 -0
  53. data/config/locales/ar.yml +2 -8
  54. data/config/locales/ca.yml +5 -8
  55. data/config/locales/cs.yml +7 -10
  56. data/config/locales/de.yml +5 -8
  57. data/config/locales/el.yml +2 -8
  58. data/config/locales/en.yml +6 -8
  59. data/config/locales/es-MX.yml +5 -8
  60. data/config/locales/es-PY.yml +5 -8
  61. data/config/locales/es.yml +5 -8
  62. data/config/locales/eu.yml +2 -8
  63. data/config/locales/fi-plain.yml +5 -8
  64. data/config/locales/fi.yml +5 -8
  65. data/config/locales/fr-CA.yml +3 -9
  66. data/config/locales/fr-LU.yml +372 -0
  67. data/config/locales/fr.yml +2 -8
  68. data/config/locales/gl.yml +5 -8
  69. data/config/locales/hu.yml +2 -8
  70. data/config/locales/id-ID.yml +2 -8
  71. data/config/locales/is-IS.yml +2 -8
  72. data/config/locales/it.yml +6 -8
  73. data/config/locales/ja.yml +8 -8
  74. data/config/locales/lb-LU.yml +1 -0
  75. data/config/locales/lv.yml +2 -8
  76. data/config/locales/nl.yml +5 -8
  77. data/config/locales/no.yml +2 -8
  78. data/config/locales/pl.yml +6 -9
  79. data/config/locales/pt-BR.yml +90 -8
  80. data/config/locales/pt.yml +2 -8
  81. data/config/locales/ro-RO.yml +5 -8
  82. data/config/locales/ru.yml +2 -8
  83. data/config/locales/sk.yml +2 -8
  84. data/config/locales/sv.yml +5 -8
  85. data/config/locales/tr-TR.yml +2 -8
  86. data/config/locales/uk.yml +2 -8
  87. data/config/locales/zh-CN.yml +2 -8
  88. data/lib/decidim/api/consultation_question_type.rb +8 -0
  89. data/lib/decidim/api/consultation_type.rb +8 -0
  90. data/lib/decidim/consultations/admin_engine.rb +109 -24
  91. data/lib/decidim/consultations/engine.rb +6 -12
  92. data/lib/decidim/consultations/participatory_space.rb +46 -9
  93. data/lib/decidim/consultations/version.rb +1 -1
  94. metadata +37 -38
  95. data/app/assets/config/decidim_consultations_manifest.css +0 -3
  96. data/app/assets/config/decidim_consultations_manifest.js +0 -5
  97. data/app/assets/images/decidim/consultations/icon2.svg +0 -1
  98. data/app/assets/javascripts/decidim/consultations/show_more.js.es6 +0 -12
  99. data/app/assets/stylesheets/decidim/consultations/consultations.scss +0 -6
  100. data/app/helpers/decidim/consultations/admin/consultation_menu_helper.rb +0 -15
  101. data/config/locales/ja-JP.yml +0 -367
@@ -119,6 +119,8 @@ pt:
119
119
  questions: Questões
120
120
  results: Resultados
121
121
  questions_submenu:
122
+ attachments: Anexos
123
+ categories: Categorias
122
124
  components: Componentes
123
125
  configuration: Configuração
124
126
  consultation: Consulta
@@ -321,10 +323,6 @@ pt:
321
323
  title: O que são consultas?
322
324
  menu:
323
325
  consultations: Consultas
324
- pages:
325
- home:
326
- statistics:
327
- consultations_count: Consultas
328
326
  questions:
329
327
  next_button: Próxima pergunta
330
328
  previous_button: Pergunta anterior
@@ -361,10 +359,6 @@ pt:
361
359
  vote: Voto
362
360
  layouts:
363
361
  decidim:
364
- admin:
365
- question:
366
- attachments: Anexos
367
- categories: Categorias
368
362
  consultation_voting_data:
369
363
  start_voting_date: A votação começa
370
364
  question_components:
@@ -124,6 +124,8 @@ ro:
124
124
  questions: Întrebări
125
125
  results: Rezultate
126
126
  questions_submenu:
127
+ attachments: Atașamente
128
+ categories: Categorii
127
129
  components: Componente
128
130
  configuration: Configurare
129
131
  consultation: Consultare
@@ -334,10 +336,6 @@ ro:
334
336
  title: Ce sunt consultările?
335
337
  menu:
336
338
  consultations: Consultări
337
- pages:
338
- home:
339
- statistics:
340
- consultations_count: Consultări
341
339
  questions:
342
340
  next_button: Următoarea întrebare
343
341
  previous_button: Întrebarea precedentă
@@ -372,12 +370,11 @@ ro:
372
370
  consultations:
373
371
  actions:
374
372
  vote: Votează
373
+ statistics:
374
+ consultations_count: Consultări
375
+ votes_count: Voturi
375
376
  layouts:
376
377
  decidim:
377
- admin:
378
- question:
379
- attachments: Atașamente
380
- categories: Categorii
381
378
  consultation_voting_data:
382
379
  start_voting_date: Votarea începe
383
380
  question_components:
@@ -98,6 +98,8 @@ ru:
98
98
  info: Сведения
99
99
  questions: Вопросы
100
100
  questions_submenu:
101
+ attachments: Прикрепленные файлы
102
+ categories: Категории
101
103
  components: Составляющие
102
104
  consultation: Консультация
103
105
  info: Сведения
@@ -243,10 +245,6 @@ ru:
243
245
  unspecified: Не указано
244
246
  menu:
245
247
  consultations: Консультации
246
- pages:
247
- home:
248
- statistics:
249
- consultations_count: Консультации
250
248
  questions:
251
249
  results:
252
250
  title: Итоги
@@ -274,10 +272,6 @@ ru:
274
272
  title: 'Консультация: подтвердите поддержку'
275
273
  layouts:
276
274
  decidim:
277
- admin:
278
- question:
279
- attachments: Прикрепленные файлы
280
- categories: Категории
281
275
  consultation_voting_data:
282
276
  start_voting_date: Голосование начинается
283
277
  question_components:
@@ -127,6 +127,8 @@ sk:
127
127
  questions: Otázky
128
128
  results: Výsledky
129
129
  questions_submenu:
130
+ attachments: Prílohy
131
+ categories: Kategórie
130
132
  components: Súčasti
131
133
  configuration: Konfigurácia
132
134
  consultation: Konzultácia
@@ -339,10 +341,6 @@ sk:
339
341
  title: Čo sú konzultácie?
340
342
  menu:
341
343
  consultations: Konzultácie
342
- pages:
343
- home:
344
- statistics:
345
- consultations_count: Konzultácie
346
344
  questions:
347
345
  next_button: Ďalšia otázka
348
346
  previous_button: Predchádzajúca otázka
@@ -377,10 +375,6 @@ sk:
377
375
  vote: Hlasovať
378
376
  layouts:
379
377
  decidim:
380
- admin:
381
- question:
382
- attachments: Prílohy
383
- categories: Kategórie
384
378
  consultation_voting_data:
385
379
  start_voting_date: Hlasovanie začína
386
380
  question_components:
@@ -120,6 +120,8 @@ sv:
120
120
  questions: Frågor
121
121
  results: Resultat
122
122
  questions_submenu:
123
+ attachments: Bilagor
124
+ categories: Kategorier
123
125
  components: Komponenter
124
126
  configuration: Konfiguration
125
127
  consultation: Samråd
@@ -324,10 +326,6 @@ sv:
324
326
  title: Vad är samråd?
325
327
  menu:
326
328
  consultations: Samråd
327
- pages:
328
- home:
329
- statistics:
330
- consultations_count: Samråd
331
329
  questions:
332
330
  next_button: Nästa fråga
333
331
  previous_button: Föregående fråga
@@ -362,12 +360,11 @@ sv:
362
360
  consultations:
363
361
  actions:
364
362
  vote: Rösta
363
+ statistics:
364
+ consultations_count: Samråd
365
+ votes_count: Röster
365
366
  layouts:
366
367
  decidim:
367
- admin:
368
- question:
369
- attachments: Bilagor
370
- categories: Kategorier
371
368
  consultation_voting_data:
372
369
  start_voting_date: Omröstningen börjar
373
370
  question_components:
@@ -119,6 +119,8 @@ tr:
119
119
  questions: Sorular
120
120
  results: Sonuçlar
121
121
  questions_submenu:
122
+ attachments: Ekler
123
+ categories: Kategoriler
122
124
  components: Bileşenler
123
125
  configuration: Konfigürasyon
124
126
  consultation: Danışma
@@ -323,10 +325,6 @@ tr:
323
325
  title: Danışma nedir?
324
326
  menu:
325
327
  consultations: İstişareler
326
- pages:
327
- home:
328
- statistics:
329
- consultations_count: Danışmalar
330
328
  questions:
331
329
  next_button: Sonraki soru
332
330
  previous_button: Önceki soru
@@ -363,10 +361,6 @@ tr:
363
361
  vote: Oy ver
364
362
  layouts:
365
363
  decidim:
366
- admin:
367
- question:
368
- attachments: Ekler
369
- categories: Kategoriler
370
364
  consultation_voting_data:
371
365
  start_voting_date: Oylama başlıyor
372
366
  question_components:
@@ -98,6 +98,8 @@ uk:
98
98
  info: Відомості
99
99
  questions: Питання
100
100
  questions_submenu:
101
+ attachments: Вкладені файли
102
+ categories: Категорії
101
103
  components: Складові
102
104
  consultation: Консультація
103
105
  info: Відомості
@@ -243,10 +245,6 @@ uk:
243
245
  unspecified: Не вказано
244
246
  menu:
245
247
  consultations: Консультації
246
- pages:
247
- home:
248
- statistics:
249
- consultations_count: Консультації
250
248
  questions:
251
249
  results:
252
250
  title: Підсумки
@@ -274,10 +272,6 @@ uk:
274
272
  title: 'Консультація: підтвердьте підтримку'
275
273
  layouts:
276
274
  decidim:
277
- admin:
278
- question:
279
- attachments: Вкладені файли
280
- categories: Категорії
281
275
  consultation_voting_data:
282
276
  start_voting_date: Голосування починається
283
277
  question_components:
@@ -115,6 +115,8 @@ zh-CN:
115
115
  questions: 问 题
116
116
  results: 成果
117
117
  questions_submenu:
118
+ attachments: 附件
119
+ categories: 类别管理
118
120
  components: 组件
119
121
  configuration: 配置
120
122
  consultation: Consultation
@@ -311,10 +313,6 @@ zh-CN:
311
313
  title: 什么是协商?
312
314
  menu:
313
315
  consultations: 协商
314
- pages:
315
- home:
316
- statistics:
317
- consultations_count: 协商
318
316
  questions:
319
317
  next_button: 下一个问题
320
318
  previous_button: 上一个问题
@@ -351,10 +349,6 @@ zh-CN:
351
349
  vote: 投票
352
350
  layouts:
353
351
  decidim:
354
- admin:
355
- question:
356
- attachments: 附件
357
- categories: 类别管理
358
352
  consultation_voting_data:
359
353
  start_voting_date: 投票开始
360
354
  question_components:
@@ -47,6 +47,14 @@ module Decidim
47
47
  field :min_votes, GraphQL::Types::Int, "The minimum number of votes in this question", null: true
48
48
  field :response_groups_count, GraphQL::Types::Int, "The number of group responses for this question", null: true
49
49
  field :instructions, Decidim::Core::TranslatedFieldType, "Instructions for this question", null: true
50
+
51
+ def banner_image
52
+ object.attached_uploader(:banner_image).path
53
+ end
54
+
55
+ def hero_image
56
+ object.attached_uploader(:hero_image).path
57
+ end
50
58
  end
51
59
  end
52
60
  end
@@ -24,6 +24,14 @@ module Decidim
24
24
  field :results_published_at, Decidim::Core::DateType, "Date when the results have been published", null: true
25
25
 
26
26
  field :questions, [Decidim::Consultations::ConsultationQuestionType, { null: true }], "", null: true
27
+
28
+ def introductory_image
29
+ object.attached_uploader(:introductory_image).path
30
+ end
31
+
32
+ def banner_image
33
+ object.attached_uploader(:banner_image).path
34
+ end
27
35
  end
28
36
  end
29
37
  end
@@ -55,36 +55,121 @@ module Decidim
55
55
 
56
56
  initializer "decidim_consultations.admin_consultation_menu" do
57
57
  Decidim.menu :admin_consultation_menu do |menu|
58
- menu.item I18n.t("info", scope: "decidim.admin.menu.consultations_submenu"),
59
- decidim_admin_consultations.edit_consultation_path(current_consultation),
60
- position: 1.0,
61
- active: is_active_link?(decidim_admin_consultations.edit_consultation_path(current_consultation)),
62
- if: allowed_to?(:update, :consultation, consultation: current_consultation)
63
- menu.item I18n.t("questions", scope: "decidim.admin.menu.consultations_submenu"),
64
- decidim_admin_consultations.consultation_questions_path(current_consultation),
65
- position: 1.1,
66
- active: is_active_link?(decidim_admin_consultations.consultation_questions_path(current_consultation)),
67
- if: allowed_to?(:read, :question)
68
- menu.item I18n.t("results", scope: "decidim.admin.menu.consultations_submenu"),
69
- decidim_admin_consultations.results_consultation_path(current_consultation),
70
- position: 1.0,
71
- active: is_active_link?(decidim_admin_consultations.results_consultation_path(current_consultation)),
72
- if: allowed_to?(:read, :question)
58
+ menu.add_item :edit_consultation,
59
+ I18n.t("info", scope: "decidim.admin.menu.consultations_submenu"),
60
+ decidim_admin_consultations.edit_consultation_path(current_consultation),
61
+ position: 1.0,
62
+ active: is_active_link?(decidim_admin_consultations.edit_consultation_path(current_consultation)),
63
+ if: allowed_to?(:update, :consultation, consultation: current_consultation)
64
+ menu.add_item :consultation_questions,
65
+ I18n.t("questions", scope: "decidim.admin.menu.consultations_submenu"),
66
+ decidim_admin_consultations.consultation_questions_path(current_consultation),
67
+ position: 1.1,
68
+ active: is_active_link?(decidim_admin_consultations.consultation_questions_path(current_consultation)),
69
+ if: allowed_to?(:read, :question)
70
+ menu.add_item :results_consultation,
71
+ I18n.t("results", scope: "decidim.admin.menu.consultations_submenu"),
72
+ decidim_admin_consultations.results_consultation_path(current_consultation),
73
+ position: 1.0,
74
+ active: is_active_link?(decidim_admin_consultations.results_consultation_path(current_consultation)),
75
+ if: allowed_to?(:read, :question)
73
76
  end
74
77
  end
75
78
  initializer "decidim_consultations.admin_menu" do
76
79
  Decidim.menu :admin_menu do |menu|
77
- menu.item I18n.t("menu.consultations", scope: "decidim.admin"),
78
- decidim_admin_consultations.consultations_path,
79
- icon_name: "comment-square",
80
- position: 2.65,
81
- active: :inclusive,
82
- if: allowed_to?(:enter, :space_area, space_name: :consultations)
80
+ menu.add_item :consultations,
81
+ I18n.t("menu.consultations", scope: "decidim.admin"),
82
+ decidim_admin_consultations.consultations_path,
83
+ icon_name: "comment-square",
84
+ position: 2.65,
85
+ active: :inclusive,
86
+ if: allowed_to?(:enter, :space_area, space_name: :consultations)
83
87
  end
84
88
  end
85
- initializer "decidim_consultations.action_controller" do |_app|
86
- ActiveSupport.on_load :action_controller do
87
- helper Decidim::Consultations::Admin::ConsultationMenuHelper if respond_to?(:helper)
89
+
90
+ initializer "decidim_consultations.admin_question_menu" do
91
+ Decidim.menu :admin_question_menu do |menu|
92
+ menu.add_item :edit_consultation,
93
+ I18n.t("consultation", scope: "decidim.admin.menu.questions_submenu"),
94
+ decidim_admin_consultations.edit_consultation_path(current_participatory_space.consultation),
95
+ position: 1.0,
96
+ active: is_active_link?(decidim_admin_consultations.edit_consultation_path(current_participatory_space.consultation)),
97
+ if: allowed_to?(:update, :consultation, consultation: current_participatory_space.consultation)
98
+ menu.add_item :consultation_questions,
99
+ I18n.t("questions", scope: "decidim.admin.menu.consultations_submenu"),
100
+ decidim_admin_consultations.consultation_questions_path(current_participatory_space.consultation),
101
+ position: 1.0,
102
+ active: is_active_link?(decidim_admin_consultations.consultation_questions_path(current_participatory_space.consultation)),
103
+ submenu: { target_menu: :admin_questions_menu }
104
+
105
+ menu.add_item :results_consultation,
106
+ I18n.t("results", scope: "decidim.admin.menu.consultations_submenu"),
107
+ decidim_admin_consultations.results_consultation_path(current_participatory_space.consultation),
108
+ position: 1.0,
109
+ active: is_active_link?(decidim_admin_consultations.results_consultation_path(current_participatory_space.consultation))
110
+ end
111
+ end
112
+ initializer "decidim_consultations.admin_questions_menu" do
113
+ Decidim.menu :admin_questions_menu do |menu|
114
+ menu.add_item :edit_question,
115
+ I18n.t("info", scope: "decidim.admin.menu.questions_submenu"),
116
+ decidim_admin_consultations.edit_question_path(current_participatory_space),
117
+ position: 1.0,
118
+ active: is_active_link?(decidim_admin_consultations.edit_question_path(current_participatory_space)),
119
+ if: allowed_to?(:update, :question, question: current_participatory_space)
120
+
121
+ menu.add_item :edit_question_configuration,
122
+ I18n.t("configuration", scope: "decidim.admin.menu.questions_submenu"),
123
+ decidim_admin_consultations.edit_question_configuration_path(current_participatory_space),
124
+ position: 1.0,
125
+ active: is_active_link?(decidim_admin_consultations.edit_question_configuration_path(current_participatory_space)),
126
+ if: allowed_to?(:configure, :question, question: current_participatory_space)
127
+ menu.add_item :responses,
128
+ I18n.t("responses", scope: "decidim.admin.menu.questions_submenu"),
129
+ decidim_admin_consultations.responses_path(current_participatory_space),
130
+ position: 1.0,
131
+ active: is_active_link?(decidim_admin_consultations.responses_path(current_participatory_space)) ||
132
+ is_active_link?(decidim_admin_consultations.response_groups_path(current_participatory_space)),
133
+ if: allowed_to?(:read, :response)
134
+
135
+ menu.add_item :components,
136
+ I18n.t("components", scope: "decidim.admin.menu.questions_submenu"),
137
+ decidim_admin_consultations.components_path(current_participatory_space),
138
+ position: 1.0,
139
+ active: is_active_link?(decidim_admin_consultations.components_path(current_participatory_space)),
140
+ if: allowed_to?(:read, :component),
141
+ submenu: { target_menu: :admin_consultation_components_menu, options: { container_options: { id: "components-list" } } }
142
+
143
+ menu.add_item :categories,
144
+ I18n.t("categories", scope: "decidim.admin.menu.questions_submenu"),
145
+ decidim_admin_consultations.categories_path(current_participatory_space),
146
+ position: 1.0,
147
+ active: is_active_link?(decidim_admin_consultations.categories_path(current_participatory_space)),
148
+ if: allowed_to?(:read, :category)
149
+ menu.add_item :question_attachments,
150
+ I18n.t("attachments", scope: "decidim.admin.menu.questions_submenu"),
151
+ decidim_admin_consultations.question_attachments_path(current_participatory_space),
152
+ position: 1.0,
153
+ active: is_active_link?(decidim_admin_consultations.question_attachments_path(current_participatory_space)),
154
+ if: allowed_to?(:read, :attachment)
155
+ end
156
+ end
157
+ initializer "decidim_consultations.admin_consultation_components_menu" do
158
+ Decidim.menu :admin_consultation_components_menu do |menu|
159
+ current_participatory_space.components.each do |component|
160
+ caption = translated_attribute(component.name)
161
+ if component.primary_stat.present?
162
+ caption += content_tag(:span, component.primary_stat, class: component.primary_stat.zero? ? "component-counter component-counter--off" : "component-counter")
163
+ end
164
+
165
+ menu.add_item [component.manifest_name, component.id].join("_"),
166
+ caption.html_safe,
167
+ manage_component_path(component),
168
+ active: is_active_link?(manage_component_path(component)) ||
169
+ is_active_link?(decidim_admin_consultations.edit_component_path(current_participatory_space, component)) ||
170
+ is_active_link?(decidim_admin_consultations.edit_component_permissions_path(current_participatory_space, component)),
171
+ if: component.manifest.admin_engine && user_role_config.component_is_accessible?(component.manifest_name)
172
+ end
88
173
  end
89
174
  end
90
175
  end
@@ -52,13 +52,6 @@ module Decidim
52
52
  end
53
53
  end
54
54
 
55
- initializer "decidim_consultations.assets" do |app|
56
- app.config.assets.precompile += %w(
57
- decidim_consultations_manifest.js
58
- decidim_consultations_manifest.css
59
- )
60
- end
61
-
62
55
  initializer "decidim.stats" do
63
56
  Decidim.stats.register :consultations_count, priority: StatsRegistry::HIGH_PRIORITY do |organization, _start_at, _end_at|
64
57
  Decidim::Consultation.where(organization: organization).published.count
@@ -72,11 +65,12 @@ module Decidim
72
65
 
73
66
  initializer "decidim_consultations.menu" do
74
67
  Decidim.menu :menu do |menu|
75
- menu.item I18n.t("menu.consultations", scope: "decidim"),
76
- decidim_consultations.consultations_path,
77
- position: 2.65,
78
- if: Decidim::Consultation.where(organization: current_organization).published.any?,
79
- active: :inclusive
68
+ menu.add_item :consultations,
69
+ I18n.t("menu.consultations", scope: "decidim"),
70
+ decidim_consultations.consultations_path,
71
+ position: 2.65,
72
+ if: Decidim::Consultation.where(organization: current_organization).published.any?,
73
+ active: :inclusive
80
74
  end
81
75
  end
82
76