decidim-proposals 0.24.0 → 0.25.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/proposals/cost_report_cell.rb +1 -1
  3. data/app/cells/decidim/proposals/proposal_m_cell.rb +4 -0
  4. data/app/cells/decidim/proposals/proposals_picker/show.erb +1 -1
  5. data/app/cells/decidim/proposals/proposals_picker_cell.rb +1 -1
  6. data/app/commands/decidim/proposals/admin/import_proposals.rb +21 -4
  7. data/app/controllers/decidim/proposals/admin/proposals_controller.rb +1 -1
  8. data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +2 -1
  9. data/app/controllers/decidim/proposals/proposals_controller.rb +1 -0
  10. data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +1 -0
  11. data/app/forms/decidim/proposals/admin/proposals_import_form.rb +6 -0
  12. data/app/forms/decidim/proposals/proposal_form.rb +7 -4
  13. data/app/helpers/decidim/proposals/map_helper.rb +5 -5
  14. data/app/helpers/decidim/proposals/participatory_texts_helper.rb +1 -1
  15. data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +0 -16
  16. data/app/models/decidim/proposals/proposal.rb +11 -1
  17. data/app/{assets → packs}/documents/decidim/proposals/participatory_texts/participatory_text.md +0 -0
  18. data/app/{assets → packs}/documents/decidim/proposals/participatory_texts/participatory_text.odt +0 -0
  19. data/app/packs/entrypoints/decidim_proposals.js +8 -0
  20. data/app/packs/entrypoints/decidim_proposals_admin.js +3 -0
  21. data/app/{assets/images/decidim/gamification/badges/accepted_proposals.svg → packs/images/decidim/gamification/badges/decidim_gamification_badges_accepted_proposals.svg} +0 -0
  22. data/app/{assets/images/decidim/gamification/badges/proposal_votes.svg → packs/images/decidim/gamification/badges/decidim_gamification_badges_proposal_votes.svg} +0 -0
  23. data/app/{assets/images/decidim/gamification/badges/proposals.svg → packs/images/decidim/gamification/badges/decidim_gamification_badges_proposals.svg} +0 -0
  24. data/app/{assets/images/decidim/proposals/icon.svg → packs/images/decidim/proposals/decidim_proposals.svg} +0 -0
  25. data/app/packs/src/decidim/proposals/add_proposal.js +49 -0
  26. data/app/packs/src/decidim/proposals/admin/proposals.js +143 -0
  27. data/app/{assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 → packs/src/decidim/proposals/admin/proposals_form.js} +6 -3
  28. data/app/{assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6 → packs/src/decidim/proposals/admin/proposals_picker.js} +0 -0
  29. data/app/{assets/javascripts/decidim/proposals/utils.js.es6 → packs/src/decidim/proposals/utils.js} +2 -2
  30. data/app/packs/stylesheets/decidim/proposals/_proposals.scss +1 -0
  31. data/app/{assets/stylesheets/decidim/proposals/proposals/_preview.css.scss → packs/stylesheets/decidim/proposals/proposals/_preview.scss} +0 -0
  32. data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +1 -1
  33. data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +1 -1
  34. data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +1 -1
  35. data/app/queries/decidim/proposals/similar_proposals.rb +1 -0
  36. data/app/services/decidim/proposals/collaborative_draft_search.rb +1 -1
  37. data/app/services/decidim/proposals/proposal_builder.rb +4 -4
  38. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +1 -1
  39. data/app/views/decidim/proposals/admin/proposals/index.html.erb +1 -1
  40. data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +6 -0
  41. data/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +1 -1
  42. data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +1 -1
  43. data/app/views/decidim/proposals/collaborative_drafts/index.html.erb +0 -2
  44. data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +1 -1
  45. data/app/views/decidim/proposals/proposals/_dynamic_map_instructions.html.erb +2 -1
  46. data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +5 -1
  47. data/app/views/decidim/proposals/proposals/_filters.html.erb +32 -34
  48. data/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +1 -1
  49. data/app/views/decidim/proposals/proposals/complete.html.erb +1 -1
  50. data/app/views/decidim/proposals/proposals/edit.html.erb +1 -1
  51. data/app/views/decidim/proposals/proposals/edit_draft.html.erb +1 -1
  52. data/app/views/decidim/proposals/proposals/index.html.erb +4 -6
  53. data/app/views/decidim/proposals/proposals/new.html.erb +1 -1
  54. data/app/views/decidim/proposals/proposals/preview.html.erb +7 -31
  55. data/config/assets.rb +10 -0
  56. data/config/locales/ar.yml +3 -1
  57. data/config/locales/bg.yml +3 -1
  58. data/config/locales/ca.yml +11 -5
  59. data/config/locales/cs.yml +38 -29
  60. data/config/locales/de.yml +10 -4
  61. data/config/locales/el.yml +3 -1
  62. data/config/locales/en.yml +12 -3
  63. data/config/locales/es-MX.yml +11 -4
  64. data/config/locales/es-PY.yml +11 -4
  65. data/config/locales/es.yml +14 -7
  66. data/config/locales/eu.yml +3 -1
  67. data/config/locales/fi-plain.yml +12 -3
  68. data/config/locales/fi.yml +12 -3
  69. data/config/locales/fr-CA.yml +8 -3
  70. data/config/locales/fr-LU.yml +903 -0
  71. data/config/locales/fr.yml +8 -3
  72. data/config/locales/gl.yml +11 -3
  73. data/config/locales/hu.yml +3 -1
  74. data/config/locales/id-ID.yml +3 -1
  75. data/config/locales/it.yml +55 -1
  76. data/config/locales/ja.yml +38 -1
  77. data/config/locales/lb-LU.yml +1 -0
  78. data/config/locales/lv.yml +3 -1
  79. data/config/locales/nl.yml +13 -2
  80. data/config/locales/no.yml +3 -1
  81. data/config/locales/pl.yml +34 -30
  82. data/config/locales/pt-BR.yml +199 -1
  83. data/config/locales/pt.yml +3 -1
  84. data/config/locales/ro-RO.yml +7 -1
  85. data/config/locales/ru.yml +3 -1
  86. data/config/locales/sk.yml +3 -1
  87. data/config/locales/sv.yml +38 -4
  88. data/config/locales/tr-TR.yml +3 -4
  89. data/config/locales/uk.yml +3 -1
  90. data/config/locales/zh-CN.yml +3 -1
  91. data/db/migrate/20201002085508_fix_proposals_data.rb +7 -8
  92. data/db/migrate/20210318082934_fix_counters_for_copied_proposals.rb +6 -5
  93. data/lib/decidim/proposals.rb +0 -1
  94. data/lib/decidim/proposals/admin_engine.rb +0 -4
  95. data/lib/decidim/proposals/commentable_proposal.rb +5 -13
  96. data/lib/decidim/proposals/component.rb +4 -4
  97. data/lib/decidim/proposals/engine.rb +14 -19
  98. data/lib/decidim/proposals/proposal_serializer.rb +1 -0
  99. data/lib/decidim/proposals/test/capybara_proposals_picker.rb +10 -0
  100. data/lib/decidim/proposals/test/factories.rb +3 -0
  101. data/lib/decidim/proposals/version.rb +1 -1
  102. metadata +39 -113
  103. data/app/assets/config/admin/decidim_proposals_manifest.js +0 -2
  104. data/app/assets/config/decidim_proposals_manifest.js +0 -4
  105. data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +0 -31
  106. data/app/assets/javascripts/decidim/proposals/admin/proposals.es6 +0 -130
  107. data/app/assets/stylesheets/decidim/proposals/_proposals.css.scss +0 -1
  108. data/config/locales/ja-JP.yml +0 -865
