decidim-proposals 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/admin/decidim_proposals_manifest.js +1 -0
  3. data/app/assets/images/decidim/gamification/badges/accepted_proposals.svg +1 -234
  4. data/app/assets/images/decidim/gamification/badges/proposal_votes.svg +1 -95
  5. data/app/assets/images/decidim/gamification/badges/proposals.svg +1 -229
  6. data/app/assets/images/decidim/proposals/icon.svg +1 -3
  7. data/app/assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 +0 -5
  8. data/app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6 +35 -0
  9. data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +1 -1
  10. data/app/cells/decidim/proposals/collaborative_draft_m/footer.erb +1 -1
  11. data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -1
  12. data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +3 -3
  13. data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +1 -1
  14. data/app/cells/decidim/proposals/irreversible_action_modal/show.erb +2 -2
  15. data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +1 -1
  16. data/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb +1 -1
  17. data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +1 -1
  18. data/app/cells/decidim/proposals/proposal_m/footer.erb +4 -1
  19. data/app/cells/decidim/proposals/proposal_m_cell.rb +28 -8
  20. data/app/cells/decidim/proposals/proposal_tags/show.erb +8 -2
  21. data/app/cells/decidim/proposals/proposals_picker/proposals.erb +12 -0
  22. data/app/cells/decidim/proposals/proposals_picker/show.erb +14 -0
  23. data/app/cells/decidim/proposals/proposals_picker_cell.rb +72 -0
  24. data/app/commands/decidim/proposals/admin/create_proposal.rb +1 -1
  25. data/app/commands/decidim/proposals/admin/create_proposal_note.rb +15 -0
  26. data/app/commands/decidim/proposals/admin/update_proposal.rb +1 -1
  27. data/app/commands/decidim/proposals/create_collaborative_draft.rb +1 -1
  28. data/app/commands/decidim/proposals/create_proposal.rb +1 -1
  29. data/app/commands/decidim/proposals/gallery_methods.rb +2 -51
  30. data/app/commands/decidim/proposals/update_proposal.rb +1 -1
  31. data/app/controllers/concerns/decidim/proposals/admin/picker.rb +21 -0
  32. data/app/controllers/concerns/decidim/proposals/orderable.rb +1 -1
  33. data/app/controllers/decidim/proposals/proposals_controller.rb +4 -5
  34. data/app/controllers/decidim/proposals/versions_controller.rb +8 -18
  35. data/app/events/decidim/proposals/admin/proposal_note_created_event.rb +27 -0
  36. data/app/forms/decidim/proposals/admin/participatory_text_proposal_form.rb +13 -0
  37. data/app/forms/decidim/proposals/admin/preview_participatory_text_form.rb +2 -2
  38. data/app/forms/decidim/proposals/admin/proposal_base_form.rb +129 -0
  39. data/app/forms/decidim/proposals/admin/proposal_form.rb +2 -120
  40. data/app/forms/decidim/proposals/proposal_form.rb +4 -0
  41. data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +5 -1
  42. data/app/helpers/decidim/proposals/admin/filterable_helper.rb +2 -2
  43. data/app/helpers/decidim/proposals/admin/proposal_rankings_helper.rb +2 -2
  44. data/app/helpers/decidim/proposals/admin/proposals_picker_helper.rb +30 -0
  45. data/app/helpers/decidim/proposals/application_helper.rb +6 -6
  46. data/app/helpers/decidim/proposals/control_version_helper.rb +1 -37
  47. data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +0 -145
  48. data/app/helpers/decidim/proposals/proposal_votes_helper.rb +2 -2
  49. data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +24 -7
  50. data/app/helpers/decidim/proposals/proposals_helper.rb +6 -0
  51. data/app/models/decidim/proposals/proposal.rb +4 -14
  52. data/app/permissions/decidim/proposals/permissions.rb +1 -22
  53. data/app/presenters/decidim/proposals/proposal_presenter.rb +14 -2
  54. data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +1 -2
  55. data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +15 -12
  56. data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +5 -4
  57. data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +2 -8
  58. data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +3 -9
  59. data/app/services/decidim/proposals/diff_renderer.rb +2 -0
  60. data/app/services/decidim/proposals/proposal_builder.rb +1 -1
  61. data/app/services/decidim/proposals/proposal_search.rb +2 -2
  62. data/app/types/decidim/proposals/proposal_input_sort.rb +1 -7
  63. data/app/types/decidim/proposals/proposal_type.rb +1 -11
  64. data/app/types/decidim/proposals/proposals_type.rb +10 -0
  65. data/app/validators/proposal_length_validator.rb +38 -0
  66. data/app/views/decidim/proposals/admin/participatory_texts/index.html.erb +9 -1
  67. data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +2 -2
  68. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +3 -23
  69. data/app/views/decidim/proposals/admin/proposals/index.html.erb +1 -1
  70. data/app/views/decidim/proposals/admin/proposals/show.html.erb +1 -1
  71. data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +6 -4
  72. data/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +9 -7
  73. data/app/views/decidim/proposals/collaborative_drafts/_new_collaborative_draft_button.html.erb +4 -4
  74. data/app/views/decidim/proposals/collaborative_drafts/_reject_request_access_form.html.erb +1 -1
  75. data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +4 -2
  76. data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +2 -0
  77. data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +2 -0
  78. data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +3 -1
  79. data/app/views/decidim/proposals/collaborative_drafts/index.html.erb +4 -2
  80. data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +4 -0
  81. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +29 -30
  82. data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +5 -3
  83. data/app/views/decidim/proposals/proposals/_endorsements_card_row.html.erb +0 -16
  84. data/app/views/decidim/proposals/proposals/_filters.html.erb +12 -10
  85. data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +1 -11
  86. data/app/views/decidim/proposals/proposals/_proposal_similar.html.erb +2 -2
  87. data/app/views/decidim/proposals/proposals/_proposals.html.erb +14 -0
  88. data/app/views/decidim/proposals/proposals/_vote_button.html.erb +13 -6
  89. data/app/views/decidim/proposals/proposals/_wizard_aside.html.erb +4 -2
  90. data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +4 -3
  91. data/app/views/decidim/proposals/proposals/compare.html.erb +2 -0
  92. data/app/views/decidim/proposals/proposals/complete.html.erb +2 -0
  93. data/app/views/decidim/proposals/proposals/edit.html.erb +3 -1
  94. data/app/views/decidim/proposals/proposals/edit_draft.html.erb +2 -0
  95. data/app/views/decidim/proposals/proposals/index.html.erb +5 -10
  96. data/app/views/decidim/proposals/proposals/new.html.erb +5 -1
  97. data/app/views/decidim/proposals/proposals/participatory_texts/_index.html.erb +1 -1
  98. data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +10 -3
  99. data/app/views/decidim/proposals/proposals/participatory_texts/_view_index.html.erb +1 -1
  100. data/app/views/decidim/proposals/proposals/preview.html.erb +7 -8
  101. data/app/views/decidim/proposals/proposals/show.html.erb +52 -34
  102. data/app/views/decidim/proposals/versions/index.html.erb +14 -32
  103. data/app/views/decidim/proposals/versions/show.html.erb +16 -34
  104. data/config/locales/ar.yml +8 -64
  105. data/config/locales/bg-BG.yml +237 -0
  106. data/config/locales/ca.yml +68 -61
  107. data/config/locales/cs.yml +78 -68
  108. data/config/locales/da-DK.yml +1 -0
  109. data/config/locales/de.yml +142 -58
  110. data/config/locales/el.yml +875 -0
  111. data/config/locales/en.yml +74 -67
  112. data/config/locales/es-MX.yml +68 -61
  113. data/config/locales/es-PY.yml +68 -61
  114. data/config/locales/es.yml +68 -61
  115. data/config/locales/et-EE.yml +1 -0
  116. data/config/locales/eu.yml +5 -43
  117. data/config/locales/fi-plain.yml +68 -61
  118. data/config/locales/fi.yml +109 -102
  119. data/config/locales/fr-CA.yml +876 -0
  120. data/config/locales/fr.yml +128 -60
  121. data/config/locales/ga-IE.yml +1 -0
  122. data/config/locales/gl.yml +5 -43
  123. data/config/locales/hr-HR.yml +1 -0
  124. data/config/locales/hu.yml +38 -61
  125. data/config/locales/id-ID.yml +5 -42
  126. data/config/locales/is-IS.yml +1 -27
  127. data/config/locales/it.yml +136 -76
  128. data/config/locales/ja-JP.yml +886 -0
  129. data/config/locales/lt-LT.yml +1 -0
  130. data/config/locales/lv-LV.yml +858 -0
  131. data/config/locales/mt-MT.yml +1 -0
  132. data/config/locales/nl.yml +114 -59
  133. data/config/locales/no.yml +11 -64
  134. data/config/locales/pl.yml +170 -60
  135. data/config/locales/pt-BR.yml +6 -47
  136. data/config/locales/pt.yml +419 -331
  137. data/config/locales/ro-RO.yml +840 -0
  138. data/config/locales/ru.yml +1 -40
  139. data/config/locales/sk-SK.yml +896 -0
  140. data/config/locales/sk.yml +869 -0
  141. data/config/locales/sl.yml +26 -0
  142. data/config/locales/sr-CS.yml +126 -0
  143. data/config/locales/sv.yml +228 -156
  144. data/config/locales/tr-TR.yml +5 -43
  145. data/config/locales/uk.yml +1 -40
  146. data/db/migrate/20181003074440_fix_user_groups_ids_in_proposals_endorsements.rb +4 -0
  147. data/db/migrate/20191206154128_add_endorsements_counter_cache_to_proposals.rb +7 -0
  148. data/db/migrate/20200120215928_move_proposal_endorsements_to_core_endorsements.rb +52 -0
  149. data/db/migrate/20200730131631_move_proposal_endorsed_event_notifications_to_resource_endorsed_event.rb +20 -0
  150. data/lib/decidim/proposals/component.rb +8 -4
  151. data/lib/decidim/proposals/engine.rb +1 -5
  152. data/lib/decidim/proposals/test/capybara_proposals_picker.rb +49 -0
  153. data/lib/decidim/proposals/test/factories.rb +3 -12
  154. data/lib/decidim/proposals/version.rb +1 -1
  155. metadata +55 -34
  156. data/app/assets/javascripts/decidim/proposals/identity_selector_dialog.js.es6 +0 -56
  157. data/app/cells/decidim/proposals/endorsers_list/show.erb +0 -17
  158. data/app/cells/decidim/proposals/endorsers_list_cell.rb +0 -31
  159. data/app/commands/decidim/proposals/attachment_methods.rb +0 -43
  160. data/app/commands/decidim/proposals/endorse_proposal.rb +0 -59
  161. data/app/commands/decidim/proposals/unendorse_proposal.rb +0 -40
  162. data/app/controllers/decidim/proposals/proposal_endorsements_controller.rb +0 -60
  163. data/app/models/decidim/proposals/proposal_endorsement.rb +0 -37
  164. data/app/views/decidim/proposals/proposal_endorsements/_identity.html.erb +0 -9
  165. data/app/views/decidim/proposals/proposal_endorsements/identities.html.erb +0 -12
  166. data/app/views/decidim/proposals/proposal_endorsements/update_buttons_and_counters.js.erb +0 -20
  167. data/app/views/decidim/proposals/proposals/_endorsement_button.html.erb +0 -11
  168. data/app/views/decidim/proposals/proposals/_endorsement_identities_cabin.html.erb +0 -13
  169. data/app/views/decidim/proposals/versions/_version.html.erb +0 -20
