decidim-proposals 0.26.0 → 0.27.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/proposals/collaborative_draft_cell.rb +1 -1
- data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +9 -1
- data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +1 -1
- data/app/cells/decidim/proposals/proposal_cell.rb +1 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +8 -8
- data/app/commands/decidim/proposals/accept_access_to_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/admin/answer_proposal.rb +8 -3
- data/app/commands/decidim/proposals/admin/assign_proposals_to_valuator.rb +1 -1
- data/app/commands/decidim/proposals/admin/create_proposal.rb +9 -3
- data/app/commands/decidim/proposals/admin/create_proposal_note.rb +2 -2
- data/app/commands/decidim/proposals/admin/discard_participatory_text.rb +1 -1
- data/app/commands/decidim/proposals/admin/import_participatory_text.rb +1 -1
- data/app/commands/decidim/proposals/admin/import_proposals.rb +1 -1
- data/app/commands/decidim/proposals/admin/merge_proposals.rb +1 -1
- data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +1 -1
- data/app/commands/decidim/proposals/admin/publish_answers.rb +1 -1
- data/app/commands/decidim/proposals/admin/split_proposals.rb +1 -1
- data/app/commands/decidim/proposals/admin/unassign_proposals_from_valuator.rb +1 -1
- data/app/commands/decidim/proposals/admin/update_participatory_text.rb +1 -1
- data/app/commands/decidim/proposals/admin/update_proposal.rb +9 -3
- data/app/commands/decidim/proposals/admin/update_proposal_category.rb +5 -3
- data/app/commands/decidim/proposals/admin/update_proposal_scope.rb +3 -3
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +5 -5
- data/app/commands/decidim/proposals/create_proposal.rb +1 -1
- data/app/commands/decidim/proposals/destroy_proposal.rb +1 -1
- data/app/commands/decidim/proposals/hashtags_methods.rb +1 -1
- data/app/commands/decidim/proposals/publish_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/publish_proposal.rb +1 -1
- data/app/commands/decidim/proposals/reject_access_to_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/request_access_to_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/unvote_proposal.rb +1 -1
- data/app/commands/decidim/proposals/update_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/update_proposal.rb +8 -2
- data/app/commands/decidim/proposals/vote_proposal.rb +1 -1
- data/app/commands/decidim/proposals/withdraw_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/withdraw_proposal.rb +1 -1
- data/app/controllers/concerns/decidim/proposals/orderable.rb +7 -5
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +7 -7
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +8 -8
- data/app/controllers/decidim/proposals/proposal_votes_controller.rb +1 -1
- data/app/controllers/decidim/proposals/proposals_controller.rb +24 -17
- data/app/events/decidim/proposals/collaborative_draft_withdrawn_event.rb +5 -1
- data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +4 -4
- data/app/forms/decidim/proposals/admin/proposal_answer_form.rb +1 -1
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +5 -5
- data/app/forms/decidim/proposals/admin/proposal_form.rb +2 -0
- data/app/forms/decidim/proposals/admin/proposals_fork_form.rb +2 -2
- data/app/forms/decidim/proposals/admin/proposals_import_form.rb +1 -1
- data/app/forms/decidim/proposals/proposal_form.rb +11 -4
- data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +3 -0
- data/app/helpers/decidim/proposals/admin/proposal_bulk_actions_helper.rb +4 -0
- data/app/helpers/decidim/proposals/application_helper.rb +5 -7
- data/app/helpers/decidim/proposals/proposal_cells_helper.rb +1 -3
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +7 -7
- data/app/models/decidim/proposals/collaborative_draft.rb +10 -0
- data/app/models/decidim/proposals/collaborative_draft_collaborator_request.rb +0 -2
- data/app/models/decidim/proposals/proposal.rb +53 -8
- data/app/permissions/decidim/proposals/admin/permissions.rb +3 -0
- data/app/queries/decidim/proposals/filtered_proposals.rb +1 -1
- data/app/queries/decidim/proposals/similar_proposals.rb +1 -1
- data/app/services/decidim/proposals/proposal_search.rb +16 -71
- data/app/views/decidim/proposals/admin/proposal_answers/_form.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/update_attribute.js.erb +26 -0
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +8 -16
- data/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +4 -4
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +3 -1
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +13 -36
- data/app/views/decidim/proposals/proposals/_filters.html.erb +5 -5
- data/app/views/decidim/proposals/proposals/_proposal_similar.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_proposals.html.erb +5 -5
- data/app/views/decidim/proposals/proposals/complete.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/edit.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/edit_draft.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/index.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/new.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/show.html.erb +3 -3
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +3 -18
- data/config/locales/bg.yml +1 -16
- data/config/locales/ca.yml +23 -18
- data/config/locales/cs.yml +23 -18
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +1 -22
- data/config/locales/el.yml +1 -18
- data/config/locales/en.yml +23 -19
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +23 -18
- data/config/locales/es-PY.yml +23 -18
- data/config/locales/es.yml +24 -19
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +1 -22
- data/config/locales/fi-plain.yml +23 -18
- data/config/locales/fi.yml +25 -20
- data/config/locales/fr-CA.yml +22 -18
- data/config/locales/fr.yml +37 -33
- data/config/locales/ga-IE.yml +1 -2
- data/config/locales/gl.yml +8 -22
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +9 -18
- data/config/locales/id-ID.yml +1 -18
- data/config/locales/is-IS.yml +2 -3
- data/config/locales/it.yml +2 -22
- data/config/locales/ja.yml +24 -19
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +1 -18
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +2 -22
- data/config/locales/no.yml +1 -18
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +1 -22
- data/config/locales/pt-BR.yml +2 -23
- data/config/locales/pt.yml +1 -22
- data/config/locales/ro-RO.yml +2 -22
- data/config/locales/ru.yml +1 -2
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +1 -18
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +1 -0
- data/config/locales/sv.yml +10 -27
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +1 -22
- data/config/locales/uk.yml +1 -2
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1 -21
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20180529110230_move_authorships_to_coauthorships.rb +1 -0
- data/lib/decidim/content_parsers/proposal_parser.rb +7 -63
- data/lib/decidim/content_renderers/proposal_renderer.rb +3 -19
- data/lib/decidim/proposals/component.rb +22 -16
- data/lib/decidim/proposals/import/proposal_answer_creator.rb +21 -19
- data/lib/decidim/proposals/import/proposal_creator.rb +4 -1
- data/lib/decidim/proposals/test/factories.rb +1 -1
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +25 -28
- data/app/services/decidim/proposals/collaborative_draft_search.rb +0 -59
- data/app/views/decidim/proposals/admin/proposals/_js-callout.html.erb +0 -6
- data/app/views/decidim/proposals/admin/proposals/update_category.js.erb +0 -26
- data/app/views/decidim/proposals/admin/proposals/update_scope.js.erb +0 -27
data/config/locales/ti-ER.yml
CHANGED
data/config/locales/tr-TR.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
---
|
1
2
|
tr:
|
2
3
|
activemodel:
|
3
4
|
attributes:
|
@@ -41,10 +42,6 @@ tr:
|
|
41
42
|
valuator_role_id: Bilirkişi adı
|
42
43
|
errors:
|
43
44
|
models:
|
44
|
-
participatory_text:
|
45
|
-
attributes:
|
46
|
-
document:
|
47
|
-
invalid_document_type: 'Geçersiz doküman tipi. Kabul edilen formatlar: %{valid_mime_types}'
|
48
45
|
proposal:
|
49
46
|
attributes:
|
50
47
|
add_documents:
|
@@ -185,33 +182,21 @@ tr:
|
|
185
182
|
email_subject: Birisi %{resource_title} teklifine not bıraktı.
|
186
183
|
notification_title: Birisi teklif <a href="%{resource_path}">%{resource_title} </a> hakkında bir not bıraktı. <a href="%{admin_proposal_info_path}"> Yönetici panelinden </a> kontrol edin
|
187
184
|
collaborative_draft_access_accepted:
|
188
|
-
email_intro: '%{requester_name}, <a href="%{resource_path}">%{resource_title} </a> ortak çalışma taslağına katkıda bulunan kişi olarak erişim için kabul edildi.'
|
189
|
-
email_outro: Bu bildirimi, <a href="%{resource_path}">%{resource_title} </a> ortak çalışanı olduğunuz için aldınız.
|
190
185
|
email_subject: "%{requester_name}, %{resource_title} katkı sağlayıcısı olarak erişim için kabul edildi."
|
191
186
|
notification_title: <a href="%{requester_path}">%{requester_name} %{requester_nickname} </a> için <strong> katkıda bulunan </strong> olarak erişim için kabul edildi <a href = "%{resource_path}">%{resource_title} </a> ortak çalışma taslağı.
|
192
187
|
collaborative_draft_access_rejected:
|
193
|
-
email_intro: '<a href="%{resource_path}">%{resource_title}</a> işbirlikçi taslağın katılımcısı olarak erişim için %{requester_name} reddedildi.'
|
194
|
-
email_outro: Bu bildirimi, <a href="%{resource_path}">%{resource_title} </a> ortak çalışanı olduğunuz için aldınız.
|
195
188
|
email_subject: "%{requester_name}, %{resource_title} ortak çalışma taslağına katkıda bulunan kişi olarak erişimi reddedildi."
|
196
189
|
notification_title: <a href="%{requester_path}">%{requester_name} %{requester_nickname}</a> , <a href="%{resource_path}">%{resource_title}</a> işbirlikçi taslağın bir katkıcısı</strong> olarak erişmek için <strong>reddedilmiştir.
|
197
190
|
collaborative_draft_access_requested:
|
198
|
-
email_intro: '%{requester_name} katkıda bulunan olarak erişim istedi. <a href="%{resource_path}">%{resource_title} </a> ortak çalışma taslak sayfasından <strong> isteği kabul edebilir veya reddedebilirsiniz </strong>.'
|
199
|
-
email_outro: Bu bildirimi, <a href="%{resource_path}">%{resource_title} </a> ortak çalışanı olduğunuz için aldınız.
|
200
191
|
email_subject: "%{requester_name}, %{resource_title} kaynağına katkıda bulunmak için erişim istedi."
|
201
192
|
notification_title: <a href="%{requester_path}">%{requester_name} %{requester_nickname} </a>, <a href="%{resource_path}">%{resource_title} </a> ortak çalışma taslağına katkıda bulunmak için erişim istedi. Lütfen <strong> isteği kabul edin veya reddedin </strong>.
|
202
193
|
collaborative_draft_access_requester_accepted:
|
203
|
-
email_intro: <a href="%{resource_path}">%{resource_title} </a> ortak çalışma taslağına katkıda bulunan olarak erişmeniz kabul edildi.
|
204
|
-
email_outro: Bu bildirimi, <a href="%{resource_path}">%{resource_title} </a> ortak çalışanı olmayı talep ettiğiniz için aldınız.
|
205
194
|
email_subject: '%{resource_title} katılımcısı olarak kabul edildiniz.'
|
206
195
|
notification_title: <a href="%{resource_path}">%{resource_title} </a> ortak çalışma taslağına <strong> katkıda bulunan kişi olarak erişmeniz kabul edildi </strong>.
|
207
196
|
collaborative_draft_access_requester_rejected:
|
208
|
-
email_intro: <a href="%{resource_path}">%{resource_title} </a> ortak çalışma taslağına katkıda bulunan olarak erişiminiz reddedildi.
|
209
|
-
email_outro: Bu bildirimi, <a href="%{resource_path}">%{resource_title} </a> ortak çalışanı olmayı talep ettiğiniz için aldınız.
|
210
197
|
email_subject: '%{resource_title} katılımcısı olarak reddedildiniz.'
|
211
198
|
notification_title: <a href="%{resource_path}">%{resource_title} </a> ortak çalışma taslağına <strong> katkıda bulunan olarak erişiminiz reddedildi </strong>.
|
212
199
|
collaborative_draft_withdrawn:
|
213
|
-
email_intro: <a href="%{author_path}">%{author_name} %{author_nickname} </a>, <a href="%{resource_path}">%{resource_title} </a> ortak çalışma taslağını geri çekti.
|
214
|
-
email_outro: Bu bildirimi, <a href="%{resource_path}">%{resource_title} </a> ortak çalışanı olduğunuz için aldınız.
|
215
200
|
email_subject: "%{author_name} %{author_nickname}, %{resource_title} ortak çalışma taslağını geri çekti."
|
216
201
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname} </a> <a href="%{resource_path}">%{resource_title} </a> işbirlikçi taslak öğesini <strong> geri çekti </strong>.
|
217
202
|
creation_enabled:
|
@@ -531,7 +516,6 @@ tr:
|
|
531
516
|
all: Tümü
|
532
517
|
filter_origin_values:
|
533
518
|
all: Tümü
|
534
|
-
citizens: Vatandaşlar
|
535
519
|
meetings: Toplantılar
|
536
520
|
official: Resmi
|
537
521
|
user_groups: Gruplar
|
@@ -702,12 +686,8 @@ tr:
|
|
702
686
|
one: "%{count} teklif"
|
703
687
|
other: "%{count} teklif"
|
704
688
|
edit:
|
705
|
-
add_documents: Dokümanlar
|
706
|
-
add_images: Dosya
|
707
689
|
attachment_legend: "(İsteğe bağlı) Bir ek ekleyin"
|
708
690
|
back: Geri
|
709
|
-
delete_document: Doküman Sil
|
710
|
-
delete_image: Resmi sil
|
711
691
|
gallery_legend: "(İsteğe bağlı) Teklif kartına bir resim ekleyin"
|
712
692
|
select_a_category: Lütfen bir kategori seçin
|
713
693
|
send: Gönder
|
@@ -746,7 +726,6 @@ tr:
|
|
746
726
|
other: destekler
|
747
727
|
new:
|
748
728
|
send: Devam et
|
749
|
-
title: Teklifinizi Oluşturun
|
750
729
|
orders:
|
751
730
|
label: 'Teklifleri şuna göre sırala:'
|
752
731
|
most_commented: En çok yorum yapılan
|
data/config/locales/uk.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
---
|
1
2
|
uk:
|
2
3
|
activemodel:
|
3
4
|
attributes:
|
@@ -222,7 +223,6 @@ uk:
|
|
222
223
|
withdrawn: Відкликана
|
223
224
|
application_helper:
|
224
225
|
filter_origin_values:
|
225
|
-
citizens: Громадяни
|
226
226
|
official: Службове
|
227
227
|
filter_state_values:
|
228
228
|
not_answered: Без відповідей
|
@@ -292,7 +292,6 @@ uk:
|
|
292
292
|
other: голосів
|
293
293
|
new:
|
294
294
|
send: Продовжити
|
295
|
-
title: Внесіть свою пропозицію
|
296
295
|
orders:
|
297
296
|
label: 'Впорядкувати пропозиції за:'
|
298
297
|
most_voted: Отримали найбільше голосів
|
data/config/locales/val-ES.yml
CHANGED
data/config/locales/vi.yml
CHANGED
data/config/locales/zh-CN.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
---
|
1
2
|
zh-CN:
|
2
3
|
activemodel:
|
3
4
|
attributes:
|
@@ -38,10 +39,6 @@ zh-CN:
|
|
38
39
|
valuator_role_id: 值名称
|
39
40
|
errors:
|
40
41
|
models:
|
41
|
-
participatory_text:
|
42
|
-
attributes:
|
43
|
-
document:
|
44
|
-
invalid_document_type: '无效的文档类型。接受的格式为: %{valid_mime_types}'
|
45
42
|
proposal:
|
46
43
|
attributes:
|
47
44
|
add_documents:
|
@@ -178,30 +175,19 @@ zh-CN:
|
|
178
175
|
email_subject: 有人在建议 %{resource_title} 留下了一条笔记。
|
179
176
|
notification_title: 有人在提议 <a href="%{resource_path}">%{resource_title}</a>留下了一条笔记。请在 <a href="%{admin_proposal_info_path}">管理面板</a>
|
180
177
|
collaborative_draft_access_accepted:
|
181
|
-
email_intro: '%{requester_name} 已被接受作为贡献者访问 <a href="%{resource_path}">%{resource_title}</a> 协作草案。'
|
182
|
-
email_outro: 您收到此通知是因为您是 <a href="%{resource_path}">%{resource_title}的合作者</a>
|
183
178
|
email_subject: "%{requester_name} 已被接受作为贡献者访问 %{resource_title}。"
|
184
179
|
collaborative_draft_access_rejected:
|
185
|
-
email_intro: '%{requester_name} 已被拒绝以贡献者身份访问 <a href="%{resource_path}">%{resource_title}</a> 协作草稿。'
|
186
|
-
email_outro: 您收到此通知是因为您是 <a href="%{resource_path}">%{resource_title}的合作者</a>
|
187
180
|
email_subject: "%{requester_name} 在 %{resource_title} 协作草稿中的贡献者被拒绝访问。"
|
188
181
|
notification_title: <a href="%{requester_path}">%{requester_name} %{requester_nickname}</a> 已被 <strong>拒绝以贡献者身份访问</strong> <a href="%{resource_path}">%{resource_title}</a> 合作草稿。
|
189
182
|
collaborative_draft_access_requested:
|
190
|
-
email_outro: 您收到此通知是因为您是 <a href="%{resource_path}">%{resource_title}的合作者</a>
|
191
183
|
email_subject: "%{requester_name} 请求访问权限为 %{resource_title} 捐款。"
|
192
184
|
notification_title: <a href="%{requester_path}">%{requester_name} %{requester_nickname}</a> 请求访问权限以便为 <a href="%{resource_path}">%{resource_title}</a> 协作草稿。请 <strong>接受或拒绝请求</strong>
|
193
185
|
collaborative_draft_access_requester_accepted:
|
194
|
-
email_intro: 您已被接受作为 <a href="%{resource_path}">%{resource_title}</a> 协作草稿的贡献者访问权限。
|
195
|
-
email_outro: 您收到此通知是因为您请求成为 <a href="%{resource_path}">%{resource_title}</a> 的合作者。
|
196
186
|
email_subject: 您已被接受为 %{resource_title} 的贡献者。
|
197
187
|
collaborative_draft_access_requester_rejected:
|
198
|
-
email_intro: 您已被拒绝以贡献者身份访问 <a href="%{resource_path}">%{resource_title}</a> 协作草稿。
|
199
|
-
email_outro: 您收到此通知是因为您请求成为 <a href="%{resource_path}">%{resource_title}</a> 的合作者。
|
200
188
|
email_subject: 您已被拒绝为 %{resource_title} 的贡献者。
|
201
189
|
notification_title: 您在 <a href="%{resource_path}">%{resource_title}</a> 协作草稿中的 <strong>被拒绝作为贡献者</strong> 访问。
|
202
190
|
collaborative_draft_withdrawn:
|
203
|
-
email_intro: <a href="%{author_path}">%{author_name} %{author_nickname}</a> 撤回了 <a href="%{resource_path}">%{resource_title}</a> 协作草稿。
|
204
|
-
email_outro: 您收到此通知是因为您是 <a href="%{resource_path}">%{resource_title}的合作者</a>
|
205
191
|
email_subject: "%{author_name} %{author_nickname} 撤销了 %{resource_title} 协作草稿。"
|
206
192
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> <strong>撤回</strong> <a href="%{resource_path}">%{resource_title}</a> 协作草稿。
|
207
193
|
creation_enabled:
|
@@ -510,7 +496,6 @@ zh-CN:
|
|
510
496
|
all: 所有的
|
511
497
|
filter_origin_values:
|
512
498
|
all: 所有的
|
513
|
-
citizens: Citizens
|
514
499
|
meetings: 会议
|
515
500
|
official: 官方的
|
516
501
|
user_groups: 群組
|
@@ -675,12 +660,8 @@ zh-CN:
|
|
675
660
|
proposals_count:
|
676
661
|
other: "%{count} 个提议"
|
677
662
|
edit:
|
678
|
-
add_documents: www.un.org/webcast
|
679
|
-
add_images: 文件
|
680
663
|
attachment_legend: "(可选) 添加附件"
|
681
664
|
back: 后退
|
682
|
-
delete_document: 删除文档
|
683
|
-
delete_image: 删除图像
|
684
665
|
gallery_legend: "(可选) 添加图像到提案卡"
|
685
666
|
select_a_category: 请选择一个类别
|
686
667
|
send: 发送
|
@@ -718,7 +699,6 @@ zh-CN:
|
|
718
699
|
other: 支持
|
719
700
|
new:
|
720
701
|
send: 继续
|
721
|
-
title: 创建您的提议
|
722
702
|
orders:
|
723
703
|
label: '排序提议:'
|
724
704
|
most_commented: 最多评论
|
data/config/locales/zh-TW.yml
CHANGED
@@ -12,89 +12,33 @@ module Decidim
|
|
12
12
|
# Also fills a `Metadata#linked_proposals` attribute.
|
13
13
|
#
|
14
14
|
# @see BaseParser Examples of how to use a content parser
|
15
|
-
class ProposalParser <
|
15
|
+
class ProposalParser < ResourceParser
|
16
16
|
# Class used as a container for metadata
|
17
17
|
#
|
18
18
|
# @!attribute linked_proposals
|
19
19
|
# @return [Array] an array of Decidim::Proposals::Proposal mentioned in content
|
20
20
|
Metadata = Struct.new(:linked_proposals)
|
21
21
|
|
22
|
-
# Matches a URL
|
23
|
-
URL_REGEX_SCHEME = '(?:http(s)?:\/\/)'
|
24
|
-
URL_REGEX_CONTENT = '[\w.-]+[\w\-\._~:\/?#\[\]@!\$&\'\(\)\*\+,;=.]+'
|
25
|
-
URL_REGEX_END_CHAR = '[\d]'
|
26
|
-
URL_REGEX = %r{#{URL_REGEX_SCHEME}#{URL_REGEX_CONTENT}/proposals/#{URL_REGEX_END_CHAR}+}i.freeze
|
27
|
-
# Matches a mentioned Proposal ID (~(d)+ expression)
|
28
|
-
ID_REGEX = /~(\d+)/.freeze
|
29
|
-
|
30
22
|
def initialize(content, context)
|
31
23
|
super
|
32
24
|
@metadata = Metadata.new([])
|
33
25
|
end
|
34
26
|
|
35
|
-
# Replaces found mentions matching an existing
|
36
|
-
# Proposal with a global id for that Proposal. Other mentions found that doesn't
|
37
|
-
# match an existing Proposal are returned as they are.
|
38
|
-
#
|
39
|
-
# @return [String] the content with the valid mentions replaced by a global id.
|
40
|
-
def rewrite
|
41
|
-
rewrited_content = parse_for_urls(content)
|
42
|
-
parse_for_ids(rewrited_content)
|
43
|
-
end
|
44
|
-
|
45
27
|
# (see BaseParser#metadata)
|
46
28
|
attr_reader :metadata
|
47
29
|
|
48
30
|
private
|
49
31
|
|
50
|
-
def
|
51
|
-
|
52
|
-
proposal = proposal_from_url_match(match)
|
53
|
-
if proposal
|
54
|
-
@metadata.linked_proposals << proposal.id
|
55
|
-
proposal.to_global_id
|
56
|
-
else
|
57
|
-
match
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def parse_for_ids(content)
|
63
|
-
content.gsub(ID_REGEX) do |match|
|
64
|
-
proposal = proposal_from_id_match(Regexp.last_match(1))
|
65
|
-
if proposal
|
66
|
-
@metadata.linked_proposals << proposal.id
|
67
|
-
proposal.to_global_id
|
68
|
-
else
|
69
|
-
match
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def proposal_from_url_match(match)
|
75
|
-
uri = URI.parse(match)
|
76
|
-
return if uri.path.blank?
|
77
|
-
|
78
|
-
proposal_id = uri.path.split("/").last
|
79
|
-
find_proposal_by_id(proposal_id)
|
80
|
-
rescue URI::InvalidURIError
|
81
|
-
Rails.logger.error("#{e.message}=>#{e.backtrace}")
|
82
|
-
nil
|
32
|
+
def url_regex
|
33
|
+
%r{#{URL_REGEX_SCHEME}#{URL_REGEX_CONTENT}/proposals/#{URL_REGEX_END_CHAR}+}i
|
83
34
|
end
|
84
35
|
|
85
|
-
def
|
86
|
-
|
87
|
-
find_proposal_by_id(proposal_id)
|
36
|
+
def model_class
|
37
|
+
"Decidim::Proposals::Proposal"
|
88
38
|
end
|
89
39
|
|
90
|
-
def
|
91
|
-
|
92
|
-
spaces = Decidim.participatory_space_manifests.flat_map do |manifest|
|
93
|
-
manifest.participatory_spaces.call(context[:current_organization]).public_spaces
|
94
|
-
end
|
95
|
-
components = Component.where(participatory_space: spaces).published
|
96
|
-
Decidim::Proposals::Proposal.where(component: components).find_by(id: id)
|
97
|
-
end
|
40
|
+
def update_metadata(resource)
|
41
|
+
@metadata.linked_proposals << resource.id
|
98
42
|
end
|
99
43
|
end
|
100
44
|
end
|
@@ -8,25 +8,9 @@ module Decidim
|
|
8
8
|
# e.g. gid://<APP_NAME>/Decidim::Proposals::Proposal/1
|
9
9
|
#
|
10
10
|
# @see BaseRenderer Examples of how to use a content renderer
|
11
|
-
class ProposalRenderer <
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# Replaces found Global IDs matching an existing proposal with
|
16
|
-
# a link to its show page. The Global IDs representing an
|
17
|
-
# invalid Decidim::Proposals::Proposal are replaced with '???' string.
|
18
|
-
#
|
19
|
-
# @return [String] the content ready to display (contains HTML)
|
20
|
-
def render(_options = nil)
|
21
|
-
return content unless content.respond_to?(:gsub)
|
22
|
-
|
23
|
-
content.gsub(GLOBAL_ID_REGEX) do |proposal_gid|
|
24
|
-
proposal = GlobalID::Locator.locate(proposal_gid)
|
25
|
-
Decidim::Proposals::ProposalPresenter.new(proposal).display_mention
|
26
|
-
rescue ActiveRecord::RecordNotFound
|
27
|
-
proposal_id = proposal_gid.split("/").last
|
28
|
-
"~#{proposal_id}"
|
29
|
-
end
|
11
|
+
class ProposalRenderer < ResourceRenderer
|
12
|
+
def regex
|
13
|
+
%r{gid://([\w-]*/Decidim::Proposals::Proposal/(\d+))}i
|
30
14
|
end
|
31
15
|
end
|
32
16
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "decidim/components/namer"
|
4
|
+
require "decidim/meetings"
|
4
5
|
|
5
6
|
Decidim.register_component(:proposals) do |component|
|
6
7
|
component.engine = Decidim::Proposals::Engine
|
@@ -65,11 +66,11 @@ Decidim.register_component(:proposals) do |component|
|
|
65
66
|
settings.attribute :votes_blocked, type: :boolean
|
66
67
|
settings.attribute :votes_hidden, type: :boolean, default: false
|
67
68
|
settings.attribute :comments_blocked, type: :boolean, default: false
|
68
|
-
settings.attribute :creation_enabled, type: :boolean
|
69
|
+
settings.attribute :creation_enabled, type: :boolean, readonly: ->(context) { context[:component].settings[:participatory_texts_enabled] }
|
69
70
|
settings.attribute :proposal_answering_enabled, type: :boolean, default: true
|
70
|
-
settings.attribute :default_sort_order, type: :select, include_blank: true, choices: -> { POSSIBLE_SORT_ORDERS }
|
71
71
|
settings.attribute :publish_answers_immediately, type: :boolean, default: true
|
72
72
|
settings.attribute :answers_with_costs, type: :boolean, default: false
|
73
|
+
settings.attribute :default_sort_order, type: :select, include_blank: true, choices: -> { POSSIBLE_SORT_ORDERS }
|
73
74
|
settings.attribute :amendment_creation_enabled, type: :boolean, default: true
|
74
75
|
settings.attribute :amendment_reaction_enabled, type: :boolean, default: true
|
75
76
|
settings.attribute :amendment_promotion_enabled, type: :boolean, default: true
|
@@ -265,26 +266,31 @@ Decidim.register_component(:proposals) do |component|
|
|
265
266
|
visibility: "all"
|
266
267
|
) do
|
267
268
|
proposal = Decidim::Proposals::Proposal.new(params)
|
268
|
-
|
269
|
+
meeting_component = participatory_space.components.find_by(manifest_name: "meetings")
|
270
|
+
|
271
|
+
coauthor = case n
|
272
|
+
when 0
|
273
|
+
Decidim::User.where(decidim_organization_id: participatory_space.decidim_organization_id).order(Arel.sql("RANDOM()")).first
|
274
|
+
when 1
|
275
|
+
Decidim::UserGroup.where(decidim_organization_id: participatory_space.decidim_organization_id).order(Arel.sql("RANDOM()")).first
|
276
|
+
when 2
|
277
|
+
Decidim::Meetings::Meeting.where(component: meeting_component).order(Arel.sql("RANDOM()")).first
|
278
|
+
else
|
279
|
+
participatory_space.organization
|
280
|
+
end
|
281
|
+
proposal.add_coauthor(coauthor)
|
269
282
|
proposal.save!
|
270
283
|
proposal
|
271
284
|
end
|
272
285
|
|
273
|
-
if n.positive?
|
274
|
-
Decidim::User.where(decidim_organization_id: participatory_space.decidim_organization_id).all.sample(n).each do |author|
|
275
|
-
user_group = [true, false].sample ? Decidim::UserGroups::ManageableUserGroups.for(author).verified.sample : nil
|
276
|
-
proposal.add_coauthor(author, user_group: user_group)
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
286
|
if proposal.state.nil?
|
281
287
|
email = "amendment-author-#{participatory_space.underscored_name}-#{participatory_space.id}-#{n}-amend#{n}@example.org"
|
282
288
|
name = "#{Faker::Name.name} #{participatory_space.id} #{n} amend#{n}"
|
283
289
|
|
284
290
|
author = Decidim::User.find_or_initialize_by(email: email)
|
285
291
|
author.update!(
|
286
|
-
password: "
|
287
|
-
password_confirmation: "
|
292
|
+
password: "decidim123456789",
|
293
|
+
password_confirmation: "decidim123456789",
|
288
294
|
name: name,
|
289
295
|
nickname: Faker::Twitter.unique.screen_name,
|
290
296
|
organization: component.organization,
|
@@ -349,8 +355,8 @@ Decidim.register_component(:proposals) do |component|
|
|
349
355
|
|
350
356
|
author = Decidim::User.find_or_initialize_by(email: email)
|
351
357
|
author.update!(
|
352
|
-
password: "
|
353
|
-
password_confirmation: "
|
358
|
+
password: "decidim123456789",
|
359
|
+
password_confirmation: "decidim123456789",
|
354
360
|
name: name,
|
355
361
|
nickname: Faker::Twitter.unique.screen_name,
|
356
362
|
organization: component.organization,
|
@@ -371,8 +377,8 @@ Decidim.register_component(:proposals) do |component|
|
|
371
377
|
|
372
378
|
author = Decidim::User.find_or_initialize_by(email: email)
|
373
379
|
author.update!(
|
374
|
-
password: "
|
375
|
-
password_confirmation: "
|
380
|
+
password: "decidim123456789",
|
381
|
+
password_confirmation: "decidim123456789",
|
376
382
|
name: name,
|
377
383
|
nickname: Faker::Twitter.unique.screen_name,
|
378
384
|
organization: component.organization,
|
@@ -40,26 +40,28 @@ module Decidim
|
|
40
40
|
private
|
41
41
|
|
42
42
|
def resource
|
43
|
-
@resource ||=
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
proposal
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
43
|
+
@resource ||= fetch_resource
|
44
|
+
end
|
45
|
+
|
46
|
+
def fetch_resource
|
47
|
+
proposal = Decidim::Proposals::Proposal.find_by(id: id)
|
48
|
+
return nil unless proposal
|
49
|
+
return nil if proposal.emendation?
|
50
|
+
|
51
|
+
if proposal.component != component
|
52
|
+
proposal.errors.add(:component, :invalid)
|
53
|
+
return proposal
|
54
|
+
end
|
55
|
+
|
56
|
+
proposal.answer = answer
|
57
|
+
proposal.answered_at = Time.current
|
58
|
+
if POSSIBLE_ANSWER_STATES.include?(state)
|
59
|
+
proposal.state = state
|
60
|
+
proposal.state_published_at = Time.current if component.current_settings.publish_answers_immediately?
|
61
|
+
else
|
62
|
+
proposal.errors.add(:state, :invalid)
|
62
63
|
end
|
64
|
+
proposal
|
63
65
|
end
|
64
66
|
|
65
67
|
def id
|
@@ -33,7 +33,10 @@ module Decidim
|
|
33
33
|
|
34
34
|
# Saves the proposal
|
35
35
|
def finish!
|
36
|
-
|
36
|
+
Decidim.traceability.perform_action!(:create, self.class.resource_klass, context[:current_user], visibility: "admin-only") do
|
37
|
+
resource.save!
|
38
|
+
resource
|
39
|
+
end
|
37
40
|
notify(resource)
|
38
41
|
publish(resource)
|
39
42
|
end
|
@@ -305,7 +305,7 @@ FactoryBot.define do
|
|
305
305
|
published_at { nil }
|
306
306
|
end
|
307
307
|
|
308
|
-
trait :
|
308
|
+
trait :participant_author do
|
309
309
|
after :build do |proposal|
|
310
310
|
proposal.coauthorships.clear
|
311
311
|
user = build(:user, organization: proposal.component.participatory_space.organization)
|