@@ -44,7 +44,9 @@ pt:
44
44
  invalid_document_type: 'Tipo de documento inválido. Os formatos aceites são: %{valid_mime_types}'
45
45
  proposal:
46
46
  attributes:
47
- attachment:
47
+ add_documents:
48
+ needs_to_be_reattached: Necessita de ser recolocado
49
+ add_photos:
48
50
  needs_to_be_reattached: Necessita de ser recolocado
49
51
  body:
50
52
  cant_be_equal_to_template: não pode ser igual ao modelo
@@ -35,6 +35,7 @@ ro:
35
35
  origin_component_id: Componentă pentru a copia propunerile de la
36
36
  proposals_import:
37
37
  import_proposals: Importă propuneri
38
+ keep_answers: Păstrați starea și răspunsurile
38
39
  keep_authors: Păstrează autorii originali
39
40
  valuation_assignment:
40
41
  admin_log:
@@ -47,7 +48,9 @@ ro:
47
48
  invalid_document_type: 'Tip de document invalid. Formatele acceptate sunt: %{valid_mime_types}'
48
49
  proposal:
49
50
  attributes:
50
- attachment:
51
+ add_documents:
52
+ needs_to_be_reattached: Trebuie să fie reatașate
53
+ add_photos:
51
54
  needs_to_be_reattached: Trebuie să fie reatașate