@@ -50,7 +50,6 @@ tr:
50
50
  decidim/proposals/creation_enabled_event: Teklif oluşturma etkin
51
51
  decidim/proposals/endorsing_enabled_event: Teklif onayı etkin
52
52
  decidim/proposals/evaluating_proposal_event: Teklif değerlendiriliyor
53
- decidim/proposals/proposal_endorsed_event: Teklif onaylandı
54
53
  decidim/proposals/proposal_mentioned_event: Bahsi geçen teklif
55
54
  decidim/proposals/publish_proposal_event: Teklif yayınlandı
56
55
  decidim/proposals/rejected_proposal_event: Teklif reddedildi
@@ -63,9 +62,6 @@ tr:
63
62
  decidim/proposals/proposal:
64
63
  one: öneri
65
64
  other: Teklif
66
- decidim/proposals/proposal_endorsement:
67
- one: ciro
68
- other: Cirolar
69
65
  decidim/proposals/proposal_note:
70
66
  one: Not
71
67
  other: notlar
@@ -191,11 +187,6 @@ tr:
191
187
  email_outro: Bu bildirimi "%{resource_title}" takip ettiğiniz için aldınız. Bir önceki bağlantıdan takip etmeyi bırakabilirsiniz.
192
188
  email_subject: Takip ettiğiniz bir teklif kabul edildi
