decidim-proposals 0.23.5 → 0.24.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +4 -1
- data/app/assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 +4 -1
- data/app/assets/stylesheets/decidim/proposals/_proposals.css.scss +1 -0
- data/app/assets/stylesheets/decidim/proposals/proposals/_preview.css.scss +3 -0
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +3 -3
- data/app/cells/decidim/proposals/collaborative_drafts/reported_content/show.erb +3 -0
- data/app/cells/decidim/proposals/collaborative_drafts/reported_content_cell.rb +15 -0
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals/elements.erb +5 -0
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals/heading.erb +1 -0
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals_cell.rb +19 -0
- data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +1 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +23 -2
- data/app/cells/decidim/proposals/proposals_picker_cell.rb +1 -1
- data/app/cells/decidim/proposals/reported_content/show.erb +4 -0
- data/app/cells/decidim/proposals/reported_content_cell.rb +13 -0
- data/app/commands/decidim/proposals/hashtags_methods.rb +1 -1
- data/app/commands/decidim/proposals/update_proposal.rb +0 -2
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +6 -4
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +1 -30
- data/app/controllers/decidim/proposals/proposals_controller.rb +5 -6
- data/app/events/decidim/proposals/publish_proposal_event.rb +1 -1
- data/app/forms/decidim/proposals/access_to_collaborative_draft_form.rb +1 -3
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +3 -2
- data/app/forms/decidim/proposals/proposal_form.rb +15 -5
- data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +1 -1
- data/app/helpers/decidim/proposals/admin/filterable_helper.rb +1 -1
- data/app/helpers/decidim/proposals/admin/proposal_rankings_helper.rb +1 -1
- data/app/helpers/decidim/proposals/admin/proposals_helper.rb +8 -8
- data/app/helpers/decidim/proposals/application_helper.rb +5 -2
- data/app/helpers/decidim/proposals/map_helper.rb +31 -8
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +14 -44
- data/app/helpers/decidim/proposals/proposals_helper.rb +3 -6
- data/app/models/decidim/proposals/collaborative_draft.rb +10 -0
- data/app/models/decidim/proposals/proposal.rb +18 -10
- data/app/permissions/decidim/proposals/admin/permissions.rb +2 -2
- data/app/permissions/decidim/proposals/permissions.rb +3 -2
- data/app/presenters/decidim/proposals/proposal_presenter.rb +4 -4
- data/app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb +4 -4
- data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +6 -6
- data/app/services/decidim/proposals/collaborative_draft_search.rb +1 -1
- data/app/services/decidim/proposals/diff_renderer.rb +7 -11
- data/app/services/decidim/proposals/proposal_builder.rb +1 -0
- data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +8 -1
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +5 -1
- data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_filters_small_view.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +2 -7
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_header.html.erb +14 -0
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +1 -3
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +5 -13
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -7
- data/app/views/decidim/proposals/proposals/_dynamic_map_instructions.html.erb +3 -0
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +6 -6
- data/app/views/decidim/proposals/proposals/_filters.html.erb +34 -32
- data/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +21 -11
- data/app/views/decidim/proposals/proposals/edit.html.erb +1 -3
- data/app/views/decidim/proposals/proposals/preview.html.erb +50 -2
- data/app/views/decidim/proposals/proposals/show.html.erb +2 -8
- data/config/locales/ar.yml +2 -23
- data/config/locales/bg.yml +0 -4
- data/config/locales/ca.yml +23 -29
- data/config/locales/cs.yml +24 -30
- data/config/locales/de.yml +23 -29
- data/config/locales/el.yml +2 -29
- data/config/locales/en.yml +23 -29
- data/config/locales/es-MX.yml +23 -29
- data/config/locales/es-PY.yml +23 -29
- data/config/locales/es.yml +23 -29
- data/config/locales/eu.yml +2 -23
- data/config/locales/fi-plain.yml +22 -28
- data/config/locales/fi.yml +22 -28
- data/config/locales/fr-CA.yml +19 -29
- data/config/locales/fr.yml +19 -29
- data/config/locales/gl.yml +17 -25
- data/config/locales/hu.yml +2 -23
- data/config/locales/id-ID.yml +2 -23
- data/config/locales/is-IS.yml +0 -8
- data/config/locales/it.yml +4 -29
- data/config/locales/ja.yml +2 -29
- data/config/locales/lv.yml +2 -22
- data/config/locales/nl.yml +17 -29
- data/config/locales/no.yml +2 -23
- data/config/locales/pl.yml +22 -28
- data/config/locales/pt-BR.yml +2 -22
- data/config/locales/pt.yml +2 -29
- data/config/locales/ro-RO.yml +13 -29
- data/config/locales/ru.yml +0 -8
- data/config/locales/sk.yml +5 -23
- data/config/locales/sv.yml +23 -28
- data/config/locales/tr-TR.yml +17 -29
- data/config/locales/uk.yml +0 -8
- data/config/locales/zh-CN.yml +2 -29
- data/db/migrate/20210310102839_add_followable_counter_cache_to_proposals.rb +16 -0
- data/db/migrate/20210310120812_add_followable_counter_cache_to_collaborative_drafts.rb +16 -0
- data/db/migrate/20210318082934_fix_counters_for_copied_proposals.rb +9 -7
- data/{app/types/decidim/proposals → lib/decidim/api}/proposal_input_filter.rb +0 -0
- data/{app/types/decidim/proposals → lib/decidim/api}/proposal_input_sort.rb +3 -5
- data/lib/decidim/api/proposal_type.rb +56 -0
- data/lib/decidim/api/proposals_type.rb +43 -0
- data/lib/decidim/content_renderers/proposal_renderer.rb +1 -1
- data/lib/decidim/proposals.rb +2 -0
- data/lib/decidim/proposals/api.rb +10 -0
- data/lib/decidim/proposals/component.rb +30 -19
- data/lib/decidim/proposals/engine.rb +6 -27
- data/lib/decidim/proposals/proposal_creator.rb +98 -0
- data/lib/decidim/proposals/test/factories.rb +22 -8
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +49 -35
- data/app/commands/decidim/proposals/create_proposal_export.rb +0 -37
- data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +0 -0
- data/app/queries/decidim/proposals/similar_collaborative_drafts.rb +0 -52
- data/app/types/decidim/proposals/proposal_type.rb +0 -70
- data/app/types/decidim/proposals/proposals_type.rb +0 -41
- data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_proposals.html.erb +0 -13
- data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +0 -21
- data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +0 -24
- data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +0 -1
data/config/locales/tr-TR.yml
CHANGED
@@ -27,6 +27,9 @@ tr:
|
|
27
27
|
user_group_id: Teklif oluştur
|
28
28
|
proposal_answer:
|
29
29
|
answer: Cevap
|
30
|
+
cost: Maliyet
|
31
|
+
cost_report: Maliyet raporu
|
32
|
+
execution_period: Yürütme süresi
|
30
33
|
proposals_copy:
|
31
34
|
copy_proposals: Bunun, seçilen bileşendeki tüm teklifleri mevcut bileşene aktaracağını ve bu işlemin geri alınamayacağını anlıyorum.
|
32
35
|
origin_component_id: Teklifleri kopyalamak için bileşen
|
@@ -336,10 +339,6 @@ tr:
|
|
336
339
|
description: Tekliflere verilen desteklerin sayısı
|
337
340
|
object: destekler
|
338
341
|
title: Destekler
|
339
|
-
participatory_processes:
|
340
|
-
participatory_process_groups:
|
341
|
-
highlighted_proposals:
|
342
|
-
proposals: Teklifler
|
343
342
|
participatory_spaces:
|
344
343
|
highlighted_proposals:
|
345
344
|
see_all: Tüm teklifleri görün (%{count})
|
@@ -356,7 +355,7 @@ tr:
|
|
356
355
|
actions:
|
357
356
|
preview: Ön izleme
|
358
357
|
exports:
|
359
|
-
|
358
|
+
proposal_comments: Yorumlar
|
360
359
|
proposals: Teklifler
|
361
360
|
models:
|
362
361
|
proposal:
|
@@ -380,9 +379,9 @@ tr:
|
|
380
379
|
new_import:
|
381
380
|
accepted_mime_types:
|
382
381
|
md: Markdown
|
383
|
-
odt:
|
382
|
+
odt: ODT
|
384
383
|
bottom_hint: "(Belge bölümlerini önizleyebilir ve sıralayabilirsiniz)"
|
385
|
-
document_legend: '2
|
384
|
+
document_legend: '2 Mb''tan küçük bir belge ekleyin, 3 düzey derinliğe kadar her bölüm tekliflere ayrıştırılacaktır. Desteklenen biçimler şunlardır: %{valid_mime_types}'
|
386
385
|
title: BELGE EKLE
|
387
386
|
upload_document: Belge yükle
|
388
387
|
publish:
|
@@ -497,6 +496,7 @@ tr:
|
|
497
496
|
no_components: Teklifleri içe aktarmak için bu katılımcı alanda başka hiçbir teklif bileşeni bulunmamaktadır.
|
498
497
|
select_component: Lütfen bir bileşen seçiniz
|
499
498
|
select_states: İçe aktarılacak tekliflerin durumlarını kontrol et
|
499
|
+
title: Teklifleri içe aktar
|
500
500
|
proposals_merges:
|
501
501
|
create:
|
502
502
|
invalid: Seçilen teklifler birleştirilirken bir hata oluştu.
|
@@ -569,13 +569,6 @@ tr:
|
|
569
569
|
ok: İşbirliği taslağını geri çekme
|
570
570
|
title: Aşağıdaki işlem geri alınamaz
|
571
571
|
success: Ortak taslak başarıyla geri çekildi.
|
572
|
-
compare:
|
573
|
-
mine_is_different: Ortak çalışma taslağım farklı
|
574
|
-
no_similars_found: Benzer ortak taslak bulunamadı
|
575
|
-
title: Benzer işbirliği taslakları
|
576
|
-
complete:
|
577
|
-
send: Gönder
|
578
|
-
title: Ortak çalışma taslağınızı tamamlayın
|
579
572
|
count:
|
580
573
|
drafts_count:
|
581
574
|
one: "%{count} ortak taslak"
|
@@ -607,7 +600,6 @@ tr:
|
|
607
600
|
unfold: Aç
|
608
601
|
new:
|
609
602
|
send: Devam et
|
610
|
-
title: Ortak taslak oluştur
|
611
603
|
new_collaborative_draft_button:
|
612
604
|
new_collaborative_draft: Yeni ortak taslak
|
613
605
|
orders:
|
@@ -652,23 +644,14 @@ tr:
|
|
652
644
|
update:
|
653
645
|
error: Ortak taslak kaydedilirken hatalar oluştu.
|
654
646
|
success: Ortak taslak başarıyla güncellendi.
|
655
|
-
title: Ortak taslak düzenle
|
656
647
|
wizard_aside:
|
657
|
-
back: Geri
|
658
648
|
back_from_collaborative_draft: Ortak çalışmaya dayalı taslaklara dön
|
659
|
-
back_from_step_1: Ortak çalışmaya dayalı taslaklara dön
|
660
|
-
back_from_step_2: Ortak çalışmaya dayalı taslaklara dön
|
661
|
-
back_from_step_3: Ortak taslakları karşılaştırmak için geri dön
|
662
|
-
back_from_step_4: Taslağı düzenlemeye dön
|
663
649
|
info: <strong> Ortak çalışmaya dayalı bir taslak </strong> oluşturuyorsunuz.
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
step_3: Ortak çalışma taslağınızı tamamlayın
|
670
|
-
step_of: '%{total_steps}adımdan %{current_step_num}'
|
671
|
-
title: İşbirliğine dayalı taslak oluşturma adımları
|
650
|
+
wizard_header:
|
651
|
+
title: Ortak çalışmaya dayalı taslağınızı oluşturun
|
652
|
+
content_blocks:
|
653
|
+
highlighted_proposals:
|
654
|
+
proposals: Teklifler
|
672
655
|
create:
|
673
656
|
error: Teklif kaydedilirken bir sorun oluştu.
|
674
657
|
success: Teklif başarıyla oluşturuldu. Taslak olarak kaydedildi.
|
@@ -721,6 +704,8 @@ tr:
|
|
721
704
|
proposals_count:
|
722
705
|
one: "%{count} teklif"
|
723
706
|
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>
|
724
709
|
edit:
|
725
710
|
add_documents: Dokümanlar
|
726
711
|
add_images: Dosya
|
@@ -781,6 +766,8 @@ tr:
|
|
781
766
|
document_index: Belge indeksi
|
782
767
|
view_index:
|
783
768
|
see_index: Endeksi görmek
|
769
|
+
placeholder:
|
770
|
+
address: Teklif adresi
|
784
771
|
preview:
|
785
772
|
modify: Teklifi değiştir
|
786
773
|
proposal_edit_before_minutes:
|
@@ -788,6 +775,7 @@ tr:
|
|
788
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.
|
789
776
|
publish: Yayınla
|
790
777
|
title: Teklifinizi yayınlayın
|
778
|
+
update_position: Konumu güncelle
|
791
779
|
proposal:
|
792
780
|
creation_date: 'Oluşturma: %{date}'
|
793
781
|
view_proposal: Teklifi görüntüle
|
data/config/locales/uk.yml
CHANGED
@@ -139,10 +139,6 @@ uk:
|
|
139
139
|
email_outro: Ви отримали це сповіщення, тому що ви стежите за %{participatory_space_title}. Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
|
140
140
|
email_subject: У %{participatory_space_title} почалось голосування щодо пропозицій
|
141
141
|
notification_title: Тепер в <a href="%{participatory_space_url}">%{participatory_space_title}</a> відкрилась можливість <a href="%{resource_path}">голосувати щодо пропозицій</a>
|
142
|
-
participatory_processes:
|
143
|
-
participatory_process_groups:
|
144
|
-
highlighted_proposals:
|
145
|
-
proposals: Пропозиції
|
146
142
|
proposals:
|
147
143
|
actions:
|
148
144
|
import: Запозичити з іншої складової
|
@@ -230,10 +226,6 @@ uk:
|
|
230
226
|
official: Службове
|
231
227
|
filter_state_values:
|
232
228
|
not_answered: Без відповідей
|
233
|
-
collaborative_drafts:
|
234
|
-
wizard_steps:
|
235
|
-
see_steps: переглянути кроки
|
236
|
-
step_of: '%{current_step_num}-й крок з %{total_steps} кроків'
|
237
229
|
create:
|
238
230
|
error: При спробі збереження цієї пропозиції сталися помилки.
|
239
231
|
success: Пропозицію успішно створено. Збережено як чернетку.
|
data/config/locales/zh-CN.yml
CHANGED
@@ -324,10 +324,6 @@ zh-CN:
|
|
324
324
|
description: 支持提议的数量
|
325
325
|
object: 支持
|
326
326
|
title: 支持
|
327
|
-
participatory_processes:
|
328
|
-
participatory_process_groups:
|
329
|
-
highlighted_proposals:
|
330
|
-
proposals: 建议
|
331
327
|
participatory_spaces:
|
332
328
|
highlighted_proposals:
|
333
329
|
see_all: 查看所有建议 (%{count})
|
@@ -344,7 +340,6 @@ zh-CN:
|
|
344
340
|
actions:
|
345
341
|
preview: 预览
|
346
342
|
exports:
|
347
|
-
comments: 评论
|
348
343
|
proposals: 建议
|
349
344
|
models:
|
350
345
|
proposal:
|
@@ -368,9 +363,7 @@ zh-CN:
|
|
368
363
|
new_import:
|
369
364
|
accepted_mime_types:
|
370
365
|
md: Markdown
|
371
|
-
odt: 好的
|
372
366
|
bottom_hint: "(您将能够预览和排序文档部分)"
|
373
|
-
document_legend: '添加一个小于2MB的文档,每个部分直到3级深度将被解析为建议书。支持的格式为: %{valid_mime_types}'
|
374
367
|
title: 添加文档
|
375
368
|
upload_document: 上传文档
|
376
369
|
publish:
|
@@ -555,13 +548,6 @@ zh-CN:
|
|
555
548
|
ok: 撤回协作草稿
|
556
549
|
title: 以下操作是不可逆的
|
557
550
|
success: 协作草案已成功撤销。
|
558
|
-
compare:
|
559
|
-
mine_is_different: 我的合作草稿是不同的
|
560
|
-
no_similars_found: 干得好!找不到类似的协作草稿
|
561
|
-
title: 类似的合作草稿
|
562
|
-
complete:
|
563
|
-
send: 发送
|
564
|
-
title: 完成您的协作草稿
|
565
551
|
count:
|
566
552
|
drafts_count:
|
567
553
|
other: "%{count} 协作草稿"
|
@@ -592,7 +578,6 @@ zh-CN:
|
|
592
578
|
unfold: 展开...
|
593
579
|
new:
|
594
580
|
send: 继续
|
595
|
-
title: 创建您的协作草稿
|
596
581
|
new_collaborative_draft_button:
|
597
582
|
new_collaborative_draft: 新的协作草稿
|
598
583
|
orders:
|
@@ -636,23 +621,11 @@ zh-CN:
|
|
636
621
|
update:
|
637
622
|
error: 保存合作草稿时出现问题。
|
638
623
|
success: 协作草稿已成功更新。
|
639
|
-
title: 编辑协作草稿
|
640
624
|
wizard_aside:
|
641
|
-
back: 后退
|
642
625
|
back_from_collaborative_draft: 返回协作草稿
|
643
|
-
back_from_step_1: 返回协作草稿
|
644
|
-
back_from_step_2: 返回协作草稿
|
645
|
-
back_from_step_3: 返回比较协作草稿
|
646
|
-
back_from_step_4: 返回编辑草稿
|
647
626
|
info: 您正在创建一个 <strong>协作草案</strong>。
|
648
|
-
|
649
|
-
|
650
|
-
see_steps: 查看步骤
|
651
|
-
step_1: 创建您的协作草稿
|
652
|
-
step_2: 与协作草稿比较
|
653
|
-
step_3: 完成您的协作草稿
|
654
|
-
step_of: 步骤 %{current_step_num} / %{total_steps}
|
655
|
-
title: 协作创建步骤草案
|
627
|
+
wizard_header:
|
628
|
+
title: 创建您的协作草稿
|
656
629
|
create:
|
657
630
|
error: 保存建议时出现问题。
|
658
631
|
success: 建议已成功创建为草稿。
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddFollowableCounterCacheToProposals < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_column :decidim_proposals_proposals, :follows_count, :integer, null: false, default: 0, index: true
|
6
|
+
|
7
|
+
reversible do |dir|
|
8
|
+
dir.up do
|
9
|
+
Decidim::Proposals::Proposal.reset_column_information
|
10
|
+
Decidim::Proposals::Proposal.find_each do |record|
|
11
|
+
record.class.reset_counters(record.id, :follows)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddFollowableCounterCacheToCollaborativeDrafts < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_column :decidim_proposals_collaborative_drafts, :follows_count, :integer, null: false, default: 0, index: true
|
6
|
+
|
7
|
+
reversible do |dir|
|
8
|
+
dir.up do
|
9
|
+
Decidim::Proposals::CollaborativeDraft.reset_column_information
|
10
|
+
Decidim::Proposals::CollaborativeDraft.find_each do |record|
|
11
|
+
record.class.reset_counters(record.id, :follows)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -2,14 +2,16 @@
|
|
2
2
|
|
3
3
|
class FixCountersForCopiedProposals < ActiveRecord::Migration[5.2]
|
4
4
|
def up
|
5
|
-
copies_ids = Decidim::ResourceLink
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
).pluck(:to_id)
|
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)
|
11
10
|
|
12
|
-
Decidim::Proposals::Proposal.where(id: copies_ids).find_each
|
11
|
+
Decidim::Proposals::Proposal.where(id: copies_ids).find_each do |record|
|
12
|
+
record.class.reset_counters(record.id, :follows)
|
13
|
+
record.update_comments_count
|
14
|
+
end
|
13
15
|
end
|
14
16
|
|
15
17
|
def down; end
|
File without changes
|
@@ -9,14 +9,12 @@ module Decidim
|
|
9
9
|
graphql_name "ProposalSort"
|
10
10
|
description "A type used for sorting proposals"
|
11
11
|
|
12
|
-
argument :id, String, "Sort by ID, valid values are ASC or DESC", required: false
|
12
|
+
argument :id, GraphQL::Types::String, "Sort by ID, valid values are ASC or DESC", required: false
|
13
13
|
argument :vote_count,
|
14
|
-
type: String,
|
14
|
+
type: GraphQL::Types::String,
|
15
15
|
description: "Sort by number of votes, valid values are ASC or DESC. Will be ignored if votes are hidden",
|
16
16
|
required: false,
|
17
|
-
|
18
|
-
{ proposal_votes_count: value }
|
19
|
-
end
|
17
|
+
as: :proposal_votes_count
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
class ProposalType < Decidim::Api::Types::BaseObject
|
6
|
+
description "A proposal"
|
7
|
+
|
8
|
+
implements Decidim::Comments::CommentableInterface
|
9
|
+
implements Decidim::Core::CoauthorableInterface
|
10
|
+
implements Decidim::Core::CategorizableInterface
|
11
|
+
implements Decidim::Core::ScopableInterface
|
12
|
+
implements Decidim::Core::AttachableInterface
|
13
|
+
implements Decidim::Core::FingerprintInterface
|
14
|
+
implements Decidim::Core::AmendableInterface
|
15
|
+
implements Decidim::Core::AmendableEntityInterface
|
16
|
+
implements Decidim::Core::TraceableInterface
|
17
|
+
implements Decidim::Core::EndorsableInterface
|
18
|
+
implements Decidim::Core::TimestampsInterface
|
19
|
+
|
20
|
+
field :id, GraphQL::Types::ID, null: false
|
21
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this title", null: true
|
22
|
+
field :body, Decidim::Core::TranslatedFieldType, "The description for this body", null: true
|
23
|
+
field :address, GraphQL::Types::String, "The physical address (location) of this proposal", null: true
|
24
|
+
field :coordinates, Decidim::Core::CoordinatesType, "Physical coordinates for this proposal", null: true
|
25
|
+
|
26
|
+
def coordinates
|
27
|
+
[object.latitude, object.longitude]
|
28
|
+
end
|
29
|
+
field :reference, GraphQL::Types::String, "This proposal's unique reference", null: true
|
30
|
+
field :state, GraphQL::Types::String, "The answer status in which proposal is in", null: true
|
31
|
+
field :answer, Decidim::Core::TranslatedFieldType, "The answer feedback for the status for this proposal", null: true
|
32
|
+
|
33
|
+
field :answered_at, Decidim::Core::DateTimeType, description: "The date and time this proposal was answered", null: true
|
34
|
+
|
35
|
+
field :published_at, Decidim::Core::DateTimeType, description: "The date and time this proposal was published", null: true
|
36
|
+
|
37
|
+
field :participatory_text_level, GraphQL::Types::String, description: "If it is a participatory text, the level indicates the type of paragraph", null: true
|
38
|
+
field :position, GraphQL::Types::Int, "Position of this proposal in the participatory text", null: true
|
39
|
+
|
40
|
+
field :official, GraphQL::Types::Boolean, "Whether this proposal is official or not", method: :official?, null: true
|
41
|
+
field :created_in_meeting, GraphQL::Types::Boolean, "Whether this proposal comes from a meeting or not", method: :official_meeting?, null: true
|
42
|
+
field :meeting, Decidim::Meetings::MeetingType, description: "If the proposal comes from a meeting, the related meeting", null: true
|
43
|
+
|
44
|
+
def meeting
|
45
|
+
object.authors.first if object.official_meeting?
|
46
|
+
end
|
47
|
+
|
48
|
+
field :vote_count, GraphQL::Types::Int, description: "The total amount of votes the proposal has received", null: true
|
49
|
+
|
50
|
+
def vote_count
|
51
|
+
current_component = object.component
|
52
|
+
object.proposal_votes_count unless current_component.current_settings.votes_hidden?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
class ProposalListHelper < Decidim::Core::ComponentListBase
|
6
|
+
# only querying published posts
|
7
|
+
def query_scope
|
8
|
+
super.published
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class ProposalFinderHelper < Decidim::Core::ComponentFinderBase
|
13
|
+
# only querying published posts
|
14
|
+
def query_scope
|
15
|
+
super.published
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class ProposalsType < Decidim::Api::Types::BaseObject
|
20
|
+
implements Decidim::Core::ComponentInterface
|
21
|
+
|
22
|
+
graphql_name "Proposals"
|
23
|
+
description "A proposals component of a participatory space."
|
24
|
+
|
25
|
+
field :proposals, type: Decidim::Proposals::ProposalType.connection_type, description: "List all proposals", connection: true, null: true do
|
26
|
+
argument :order, Decidim::Proposals::ProposalInputSort, "Provides several methods to order the results", required: false
|
27
|
+
argument :filter, Decidim::Proposals::ProposalInputFilter, "Provides several methods to filter the results", required: false
|
28
|
+
end
|
29
|
+
|
30
|
+
field :proposal, type: Decidim::Proposals::ProposalType, description: "Finds one proposal", null: true do
|
31
|
+
argument :id, GraphQL::Types::ID, "The ID of the proposal", required: true
|
32
|
+
end
|
33
|
+
|
34
|
+
def proposals(filter: {}, order: {})
|
35
|
+
Decidim::Proposals::ProposalListHelper.new(model_class: Proposal).call(object, { filter: filter, order: order }, context)
|
36
|
+
end
|
37
|
+
|
38
|
+
def proposal(id:)
|
39
|
+
Decidim::Proposals::ProposalFinderHelper.new(model_class: Proposal).call(object, { id: id }, context)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -10,7 +10,7 @@ module Decidim
|
|
10
10
|
# @see BaseRenderer Examples of how to use a content renderer
|
11
11
|
class ProposalRenderer < BaseRenderer
|
12
12
|
# Matches a global id representing a Decidim::User
|
13
|
-
GLOBAL_ID_REGEX = %r{gid
|
13
|
+
GLOBAL_ID_REGEX = %r{gid://([\w-]*/Decidim::Proposals::Proposal/(\d+))}i.freeze
|
14
14
|
|
15
15
|
# Replaces found Global IDs matching an existing proposal with
|
16
16
|
# a link to its show page. The Global IDs representing an
|
data/lib/decidim/proposals.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "decidim/proposals/admin"
|
4
|
+
require "decidim/proposals/api"
|
4
5
|
require "decidim/proposals/engine"
|
5
6
|
require "decidim/proposals/admin_engine"
|
6
7
|
require "decidim/proposals/component"
|
@@ -11,6 +12,7 @@ module Decidim
|
|
11
12
|
# allows users to create proposals in a participatory process.
|
12
13
|
module Proposals
|
13
14
|
autoload :ProposalSerializer, "decidim/proposals/proposal_serializer"
|
15
|
+
autoload :ProposalCreator, "decidim/proposals/proposal_creator"
|
14
16
|
autoload :CommentableProposal, "decidim/proposals/commentable_proposal"
|
15
17
|
autoload :CommentableCollaborativeDraft, "decidim/proposals/commentable_collaborative_draft"
|
16
18
|
autoload :MarkdownToProposals, "decidim/proposals/markdown_to_proposals"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
autoload :ProposalInputFilter, "decidim/api/proposal_input_filter"
|
6
|
+
autoload :ProposalInputSort, "decidim/api/proposal_input_sort"
|
7
|
+
autoload :ProposalType, "decidim/api/proposal_type"
|
8
|
+
autoload :ProposalsType, "decidim/api/proposals_type"
|
9
|
+
end
|
10
|
+
end
|
@@ -5,6 +5,7 @@ require "decidim/components/namer"
|
|
5
5
|
Decidim.register_component(:proposals) do |component|
|
6
6
|
component.engine = Decidim::Proposals::Engine
|
7
7
|
component.admin_engine = Decidim::Proposals::AdminEngine
|
8
|
+
component.stylesheet = "decidim/proposals/proposals"
|
8
9
|
component.icon = "decidim/proposals/icon.svg"
|
9
10
|
|
10
11
|
component.on(:before_destroy) do |instance|
|
@@ -28,6 +29,7 @@ Decidim.register_component(:proposals) do |component|
|
|
28
29
|
settings.attribute :minimum_votes_per_user, type: :integer, default: 0
|
29
30
|
settings.attribute :proposal_limit, type: :integer, default: 0
|
30
31
|
settings.attribute :proposal_length, type: :integer, default: 500
|
32
|
+
settings.attribute :proposal_edit_time, type: :enum, default: "limited", choices: -> { %w(limited infinite) }
|
31
33
|
settings.attribute :proposal_edit_before_minutes, type: :integer, default: 5
|
32
34
|
settings.attribute :threshold_per_proposal, type: :integer, default: 0
|
33
35
|
settings.attribute :can_accumulate_supports_beyond_threshold, type: :boolean, default: false
|
@@ -80,6 +82,7 @@ Decidim.register_component(:proposals) do |component|
|
|
80
82
|
resource.model_class_name = "Decidim::Proposals::Proposal"
|
81
83
|
resource.template = "decidim/proposals/proposals/linked_proposals"
|
82
84
|
resource.card = "decidim/proposals/proposal"
|
85
|
+
resource.reported_content_cell = "decidim/proposals/reported_content"
|
83
86
|
resource.actions = %w(endorse vote amend)
|
84
87
|
resource.searchable = true
|
85
88
|
end
|
@@ -87,6 +90,7 @@ Decidim.register_component(:proposals) do |component|
|
|
87
90
|
component.register_resource(:collaborative_draft) do |resource|
|
88
91
|
resource.model_class_name = "Decidim::Proposals::CollaborativeDraft"
|
89
92
|
resource.card = "decidim/proposals/collaborative_draft"
|
93
|
+
resource.reported_content_cell = "decidim/proposals/collaborative_drafts/reported_content"
|
90
94
|
end
|
91
95
|
|
92
96
|
component.register_stat :proposals_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, start_at, end_at|
|
@@ -138,16 +142,22 @@ Decidim.register_component(:proposals) do |component|
|
|
138
142
|
exports.serializer Decidim::Proposals::ProposalSerializer
|
139
143
|
end
|
140
144
|
|
141
|
-
component.exports :
|
145
|
+
component.exports :proposal_comments do |exports|
|
142
146
|
exports.collection do |component_instance|
|
143
147
|
Decidim::Comments::Export.comments_for_resource(
|
144
148
|
Decidim::Proposals::Proposal, component_instance
|
145
149
|
)
|
146
150
|
end
|
147
151
|
|
152
|
+
exports.include_in_open_data = true
|
153
|
+
|
148
154
|
exports.serializer Decidim::Comments::CommentSerializer
|
149
155
|
end
|
150
156
|
|
157
|
+
component.imports :proposals do |imports|
|
158
|
+
imports.creator Decidim::Proposals::ProposalCreator
|
159
|
+
end
|
160
|
+
|
151
161
|
component.seeds do |participatory_space|
|
152
162
|
admin_user = Decidim::User.find_by(
|
153
163
|
organization: participatory_space.organization,
|
@@ -191,13 +201,13 @@ Decidim.register_component(:proposals) do |component|
|
|
191
201
|
|
192
202
|
5.times do |n|
|
193
203
|
state, answer, state_published_at = if n > 3
|
194
|
-
["accepted", Decidim::Faker::Localized.sentence(10), Time.current]
|
204
|
+
["accepted", Decidim::Faker::Localized.sentence(word_count: 10), Time.current]
|
195
205
|
elsif n > 2
|
196
206
|
["rejected", nil, Time.current]
|
197
207
|
elsif n > 1
|
198
208
|
["evaluating", nil, Time.current]
|
199
209
|
elsif n.positive?
|
200
|
-
["accepted", Decidim::Faker::Localized.sentence(10), nil]
|
210
|
+
["accepted", Decidim::Faker::Localized.sentence(word_count: 10), nil]
|
201
211
|
else
|
202
212
|
[nil, nil, nil]
|
203
213
|
end
|
@@ -205,9 +215,9 @@ Decidim.register_component(:proposals) do |component|
|
|
205
215
|
params = {
|
206
216
|
component: component,
|
207
217
|
category: participatory_space.categories.sample,
|
208
|
-
scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
|
209
|
-
title: { en: Faker::Lorem.sentence(2) },
|
210
|
-
body: { en: Faker::Lorem.paragraphs(2).join("\n") },
|
218
|
+
scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
|
219
|
+
title: { en: Faker::Lorem.sentence(word_count: 2) },
|
220
|
+
body: { en: Faker::Lorem.paragraphs(number: 2).join("\n") },
|
211
221
|
state: state,
|
212
222
|
answer: answer,
|
213
223
|
answered_at: state.present? ? Time.current : nil,
|
@@ -271,9 +281,9 @@ Decidim.register_component(:proposals) do |component|
|
|
271
281
|
params = {
|
272
282
|
component: component,
|
273
283
|
category: participatory_space.categories.sample,
|
274
|
-
scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
|
275
|
-
title: { en: "#{proposal.title["en"]} #{Faker::Lorem.sentence(1)}" },
|
276
|
-
body: { en: "#{proposal.body["en"]} #{Faker::Lorem.sentence(3)}" },
|
284
|
+
scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
|
285
|
+
title: { en: "#{proposal.title["en"]} #{Faker::Lorem.sentence(word_count: 1)}" },
|
286
|
+
body: { en: "#{proposal.body["en"]} #{Faker::Lorem.sentence(word_count: 3)}" },
|
277
287
|
state: "evaluating",
|
278
288
|
answer: nil,
|
279
289
|
answered_at: Time.current,
|
@@ -314,7 +324,7 @@ Decidim.register_component(:proposals) do |component|
|
|
314
324
|
tos_agreement: "1",
|
315
325
|
confirmed_at: Time.current,
|
316
326
|
personal_url: Faker::Internet.url,
|
317
|
-
about: Faker::Lorem.paragraph(2)
|
327
|
+
about: Faker::Lorem.paragraph(sentence_count: 2)
|
318
328
|
)
|
319
329
|
|
320
330
|
Decidim::Proposals::ProposalVote.create!(proposal: proposal, author: author) unless proposal.published_state? && proposal.rejected?
|
@@ -366,7 +376,7 @@ Decidim.register_component(:proposals) do |component|
|
|
366
376
|
Decidim::Proposals::ProposalNote.create!(
|
367
377
|
proposal: proposal,
|
368
378
|
author: author_admin,
|
369
|
-
body: Faker::Lorem.paragraphs(2).join("\n")
|
379
|
+
body: Faker::Lorem.paragraphs(number: 2).join("\n")
|
370
380
|
)
|
371
381
|
end
|
372
382
|
|
@@ -388,9 +398,9 @@ Decidim.register_component(:proposals) do |component|
|
|
388
398
|
draft = Decidim::Proposals::CollaborativeDraft.new(
|
389
399
|
component: component,
|
390
400
|
category: participatory_space.categories.sample,
|
391
|
-
scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
|
392
|
-
title: Faker::Lorem.sentence(2),
|
393
|
-
body: Faker::Lorem.paragraphs(2).join("\n"),
|
401
|
+
scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
|
402
|
+
title: Faker::Lorem.sentence(word_count: 2),
|
403
|
+
body: Faker::Lorem.paragraphs(number: 2).join("\n"),
|
394
404
|
state: state,
|
395
405
|
published_at: Time.current
|
396
406
|
)
|
@@ -399,7 +409,8 @@ Decidim.register_component(:proposals) do |component|
|
|
399
409
|
draft
|
400
410
|
end
|
401
411
|
|
402
|
-
|
412
|
+
case n
|
413
|
+
when 2
|
403
414
|
author2 = Decidim::User.where(organization: component.organization).all.sample
|
404
415
|
Decidim::Coauthorship.create(coauthorable: draft, author: author2)
|
405
416
|
author3 = Decidim::User.where(organization: component.organization).all.sample
|
@@ -410,7 +421,7 @@ Decidim.register_component(:proposals) do |component|
|
|
410
421
|
Decidim::Coauthorship.create(coauthorable: draft, author: author5)
|
411
422
|
author6 = Decidim::User.where(organization: component.organization).all.sample
|
412
423
|
Decidim::Coauthorship.create(coauthorable: draft, author: author6)
|
413
|
-
|
424
|
+
when 3
|
414
425
|
author2 = Decidim::User.where(organization: component.organization).all.sample
|
415
426
|
Decidim::Coauthorship.create(coauthorable: draft, author: author2)
|
416
427
|
end
|
@@ -423,9 +434,9 @@ Decidim.register_component(:proposals) do |component|
|
|
423
434
|
Decidim::User.where(organization: component.organization).all.sample,
|
424
435
|
component: component,
|
425
436
|
category: participatory_space.categories.sample,
|
426
|
-
scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
|
427
|
-
title: Faker::Lorem.sentence(2),
|
428
|
-
body: Faker::Lorem.paragraphs(2).join("\n")
|
437
|
+
scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
|
438
|
+
title: Faker::Lorem.sentence(word_count: 2),
|
439
|
+
body: Faker::Lorem.paragraphs(number: 2).join("\n")
|
429
440
|
)
|
430
441
|
end
|
431
442
|
end
|