52
55
  body:
53
56
  cant_be_equal_to_template: nu poate fi egal cu șablonul
@@ -117,9 +120,11 @@ ro:
117
120
  proposals:
118
121
  actions:
119
122
  amend: Modifică
123
+ comment: Comentariu
120
124
  create: Crează
121
125
  endorse: Aprobare
122
126
  vote: Suport
127
+ vote_comment: Votează comentariul
123
128
  withdraw: Retragere
124
129
  name: Propuneri
125
130
  settings:
@@ -658,6 +663,7 @@ ro:
658
663
  success: Proiectul propunerii a fost şters cu succes.
659
664
  last_activity:
660
665
  new_proposal_at_html: "<span>Noua propunere la %{link}</span>"
666
+ proposal_updated_at_html: "<span>Propunere actualizată la %{link}</span>"
661
667
  models:
662
668
  collaborative_draft:
663
669
  fields:
@@ -19,7 +19,9 @@ ru:
19
19
  models:
20
20
  proposal:
21
21
  attributes:
22
- attachment:
22
+ add_documents:
23
+ needs_to_be_reattached: Необходимо заново прикрепить
24
+ add_photos:
23
25
  needs_to_be_reattached: Необходимо заново прикрепить
24
26
  models:
25
27
  decidim/proposals/accepted_proposal_event: Предложение принято
@@ -45,7 +45,9 @@ sk:
45
45
  invalid_document_type: 'Neplatný typ dokumentu. Prijateľné formáty sú: %{valid_mime_types} '
46
46
  proposal:
47
47
  attributes:
48
- attachment:
48
+ add_documents:
49
+ needs_to_be_reattached: Je potrebné priložiť znovu
50
+ add_photos:
49
51
  needs_to_be_reattached: Je potrebné priložiť znovu
50
52
  body:
51
53
  cant_be_equal_to_template: nemôže byť rovnaké, ako šablóna
@@ -10,7 +10,7 @@ sv:
10
10
  scope_id: Omfattning
11
11
  state: Status
12
12
  title: Titel
13
- user_group_id: Skapa gemensamt utkast som
13
+ user_group_id: Skapa samarbetsutkast som
14
14
  proposal:
15
15
  address: Adress
16
16
  answer: Svar
@@ -29,11 +29,13 @@ sv:
29
29
  answer: Svar
30
30
  cost: Kostnad
31
31
  cost_report: Kostnadsrapport
32
+ execution_period: Genomförandesperiod
32
33
  proposals_copy:
33
34
  copy_proposals: Jag förstår att detta kommer att importera alla förslag från den valda komponenten till den nuvarande och att den här åtgärden inte kan ångras.
34
35
  origin_component_id: Komponent att kopiera förslagen från
35
36
  proposals_import:
36
37
  import_proposals: Importera förslag
38
+ keep_answers: Behåll status och svar
37
39
  keep_authors: Behåll originalförfattare
38
40
  valuation_assignment:
39
41
  admin_log:
@@ -46,7 +48,9 @@ sv:
46
48
  invalid_document_type: 'Ogiltig dokumenttyp. Godkända format är: %{valid_mime_types}'
47
49
  proposal:
48
50
  attributes:
49
- attachment:
51
+ add_documents:
52
+ needs_to_be_reattached: Måste bifogas igen
53
+ add_photos:
50
54
  needs_to_be_reattached: Måste bifogas igen
51
55
  body:
52
56
  cant_be_equal_to_template: kan inte vara detsamma som mallen
@@ -112,9 +116,11 @@ sv:
112
116
  proposals:
113
117
  actions:
114
118
  amend: Ändra
119
+ comment: Kommentera
115
120
  create: Skapa
116
121
  endorse: Instäm
117
122
  vote: Stötta
123
+ vote_comment: Rösta på en kommentar
118
124
  withdraw: Dra tillbaka
119
125
  name: Förslag
120
126
  settings:
@@ -139,6 +145,10 @@ sv:
139
145
  participatory_texts_enabled_readonly: Det går inte att ändra denna inställning om det finns befintliga förslag. Skapa en ny `Förslagskomponent` om du vill aktivera funktionen, eller kasta alla importerade förslag under menyn `Deltagartexter` om du vill avaktivera den.
140
146
  proposal_answering_enabled: Aktiverat svar på förslag
141
147
  proposal_edit_before_minutes: Förslag kan redigeras av författare inom så här många minuter
148
+ proposal_edit_time: Redigering av förslag
149
+ proposal_edit_time_choices:
150
+ infinite: Tillåt redigering av förslag utan tidsbegränsning
151
+ limited: Tillåt redigering av förslag med tidsbegränsning
142
152
  proposal_length: Maximal längd på förslagets innehåll
143
153
  proposal_limit: Förslagsgräns per användare
144
154
  proposal_wizard_step_1_help_text: Hjälptext till steget "Skapa" i förslagsguiden
@@ -146,6 +156,8 @@ sv:
146
156
  proposal_wizard_step_3_help_text: Hjälptext till steget "Komplettera" i förslagsguiden
147
157
  proposal_wizard_step_4_help_text: Förslagsguidens hjälptext för steg "Publicera"
148
158
  resources_permissions_enabled: Åtgärdsbehörigheter kan ställas in för varje förslag
159
+ scope_id: Omfång
160
+ scopes_enabled: Omfång aktiverade
149
161
  threshold_per_proposal: Tröskel per förslag
150
162
  vote_limit: Stödgräns per deltagare
151
163
  step:
@@ -352,6 +364,7 @@ sv:
352
364
  actions:
353
365
  preview: Förhandsvisa
354
366
  exports:
367
+ proposal_comments: Kommentarer
355
368
  proposals: Förslag
356
369
  models:
357
370
  proposal:
@@ -375,7 +388,9 @@ sv:
375
388
  new_import:
376
389
  accepted_mime_types:
377
390
  md: Markdown
391
+ odt: ODT
378
392
  bottom_hint: "(Du kommer att kunna förhandsvisa och sortera dokumentavsnitt)"
393
+ document_legend: 'Lägg till ett dokument som är mindre än 2MB, varje avsnitt upp till 3 nivåers djup kommer läsas in till förslagen. Möjliga format är: %{valid_mime_types}'
379
394
  title: LÄGG TILL DOKUMENT
380
395
  upload_document: Skicka in dokument
381
396
  publish:
@@ -416,6 +431,7 @@ sv:
416
431
  form:
417
432
  attachment_legend: "(Valfritt) Lägg till en bilaga"
418
433
  created_in_meeting: Detta förslag kommer från ett möte
434
+ delete_attachment: Ta bort bilaga
419
435
  select_a_category: Välj en kategori
420
436
  select_a_meeting: Välj ett möte
421
437
  index:
@@ -490,6 +506,7 @@ sv:
490
506
  no_components: Det finns inga andra förslagskomponenter i detta deltagarutrymme att importera förslagen från.
491
507
  select_component: Välj en komponent
492
508
  select_states: Kontrollera status för förslagen som ska importeras
509
+ title: Importera förslag
493
510
  proposals_merges:
494
511
  create:
495
512
  invalid: Det gick inte att slå samman de valda förslagen.
@@ -642,6 +659,9 @@ sv:
642
659
  info: Du skapar ett <strong>gemensamt utkast</strong>.
643
660
  wizard_header:
644
661
  title: Skapa ditt gemensamma utkast
662
+ content_blocks:
663
+ highlighted_proposals:
664
+ proposals: Förslag
645
665
  create:
646
666
  error: Det gick inte att spara förslaget.
647
667
  success: Förslaget har skapats. Det är sparat som ett utkast.
@@ -650,6 +670,7 @@ sv:
650
670
  success: Utkastet till förslag har tagits bort.
651
671
  last_activity:
652
672
  new_proposal_at_html: "<span>Nytt förslag vid %{link}</span>"
673
+ proposal_updated_at_html: "<span>Förslag uppdaterades på %{link}</span>"
653
674
  models:
654
675
  collaborative_draft:
655
676
  fields:
@@ -695,10 +716,16 @@ sv:
695
716
  one: "%{count} förslag"
696
717
  other: "%{count} förslag"
697
718
  dynamic_map_instructions:
698
- instructions: <h3>Nu kan du dra markören och flytta den kartan. </h3><p>Glöm inte att klicka på knappen "Uppdatera position" innan du publicerar ditt förslag.</p>
719
+ description: Koordinaterna uppdateras när du klickar på knappen 'Förhandsgranska'. Adressen ändras dock inte.
720
+ instructions: Nu kan du flytta markören på kartan.
699
721
  edit:
722
+ add_documents: Dokument
723
+ add_images: Bild
700
724
  attachment_legend: "(Valfritt) Lägg till en bilaga"
701
725
  back: Tillbaka
726
+ delete_document: Radera dokument
727
+ delete_image: Radera bild
728
+ gallery_legend: "(Frivilligt) Lägg till en bild"
702
729
  select_a_category: Välj en kategori
703
730
  send: Skicka
704
731
  title: Redigera förslag
@@ -751,14 +778,17 @@ sv:
751
778
  document_index: Dokumentindex
752
779
  view_index:
753
780
  see_index: Visa index
781
+ placeholder:
782
+ address: Drottninggatan 23, 123 45 Stockholm
754
783
  preview:
784
+ announcement_body: Ditt förslag har sparats som ett utkast. Det måste publiceras för att det ska visas på webbplatsen.
785
+ announcement_title: Ditt förslag har ännu inte publicerats
755
786
  modify: Ändra förslaget
756
787
  proposal_edit_before_minutes:
757
788
  one: Du kommer att kunna redigera detta förslag under den första minuten efter att förslaget har publicerats. När det tidsfönstret har passerat kommer du inte att kunna redigera förslaget.
758
789
  other: Du kommer att kunna redigera förslaget upp till %{count} minuter efter att förslaget har publicerats. När det tidsfönstret passerat kommer du inte att kunna redigera förslaget.
759
790
  publish: Publicera
760
791
  title: Publicera ditt förslag
761
- update_position: Uppdatera position
762
792
  proposal:
763
793
  creation_date: 'Skapat: %{date}'
764
794
  view_proposal: Visa förslag
@@ -875,3 +905,7 @@ sv:
875
905
  included_proposals:
876
906
  proposal_project: 'Förslag som ingår i dessa projekt:'
877
907
  proposal_result: 'Förslag som ingår i dessa resultat:'
908
+ statistics:
909
+ proposals_accepted: Godkända Förslag
910
+ proposals_count: Förslag
911
+ supports_count: Stöd
@@ -47,7 +47,9 @@ tr:
47
47
  invalid_document_type: 'Geçersiz doküman tipi. Kabul edilen formatlar: %{valid_mime_types}'
48
48
  proposal:
49
49
  attributes:
50
- attachment:
50
+ add_documents:
51
+ needs_to_be_reattached: Yeniden eklenmesi gerekiyor
52
+ add_photos:
51
53
  needs_to_be_reattached: Yeniden eklenmesi gerekiyor
52
54
  body:
53
55
  cant_be_equal_to_template: şablona eşit olamaz
@@ -704,8 +706,6 @@ tr:
704
706
  proposals_count:
705
707
  one: "%{count} teklif"
706
708
  other: "%{count} teklif"
707
- dynamic_map_instructions:
708
- instructions: <h3> Noktayı harita üzerinde hareket ettirebilirsiniz. </h3> <p> Teklifinizi yayınlamadan önce "Pozisyonu Güncelle" düğmesini tıklamayı unutmayın. </p>
709
709
  edit:
710
710
  add_documents: Dokümanlar
711
711
  add_images: Dosya
@@ -775,7 +775,6 @@ tr:
775
775
  other: Bu teklifi, teklif yayınlandıktan sonraki ilk %{count} dakika içinde düzenleyebileceksiniz. Bu zaman aralığı geçtikten sonra teklifi düzenleyemezsiniz.
776
776
  publish: Yayınla
777
777
  title: Teklifinizi yayınlayın
778
- update_position: Konumu güncelle
779
778
  proposal:
780
779
  creation_date: 'Oluşturma: %{date}'
781
780
  view_proposal: Teklifi görüntüle
@@ -19,7 +19,9 @@ uk:
19
19
  models:
20
20
  proposal:
21
21
  attributes:
22
- attachment:
22
+ add_documents:
23
+ needs_to_be_reattached: Необхідно повторно вкласти
24
+ add_photos:
23
25
  needs_to_be_reattached: Необхідно повторно вкласти
24
26
  models:
25
27
  decidim/proposals/accepted_proposal_event: Пропозиція прийнята
@@ -44,7 +44,9 @@ zh-CN:
44
44
  invalid_document_type: '无效的文档类型。接受的格式为: %{valid_mime_types}'
45
45
  proposal:
46
46
  attributes:
47
- attachment:
47
+ add_documents:
48
+ needs_to_be_reattached: 需要重新连接
49
+ add_photos:
48
50
  needs_to_be_reattached: 需要重新连接
49
51
  body:
50
52
  cant_be_equal_to_template: 不能等于模板
@@ -12,14 +12,13 @@ class FixProposalsData < ActiveRecord::Migration[5.2]
12
12
 
13
13
  locale = author.try(:locale).presence || author.try(:default_locale).presence || author.try(:organization).try(:default_locale).presence
14
14
 
15
- proposal.title = {
16
- locale => proposal.title
17
- }
18
- proposal.body = {
19
- locale => proposal.body
20
- }
21
-
22
- proposal.save!
15
+ # rubocop:disable Rails/SkipsModelValidations
16
+ values = {}
17
+ values[:title] = { locale => proposal.title } unless proposal.title.is_a?(Hash)
18
+ values[:body] = { locale => proposal.body } unless proposal.body.is_a?(Hash)
19
+
20
+ proposal.update_columns(values)
21
+ # rubocop:enable Rails/SkipsModelValidations
23
22
  end
24
23
  end
25
24
 
@@ -2,11 +2,12 @@
2
2
 
3
3
  class FixCountersForCopiedProposals < ActiveRecord::Migration[5.2]
4
4
  def up
5
- copies_ids = Decidim::ResourceLink.where(
6
- name: "copied_from_component",
7
- from_type: "Decidim::Proposals::Proposal",
8
- to_type: "Decidim::Proposals::Proposal"
9
- ).pluck(:to_id)
5
+ copies_ids = Decidim::ResourceLink
6
+ .where(
7
+ name: "copied_from_component",
8
+ from_type: "Decidim::Proposals::Proposal",
9
+ to_type: "Decidim::Proposals::Proposal"
10
+ ).pluck(:to_id)
10
11
 
11
12
  Decidim::Proposals::Proposal.where(id: copies_ids).find_each do |record|
12
13
  record.class.reset_counters(record.id, :follows)
@@ -5,7 +5,6 @@ require "decidim/proposals/api"
5
5
  require "decidim/proposals/engine"
6
6
  require "decidim/proposals/admin_engine"
7
7
  require "decidim/proposals/component"
8
- require "acts_as_list"
9
8
 
10
9
  module Decidim
11
10
  # This namespace holds the logic of the `Proposals` component. This component
@@ -38,10 +38,6 @@ module Decidim
38
38
  root to: "proposals#index"
39
39
  end
40
40
 
41
- initializer "decidim_proposals.admin_assets" do |app|
42
- app.config.assets.precompile += %w(admin/decidim_proposals_manifest.js)
43
- end
44
-
45
41
  def load_seed
46
42
  nil
47
43
  end
@@ -5,19 +5,9 @@ module Decidim
5
5
  # The data store for a Proposal in the Decidim::Proposals component.
6
6
  module CommentableProposal
7
7
  extend ActiveSupport::Concern
8
- include Decidim::Comments::Commentable
8
+ include Decidim::Comments::CommentableWithComponent
9
9
 
10
10
  included do
11
- # Public: Overrides the `commentable?` Commentable concern method.
12
- def commentable?
13
- component.settings.comments_enabled?
14
- end
15
-
16
- # Public: Overrides the `accepts_new_comments?` Commentable concern method.
17
- def accepts_new_comments?
18
- commentable? && !component.current_settings.comments_blocked
19
- end
20
-
21
11
  # Public: Overrides the `comments_have_alignment?` Commentable concern method.
22
12
  def comments_have_alignment?
23
13
  true
@@ -35,8 +25,10 @@ module Decidim
35
25
  followers
36
26
  end
37
27
 
38
- def user_allowed_to_comment?(user)
39
- can_participate_in_space?(user)
28
+ def user_allowed_to_vote_comment?(user)
29
+ return unless can_participate_in_space?(user)
30
+
31
+ ActionAuthorizer.new(user, "vote_comment", component, self).authorize.ok?
40
32
  end
41
33
  end
42
34
  end