193
189
  notification_title: <a href="%{resource_path}">%{resource_title}</a> teklif kabul edildi.
194
- proposal_endorsed:
195
- email_intro: 'Takip ettiğiniz %{endorser_name} %{endorser_nickname}, "%{resource_title}" teklifini onayladı ve sizin için ilginç olabileceğini düşünüyoruz. Bir göz atın ve katkıda bulunun:'
196
- email_outro: Bu bildirimi, %{endorser_nickname}izlediğiniz için aldınız. Önceki bağlantıyı takip ederek bildirimleri almayı durdurabilirsiniz.
197
- email_subject: "%{endorser_nickname} yeni bir teklifi onayladı"
198
- notification_title: <a href="%{resource_path}">%{resource_title}</a> teklif <a href="%{endorser_path}">%{endorser_name} %{endorser_nickname}</a>tarafından onaylanmıştır.
199
190
  proposal_evaluating:
200
191
  affected_user:
201
192
  email_intro: 'Şu anda "%{resource_title}" teklifiniz değerlendiriliyor. Bu sayfadaki cevabı kontrol edebilirsiniz:'
@@ -550,14 +541,11 @@ tr:
550
541
  one: ve %{count} kişi daha
551
542
  other: ve %{count} kişi daha
552
543
  info-message: Bu, bir teklif için <strong>ortak çalışma taslağı</strong> . Bu, yazarlarının aşağıdaki yorum bölümünü kullanarak teklifi şekillendirmesine yardımcı olabilir veya düzenleme için erişim isteğinde bulunarak doğrudan iyileştirebilirsiniz. Yazarlar size erişim izni verdiğinde, bu taslakta değişiklikler yapabileceksiniz.
553
- of_versions: "( %{number})"
554
544
  publish: Yayınla
555
545
  publish_info: Taslak bu sürümünü yayınlayın veya
556
546
  published_proposal: yayınlanan teklif
557
547
  request_access: Erişim talep etmek
558
548
  requested_access: Erişim istendi
559
- see_other_versions: diğer versiyonları gör
560
- version: Sürüm %{number}
561
549
  version_history: bu teklifin sürüm geçmişini gör
562
550
  withdraw: taslağı geri çekmek
563
551
  states:
@@ -594,7 +582,6 @@ tr:
594
582
  fields:
595
583
  category: Kategori
596
584
  comments: Yorumlar
597
- endorsements: Cirolar
598
585
  id: İD
599
586
  notes: notlar
600
587
  official_proposal: Resmi teklif
@@ -611,19 +598,6 @@ tr:
611
598
  amend: değiştirmek
612
599
  comment: Yorum Yap
613
600
  comments: Yorumlar
614
- endorse: desteklemek
615
- proposal_endorsements:
616
- create:
617
- error: Teklifin onaylanması sırasında hatalar oluştu.
618
- identities:
619
- done: tamam
620
- select_identity: Kimlik seç
621
- proposal_endorsements_helper:
622
- endorsement_button:
623
- already_endorsed: Onaylanan
624
- endorse: desteklemek
625
- render_endorsements_button_card_part:
626
- endorse: desteklemek
627
601
  proposal_votes:
628
602
  create:
629
603
  error: Teklif oylanırken hatalar oluştu.
@@ -650,10 +624,6 @@ tr:
650
624
  discard_confirmation: Bu teklif taslağını silmek istediğinizden emin misiniz?
651
625
  send: Ön izleme
652
626
  title: Teklif Taslaklarını Düzenle
653
- endorsement_identities_cabin:
654
- endorse: desteklemek
655
- endorsements_card_row:
656
- comments: Yorumlar
657
627
  filters:
658
628
  amendment_type: tip
659
629
  category: Kategori
@@ -704,6 +674,7 @@ tr:
704
674
  show:
705
675
  answer: Cevap
706
676
  back_to: Geri
677
+ comments: Yorumlar
707
678
  edit_proposal: Teklifi düzenle
708
679
  endorsements_list: Onay Listesi
709
680
  hidden_endorsers_count:
@@ -717,7 +688,6 @@ tr:
717
688
  proposal_rejected_reason: 'Bu teklif reddedildi çünkü:'
718
689
  report: Rapor
719
690
  withdraw_btn_hint: Herhangi bir destek almadığınız sürece fikrinizi değiştirirseniz teklifinizi geri çekebilirsiniz. Teklif silinmemiş, iptal edilen teklifler listesinde görünecektir.
720
- withdraw_confirmation: Bu teklifi geri çektiğinizden emin misiniz?
721
691
  withdraw_proposal: Teklifi geri çek
722
692
  vote_button:
723
693
  already_voted: Çoktan oy verildi
@@ -768,20 +738,12 @@ tr:
768
738
  error: Teklif taslağını kaydederken hatalar oluştu.