@@ -6,7 +6,7 @@ Decidim.register_component(:proposals) do |component|
6
6
  component.engine = Decidim::Proposals::Engine
7
7
  component.admin_engine = Decidim::Proposals::AdminEngine
8
8
  component.stylesheet = "decidim/proposals/proposals"
9
- component.icon = "decidim/proposals/icon.svg"
9
+ component.icon = "media/images/decidim_proposals.svg"
10
10
 
11
11
  component.on(:before_destroy) do |instance|
12
12
  raise "Can't destroy this component when there are proposals" if Decidim::Proposals::Proposal.where(component: instance).any?
@@ -16,7 +16,7 @@ Decidim.register_component(:proposals) do |component|
16
16
 
17
17
  component.newsletter_participant_entities = ["Decidim::Proposals::Proposal"]
18
18
 
19
- component.actions = %w(endorse vote create withdraw amend)
19
+ component.actions = %w(endorse vote create withdraw amend comment vote_comment)
20
20
 
21
21
  component.query_type = "Decidim::Proposals::ProposalsType"
22
22
 
@@ -83,7 +83,7 @@ Decidim.register_component(:proposals) do |component|
83
83
  resource.template = "decidim/proposals/proposals/linked_proposals"
84
84
  resource.card = "decidim/proposals/proposal"
85
85
  resource.reported_content_cell = "decidim/proposals/reported_content"
86
- resource.actions = %w(endorse vote amend)
86
+ resource.actions = %w(endorse vote amend comment vote_comment)
87
87
  resource.searchable = true
88
88
  end
89
89
 
@@ -108,7 +108,7 @@ Decidim.register_component(:proposals) do |component|
108
108
 
109
109
  component.register_stat :endorsements_count, priority: Decidim::StatsRegistry::MEDIUM_PRIORITY do |components, start_at, end_at|
110
110
  proposals = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).not_hidden
111
- Decidim::Endorsement.where(resource_id: proposals.pluck(:id), resource_type: Decidim::Proposals::Proposal.name).count
111
+ proposals.sum(:endorsements_count)
112
112
  end
113
113
 
114
114
  component.register_stat :comments_count, tag: :comments do |components, start_at, end_at|
@@ -1,11 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "kaminari"
4
- require "social-share-button"
5
- require "ransack"
6
- require "cells/rails"
7
- require "cells-erb"
8
- require "cell/partial"
3
+ require "decidim/core"
9
4
 
10
5
  module Decidim
11
6
  module Proposals
@@ -44,10 +39,6 @@ module Decidim
44
39
  root to: "proposals#index"
45
40
  end
46
41
 
47
- initializer "decidim_proposals.assets" do |app|
48
- app.config.assets.precompile += %w(decidim_proposals_manifest.js)
49
- end
50
-
51
42
  initializer "decidim.content_processors" do |_app|
52
43
  Decidim.configure do |config|
53
44
  config.content_processors += [:proposal]
@@ -61,19 +52,23 @@ module Decidim
61
52
  end
62
53
 
63
54
  initializer "decidim_changes" do
64
- Decidim::SettingsChange.subscribe "surveys" do |changes|
65
- Decidim::Proposals::SettingsChangeJob.perform_later(
66
- changes[:component_id],
67
- changes[:previous_settings],
68
- changes[:current_settings]
69
- )
55
+ config.to_prepare do
56
+ Decidim::SettingsChange.subscribe "surveys" do |changes|
57
+ Decidim::Proposals::SettingsChangeJob.perform_later(
58
+ changes[:component_id],
59
+ changes[:previous_settings],
60
+ changes[:current_settings]
61
+ )
62
+ end
70
63
  end
71
64
  end
72
65
 
73
66
  initializer "decidim_proposals.mentions_listener" do
74
- Decidim::Comments::CommentCreation.subscribe do |data|
75
- proposals = data.dig(:metadatas, :proposal).try(:linked_proposals)
76
- Decidim::Proposals::NotifyProposalsMentionedJob.perform_later(data[:comment_id], proposals) if proposals
67
+ config.to_prepare do
68
+ Decidim::Comments::CommentCreation.subscribe do |data|
69
+ proposals = data.dig(:metadatas, :proposal).try(:linked_proposals)
70
+ Decidim::Proposals::NotifyProposalsMentionedJob.perform_later(data[:comment_id], proposals) if proposals
71
+ end
77
72
  end
78
73
  end
79
74