769
739
  success: Teklif taslağı başarıyla güncellendi.
770
740
  versions:
771
- changes_at_title: '"%{title}" daki değişiklikler'
741
+ collaborative_drafts:
742
+ back_to_resource: İşbirliği taslağına geri dönün
772
743
  index:
773
744
  title: Sürümler
774
- stats:
775
- back_to_collaborative_draft: İşbirliği taslağına geri dönün
776
- back_to_proposal: Teklife geri dön
777
- number_of_versions: Sürümler
778
- show_all_versions: Tüm versiyonları göster
779
- version_author: Sürüm yazarı
780
- version_created_at: Sürümde oluşturuldu
781
- version_number: Versiyon numarası
782
- version_number_out_of_total: "%{current_version} üzerinden %{total_count}"
783
- version:
784
- version_index: Sürüm %{index}
745
+ proposals:
746
+ back_to_resource: Teklife geri dön
785
747
  withdraw:
786
748
  errors:
787
749
  has_supports: Zaten destekleri olduğu için bu teklif geri çekilemez.
@@ -27,7 +27,6 @@ uk:
27
27
  decidim/proposals/creation_enabled_event: Внесення пропозицій увімкнено
28
28
  decidim/proposals/endorsing_enabled_event: Увімкнене надання підтримки пропозиціям
29
29
  decidim/proposals/evaluating_proposal_event: Пропозиція розглядається
30
- decidim/proposals/proposal_endorsed_event: Пропозицію підтримано
31
30
  decidim/proposals/proposal_mentioned_event: Пропозицію було згадано
32
31
  decidim/proposals/publish_proposal_event: Пропозицію оприлюднено
33
32
  decidim/proposals/rejected_proposal_event: Пропозицію відхилено
@@ -39,11 +38,6 @@ uk:
39
38
  few: Пропозиції
40
39
  many: Пропозицій
41
40
  other: Пропозицій
42
- decidim/proposals/proposal_endorsement:
43
- one: Прояв підтримки
44
- few: Прояви підтримки
45
- many: Проявів підтримки
46
- other: Проявів підтримки
47
41
  decidim/proposals/proposal_note:
48
42
  one: Примітка
49
43
  few: Примітки
@@ -55,18 +49,6 @@ uk:
55
49
  many: Голосів
56
50
  other: Голосів
57
51
  decidim:
58
- admin:
59
- filters:
60
- is_emendation_true:
61
- values:
62
- 'false': Пропозиції
63
- state_eq:
64
- values:
65
- evaluating: Розглядається
66
- withdrawn: Відкликана
67
- state_null:
68
- values:
69
- 'true': Без відповідей
70
52
  components:
71
53
  proposals:
72
54
  actions:
@@ -123,10 +105,6 @@ uk:
123
105
  email_outro: Ви отримали це сповіщення, тому що ви стежите за "%{resource_title}". Ви можете припинити стежити за ним, перейшовши за наведеним вище посиланням.
124
106
  email_subject: Пропозиція, за якою ви стежите, була прийнята
125
107
  notification_title: Пропозицію <a href="%{resource_path}">%{resource_title}</a> було прийнято.
126
- proposal_endorsed:
127
- email_outro: Ви отримали це сповіщення, тому що ви стежите за %{endorser_nickname}. Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
128
- email_subject: "%{endorser_nickname} підтримав нову пропозицію"
129
- notification_title: <a href="%{endorser_path}">%{endorser_name} %{endorser_nickname}</a> підтримав пропозицію <a href="%{resource_path}">%{resource_title}</a>.
130
108
  proposal_evaluating:
131
109
  follower:
132
110
  email_intro: 'Пропозиція "%{resource_title}" зараз розглядається. Ви можете перевірити наявність відповіді на сторінці:'
@@ -264,7 +242,6 @@ uk:
264
242
  fields:
265
243
  category: Категорія
266
244
  comments: Коментарі
267
- endorsements: Прояви підтримки
268
245
  id: Псевдонім
269
246
  notes: Примітки
270
247
  official_proposal: Службова пропозиція
@@ -275,18 +252,6 @@ uk:
275
252
  votes: Голоси
276
253
  new:
277
254
  limit_reached: Ви не можете вносити нові пропозиції, оскільки ви перевищили ліміт.
278
- proposal_endorsements:
279
- create:
280
- error: При спробі надати підтримку цій пропозиції виникла помилка.
281
- identities:
282
- done: Зроблено
283
- select_identity: Оберіть роль
284
- proposal_endorsements_helper:
285
- endorsement_button:
286
- already_endorsed: Підтримано
287
- endorse: Підтримати
288
- render_endorsements_button_card_part:
289
- endorse: Підтримати
290
255
  proposal_votes:
291
256
  create:
292
257
  error: При голосуванні щодо пропозиції сталися помилки.
@@ -308,10 +273,6 @@ uk:
308
273
  discard_confirmation: Ви дійсно бажаєте відкинути чернетку цієї пропозиції?
309
274
  send: Попередній перегляд
310
275
  title: Редагувати чернетку пропозиції
311
- endorsement_identities_cabin:
312
- endorse: Підтримати
313
- endorsements_card_row:
314
- comments: Коментарі
315
276
  filters:
316
277
  category: Категорія
317
278
  origin: Джерело
@@ -356,6 +317,7 @@ uk:
356
317
  view_proposal: Переглянути пропозицію
357
318
  show:
358
319
  answer: Відповісти
320
+ comments: Коментарі
359
321
  edit_proposal: Редагувати пропозицію
360
322
  endorsements_list: Перелік тих, хто підтримав
361
323
  proposal_accepted_reason: 'Ця пропозиція була прийнята, тому що:'
@@ -363,7 +325,6 @@ uk:
363
325
  proposal_rejected_reason: 'Ця пропозиція була відхилена, оскільки:'
364
326
  report: Поскаржитись
365
327
  withdraw_btn_hint: Ви можете зняти свою пропозицію, якщо ви передумали, доки ви не отримали жодної підтримки. Пропозиція не видаляється, вона з'явиться у списку відкликаних пропозицій.
366
- withdraw_confirmation: Ви впевнені, що бажаєте зняти цю пропозицію?
367
328
  withdraw_proposal: Зняти пропозицію
368
329
  vote_button:
369
330
  already_voted: Вже проголосували
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class FixUserGroupsIdsInProposalsEndorsements < ActiveRecord::Migration[5.2]
4
+ class ProposalEndorsement < ApplicationRecord
5
+ self.table_name = :decidim_proposals_proposal_endorsements
6
+ end
7
+
4
8
  # rubocop:disable Rails/SkipsModelValidations
5
9
  def change
6
10
  Decidim::UserGroup.find_each do |group|
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddEndorsementsCounterCacheToProposals < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_proposals_proposals, :endorsements_count, :integer, null: false, default: 0
6
+ end
7
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This migration must be executed after CreateDecidimEndorsements migration in decidim-core.
4
+ class MoveProposalEndorsementsToCoreEndorsements < ActiveRecord::Migration[5.2]
5
+ class ProposalEndorsement < ApplicationRecord
6
+ self.table_name = :decidim_proposals_proposal_endorsements
7
+ end
8
+ class Endorsement < ApplicationRecord
9
+ self.table_name = :decidim_endorsements
10
+ end
11
+ # Move ProposalEndorsements to Endorsements
12
+ def up
13
+ non_duplicated_group_endorsements = ProposalEndorsement.select(
14
+ "MIN(id) as id, decidim_user_group_id"
15
+ ).group(:decidim_user_group_id).where.not(decidim_user_group_id: nil).map(&:id)
16
+
17
+ ProposalEndorsement.where("id IN (?) OR decidim_user_group_id IS NULL", non_duplicated_group_endorsements).find_each do |prop_endorsement|
18
+ Endorsement.create!(
19
+ resource_type: Decidim::Proposals::Proposal.name,
20
+ resource_id: prop_endorsement.decidim_proposal_id,
21
+ decidim_author_type: prop_endorsement.decidim_author_type,
22
+ decidim_author_id: prop_endorsement.decidim_author_id,
23
+ decidim_user_group_id: prop_endorsement.decidim_user_group_id
24
+ )
25
+ end
26
+ # update new `decidim_proposals_proposal.endorsements_count` counter cache
27
+ Decidim::Proposals::Proposal.select(:id).all.find_each do |proposal|
28
+ Decidim::Proposals::Proposal.reset_counters(proposal.id, :endorsements)
29
+ end
30
+ end
31
+
32
+ def down
33
+ non_duplicated_group_endorsements = Endorsement.select(
34
+ "MIN(id) as id, decidim_user_group_id"
35
+ ).group(:decidim_user_group_id).where.not(decidim_user_group_id: nil).map(&:id)
36
+
37
+ Endorsement
38
+ .where(resource_type: "Decidim::Proposals::Proposal")
39
+ .where("id IN (?) OR decidim_user_group_id IS NULL", non_duplicated_group_endorsements).find_each do |endorsement|
40
+ ProposalEndorsement.find_or_create_by!(
41
+ decidim_proposal_id: endorsement.resource_id,
42
+ decidim_author_type: endorsement.decidim_author_type,
43
+ decidim_author_id: endorsement.decidim_author_id,
44
+ decidim_user_group_id: endorsement.decidim_user_group_id
45
+ )
46
+ end
47
+ # update `decidim_proposals_proposal.proposal_endorsements_count` counter cache
48
+ Decidim::Proposals::Proposal.select(:id).all.find_each do |proposal|
49
+ Decidim::Proposals::Proposal.reset_counters(proposal.id, :proposal_endorsements)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class MoveProposalEndorsedEventNotificationsToResourceEndorsedEvent < ActiveRecord::Migration[5.2]
4
+ def up
5
+ Decidim::Notification.where(event_name: "decidim.events.proposals.proposal_endorsed", event_class: "Decidim::Proposals::ProposalEndorsedEvent").find_each do |notification|
6
+ notification.update(event_name: "decidim.events.resource_endorsed", event_class: "Decidim::ResourceEndorsedEvent")
7
+ end
8
+ end
9
+
10
+ def down
11
+ Decidim::Notification.where(
12
+ event_name: "decidim.events.resource_endorsed",
13
+ event_class: "Decidim::ResourceEndorsedEvent",
14
+ decidim_resource_type: "Decidim::Proposals::Proposal"
15
+ )
16
+ .find_each do |notification|
17
+ notification.update(event_name: "decidim.events.proposals.proposal_endorsed", event_class: "Decidim::Proposals::ProposalEndorsedEvent")
18
+ end
19
+ end
20
+ end
@@ -37,7 +37,9 @@ Decidim.register_component(:proposals) do |component|
37
37
  settings.attribute :allow_card_image, type: :boolean, default: false
38
38
  settings.attribute :resources_permissions_enabled, type: :boolean, default: true
39
39
  settings.attribute :collaborative_drafts_enabled, type: :boolean, default: false
40
- settings.attribute :participatory_texts_enabled, type: :boolean, default: false
40
+ settings.attribute :participatory_texts_enabled,
41
+ type: :boolean, default: false,
42
+ readonly: ->(context) { Decidim::Proposals::Proposal.where(component: context[:component]).any? }
41
43
  settings.attribute :amendments_enabled, type: :boolean, default: false
42
44
  settings.attribute :amendments_wizard_help_text, type: :text, translated: true, editor: true, required: false
43
45
  settings.attribute :announcement, type: :text, translated: true, editor: true
@@ -63,7 +65,9 @@ Decidim.register_component(:proposals) do |component|
63
65
  settings.attribute :amendment_creation_enabled, type: :boolean, default: true
64
66
  settings.attribute :amendment_reaction_enabled, type: :boolean, default: true
65
67
  settings.attribute :amendment_promotion_enabled, type: :boolean, default: true
66
- settings.attribute :amendments_visibility, type: :string, default: "all"
68
+ settings.attribute :amendments_visibility,
69
+ type: :enum, default: "all",
70
+ choices: -> { Decidim.config.amendments_visibility_options }
67
71
  settings.attribute :announcement, type: :text, translated: true, editor: true
68
72
  settings.attribute :automatic_hashtags, type: :text, editor: false, required: false
69
73
  settings.attribute :suggested_hashtags, type: :text, editor: false, required: false
@@ -97,7 +101,7 @@ Decidim.register_component(:proposals) do |component|
97
101
 
98
102
  component.register_stat :endorsements_count, priority: Decidim::StatsRegistry::MEDIUM_PRIORITY do |components, start_at, end_at|
99
103
  proposals = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).not_hidden
100
- Decidim::Proposals::ProposalEndorsement.where(proposal: proposals).count
104
+ Decidim::Endorsement.where(resource_id: proposals.pluck(:id), resource_type: Decidim::Proposals::Proposal.name).count
101
105
  end
102
106
 
103
107
  component.register_stat :comments_count, tag: :comments do |components, start_at, end_at|
@@ -349,7 +353,7 @@ Decidim.register_component(:proposals) do |component|
349
353
  user_group: group
350
354
  )
351
355
  end
352
- Decidim::Proposals::ProposalEndorsement.create!(proposal: proposal, author: author, user_group: author.user_groups.first)
356
+ Decidim::Endorsement.create!(resource: proposal, author: author, user_group: author.user_groups.first)
353
357
  end
354
358
  end
355
359
 
@@ -17,9 +17,6 @@ module Decidim
17
17
 
18
18
  routes do
19
19
  resources :proposals, except: [:destroy] do
20
- resource :proposal_endorsement, only: [:create, :destroy] do
21
- get :identities, on: :collection
22
- end
23
20
  member do
24
21
  get :compare
25
22
  get :complete
@@ -50,8 +47,7 @@ module Decidim
50
47
  end
51
48
 
52
49
  initializer "decidim_proposals.assets" do |app|
53
- app.config.assets.precompile += %w(decidim_proposals_manifest.js
54
- decidim/proposals/identity_selector_dialog.js)
50
+ app.config.assets.precompile += %w(decidim_proposals_manifest.js)
55
51
  end
56
52
 
57
53
  initializer "decidim.content_processors" do |_app|
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "decidim/dev/test/rspec_support/capybara_data_picker"
4
+
5
+ module Capybara
6
+ module ProposalsPicker
7
+ include DataPicker
8
+
9
+ RSpec::Matchers.define :have_proposals_picked do |expected|
10
+ match do |proposals_picker|
11
+ data_picker = proposals_picker.data_picker
12
+
13
+ expected.each do |proposal|
14
+ expect(data_picker).to have_selector(".picker-values div input[value='#{proposal.id}']", visible: :all)
15
+ expect(data_picker).to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,\"#{proposal.title}\")]]")
16
+ end
17
+ end
18
+ end
19
+
20
+ RSpec::Matchers.define :have_proposals_not_picked do |expected|
21
+ match do |proposals_picker|
22
+ data_picker = proposals_picker.data_picker
23
+
24
+ expected.each do |proposal|
25
+ expect(data_picker).not_to have_selector(".picker-values div input[value='#{proposal.id}']", visible: :all)
26
+ expect(data_picker).not_to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,\"#{proposal.title}\")]]")
27
+ end
28
+ end
29
+ end
30
+
31
+ def proposals_pick(proposals_picker, proposals)
32
+ data_picker = proposals_picker.data_picker
33
+
34
+ expect(data_picker).to have_selector(".picker-prompt")
35
+ data_picker.find(".picker-prompt").click
36
+
37
+ proposals.each do |proposal|
38
+ data_picker_choose_value(proposal.id)
39
+ end
40
+ data_picker_close
41
+
42
+ expect(proposals_picker).to have_proposals_picked(proposals)
43
+ end
44
+ end
45
+ end
46
+
47
+ RSpec.configure do |config|
48
+ config.include Capybara::ProposalsPicker, type: :system
49
+ end
@@ -372,7 +372,9 @@ FactoryBot.define do
372
372
 
373
373
  trait :with_endorsements do
374
374
  after :create do |proposal|
375
- create_list(:proposal_endorsement, 5, proposal: proposal)
375
+ 5.times.collect do
376
+ create(:endorsement, resource: proposal, author: build(:user, organization: proposal.participatory_space.organization))
377
+ end
376
378
  end
377
379
  end
378
380
 
@@ -388,11 +390,6 @@ FactoryBot.define do
388
390
  author { build(:user, organization: proposal.organization) }
389
391
  end
390
392
 
391
- factory :proposal_endorsement, class: "Decidim::Proposals::ProposalEndorsement" do
392
- proposal { build(:proposal) }
393
- author { build(:user, organization: proposal.organization) }
394
- end
395
-
396
393
  factory :proposal_amendment, class: "Decidim::Amendment" do
397
394
  amendable { build(:proposal) }
398
395
  emendation { build(:proposal, component: amendable.component) }
@@ -400,12 +397,6 @@ FactoryBot.define do
400
397
  state { Decidim::Amendment::STATES.sample }
401
398
  end
402
399
 
403
- factory :user_group_proposal_endorsement, class: "Decidim::Proposals::ProposalEndorsement" do
404
- proposal { build(:proposal) }
405
- author { build(:user, organization: proposal.organization) }
406
- user_group { create(:user_group, verified_at: Time.current, organization: proposal.organization, users: [author]) }
407
- end
408
-
409
400
  factory :proposal_note, class: "Decidim::Proposals::ProposalNote" do
410
401
  body { Faker::Lorem.sentences(3).join("\n") }
411
402
  proposal { build(:proposal) }