decidim-debates 0.21.0 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/gamification/badges/commented_debates.svg +1 -78
  3. data/app/cells/decidim/debates/debate_activity_cell.rb +4 -0
  4. data/app/cells/decidim/debates/debate_m/data.erb +10 -8
  5. data/app/cells/decidim/debates/debate_m/footer.erb +6 -1
  6. data/app/cells/decidim/debates/debate_m/multiple_dates.erb +1 -1
  7. data/app/cells/decidim/debates/debate_m_cell.rb +24 -2
  8. data/app/commands/decidim/debates/admin/close_debate.rb +54 -0
  9. data/app/commands/decidim/debates/admin/create_debate.rb +4 -2
  10. data/app/commands/decidim/debates/admin/update_debate.rb +5 -2
  11. data/app/commands/decidim/debates/close_debate.rb +58 -0
  12. data/app/commands/decidim/debates/create_debate.rb +17 -12
  13. data/app/commands/decidim/debates/update_debate.rb +56 -0
  14. data/app/controllers/decidim/debates/admin/debate_closes_controller.rb +43 -0
  15. data/app/controllers/decidim/debates/admin/debates_controller.rb +4 -2
  16. data/app/controllers/decidim/debates/debates_controller.rb +70 -9
  17. data/app/controllers/decidim/debates/orderable.rb +41 -0
  18. data/app/controllers/decidim/debates/versions_controller.rb +16 -0
  19. data/app/controllers/decidim/debates/widgets_controller.rb +19 -0
  20. data/app/events/decidim/debates/close_debate_event.rb +15 -0
  21. data/app/events/decidim/debates/create_debate_event.rb +0 -2
  22. data/app/forms/decidim/debates/admin/close_debate_form.rb +34 -0
  23. data/app/forms/decidim/debates/admin/debate_form.rb +5 -1
  24. data/app/forms/decidim/debates/close_debate_form.rb +39 -0
  25. data/app/forms/decidim/debates/debate_form.rb +27 -1
  26. data/app/helpers/decidim/debates/admin/application_helper.rb +13 -0
  27. data/app/helpers/decidim/debates/application_helper.rb +37 -1
  28. data/app/models/decidim/debates/debate.rb +67 -12
  29. data/app/permissions/decidim/debates/admin/permissions.rb +3 -1
  30. data/app/permissions/decidim/debates/permissions.rb +28 -0
  31. data/app/presenters/decidim/debates/admin_log/debate_presenter.rb +6 -2
  32. data/app/presenters/decidim/debates/admin_log/value_types/debate_title_description_presenter.rb +20 -0
  33. data/app/presenters/decidim/debates/debate_presenter.rb +62 -7
  34. data/app/presenters/decidim/debates/log/resource_presenter.rb +18 -0
  35. data/app/presenters/decidim/debates/official_author_presenter.rb +1 -29
  36. data/app/queries/decidim/debates/metrics/debates_metric_manage.rb +2 -8
  37. data/app/services/decidim/debates/debate_search.rb +13 -23
  38. data/app/services/decidim/debates/diff_renderer.rb +27 -0
  39. data/app/views/decidim/debates/admin/debate_closes/edit.html.erb +17 -0
  40. data/app/views/decidim/debates/admin/debates/_form.html.erb +5 -5
  41. data/app/views/decidim/debates/admin/debates/index.html.erb +7 -1
  42. data/app/views/decidim/debates/debates/_close_debate_modal.html.erb +13 -0
  43. data/app/views/decidim/debates/debates/_debates.html.erb +7 -0
  44. data/app/views/decidim/debates/debates/_filters.html.erb +20 -6
  45. data/app/views/decidim/debates/debates/_form.html.erb +19 -0
  46. data/app/views/decidim/debates/debates/edit.html.erb +24 -0
  47. data/app/views/decidim/debates/debates/index.html.erb +4 -5
  48. data/app/views/decidim/debates/debates/new.html.erb +7 -26
  49. data/app/views/decidim/debates/debates/show.html.erb +87 -9
  50. data/app/views/decidim/debates/versions/index.html.erb +8 -0
  51. data/app/views/decidim/debates/versions/show.html.erb +10 -0
  52. data/config/locales/am-ET.yml +1 -0
  53. data/config/locales/ar.yml +2 -1
  54. data/config/locales/bg-BG.yml +7 -0
  55. data/config/locales/bg.yml +15 -0
  56. data/config/locales/ca.yml +73 -1
  57. data/config/locales/cs.yml +112 -40
  58. data/config/locales/da-DK.yml +1 -0
  59. data/config/locales/da.yml +1 -0
  60. data/config/locales/de.yml +95 -23
  61. data/config/locales/el.yml +154 -0
  62. data/config/locales/en.yml +73 -1
  63. data/config/locales/eo.yml +1 -0
  64. data/config/locales/es-MX.yml +73 -1
  65. data/config/locales/es-PY.yml +73 -1
  66. data/config/locales/es.yml +73 -1
  67. data/config/locales/et-EE.yml +1 -0
  68. data/config/locales/et.yml +1 -0
  69. data/config/locales/eu.yml +2 -1
  70. data/config/locales/fi-plain.yml +73 -1
  71. data/config/locales/fi.yml +78 -6
  72. data/config/locales/fr-CA.yml +223 -0
  73. data/config/locales/fr.yml +73 -1
  74. data/config/locales/ga-IE.yml +1 -0
  75. data/config/locales/gl.yml +7 -1
  76. data/config/locales/hr-HR.yml +1 -0
  77. data/config/locales/hr.yml +1 -0
  78. data/config/locales/hu.yml +26 -1
  79. data/config/locales/id-ID.yml +2 -1
  80. data/config/locales/is-IS.yml +2 -1
  81. data/config/locales/is.yml +102 -0
  82. data/config/locales/it.yml +45 -10
  83. data/config/locales/ja-JP.yml +195 -0
  84. data/config/locales/ja.yml +221 -0
  85. data/config/locales/ko-KR.yml +1 -0
  86. data/config/locales/ko.yml +1 -0
  87. data/config/locales/lt-LT.yml +1 -0
  88. data/config/locales/lt.yml +1 -0
  89. data/config/locales/lv.yml +135 -0
  90. data/config/locales/mt-MT.yml +1 -0
  91. data/config/locales/mt.yml +1 -0
  92. data/config/locales/nl.yml +50 -2
  93. data/config/locales/no.yml +117 -71
  94. data/config/locales/om-ET.yml +1 -0
  95. data/config/locales/pl.yml +100 -45
  96. data/config/locales/pt-BR.yml +3 -4
  97. data/config/locales/pt.yml +56 -36
  98. data/config/locales/ro-RO.yml +173 -0
  99. data/config/locales/ru.yml +2 -1
  100. data/config/locales/si-LK.yml +1 -0
  101. data/config/locales/sk-SK.yml +156 -0
  102. data/config/locales/sk.yml +157 -0
  103. data/config/locales/sl.yml +22 -0
  104. data/config/locales/so-SO.yml +1 -0
  105. data/config/locales/sr-CS.yml +6 -0
  106. data/config/locales/sv.yml +60 -1
  107. data/config/locales/sw-KE.yml +1 -0
  108. data/config/locales/ti-ER.yml +1 -0
  109. data/config/locales/tr-TR.yml +103 -31
  110. data/config/locales/uk.yml +2 -1
  111. data/config/locales/vi-VN.yml +1 -0
  112. data/config/locales/vi.yml +1 -0
  113. data/config/locales/zh-CN.yml +218 -0
  114. data/config/locales/zh-TW.yml +1 -0
  115. data/db/migrate/20200320105918_index_foreign_keys_in_decidim_debates_debates.rb +7 -0
  116. data/db/migrate/20200703134657_close_debates.rb +9 -0
  117. data/db/migrate/20200708072042_fix_debates_i18n_fields.rb +48 -0
  118. data/db/migrate/20200716143929_add_endorsable_to_debates.rb +8 -0
  119. data/db/migrate/20200827154116_add_commentable_counter_cache_to_debates.rb +14 -0
  120. data/db/migrate/20200902133452_add_cached_comment_metadata_to_debates.rb +23 -0
  121. data/lib/decidim/debates/admin_engine.rb +3 -1
  122. data/lib/decidim/debates/component.rb +44 -1
  123. data/lib/decidim/debates/engine.rb +7 -1
  124. data/lib/decidim/debates/test/factories.rb +62 -6
  125. data/lib/decidim/debates/version.rb +1 -1
  126. metadata +85 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24ecd1ca0fa6741a77421c6b5112305b9201676dd84b2919c2a9928d9dbd733d
4
- data.tar.gz: 74033142cb4faa0833f9825c922b6aec32a9b2ed45f14928f6277686641b0405
3
+ metadata.gz: c47dbcc65279eb8e3624a1be71fc66ca2a744216fd06bb5c744662e5bc0ecaca
4
+ data.tar.gz: a9f04220070a77050aa9c92ec19b7a738098c75a62cb0d24ceaecec105739194
5
5
  SHA512:
6
- metadata.gz: 8816ad224e66345561250ca0b7c53639c1d3984262cc38642e4d194e3a4533687e38edeeb492765e51c078775f325237e3a05414109c9ce52cfea8378fc6cbd1
7
- data.tar.gz: 422fb26a1ea59bd93f421527d7608c420d6b21c78c3c7353b49944af77b4c71d2a2cf221a4c39d1fcfdd514a2ccb7543ecc16a4587af3c42a72f755315783a6c
6
+ metadata.gz: d80ca09bf4782d4eaf18e3aabd6cd5e790f9edd3de608b6e61be265fe71f0f712eb3192ed8cf00d453f77ed1719c0bc09ee81573936e59ae4fa00ef1df624ed7
7
+ data.tar.gz: f3301123e0b354c5797049e120b0fbe2ec99cbeec73e53d77cbe9f2e12b9e8d63cfabaa337278bd2511113e7de01bddd2788138cf131421f6bd46489719c21ed
@@ -1,78 +1 @@
1
- <svg version="1.1" id="debates-svg"
2
- xmlns="http://www.w3.org/2000/svg"
3
- xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
4
- y="0px" width="1080px" height="1080px" viewBox="0 0 1080 1080" enable-background="new 0 0 1080 1080" xml:space="preserve">
5
- <g id="debates" class="stroke-primary">
6
- <g id="bubble">
7
- <path fill="none" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
8
- M787.237,226.039H282.916c-21.99,0-39.815,17.825-39.815,39.815v18.882l-97.325,60.747h97.325
9
- c0,21.989,17.826,39.815,39.815,39.815h504.321c21.989,0,39.814-17.826,39.814-39.815v-79.629
10
- C827.052,243.864,809.227,226.039,787.237,226.039z"/>
11
- <circle class="fill-primary" id="_x35_0-pct_17_" fill="#31536E" fill-opacity="0.5" cx="419.45" cy="304.983" r="28.217"/>
12
- <circle class="fill-primary" id="_x35_0-pct_16_" fill="#31536E" fill-opacity="0.5" cx="525.623" cy="304.983" r="28.217"/>
13
- <circle class="fill-primary" id="_x35_0-pct_15_" fill="#31536E" fill-opacity="0.5" cx="631.796" cy="304.983" r="28.217"/>
14
- </g>
15
- <g id="bubble_1_">
16
- <path class="fill-primary" id="_x32_5-pct_16_" fill="#31536E" fill-opacity="0.25" d="M787.237,690.545H282.916c-25.857,0-46.894,21.036-46.894,46.894
17
- v14.956l-93.995,58.67c-2.68,1.672-3.926,4.916-3.057,7.953c0.87,3.035,3.646,5.129,6.805,5.129h90.78
18
- c3.422,22.511,22.908,39.814,46.36,39.814h504.321c25.856,0,46.892-21.036,46.892-46.894v-79.629
19
- C834.129,711.581,813.094,690.545,787.237,690.545z"/>
20
- <circle class="fill-primary" id="_x35_0-pct_12_" fill="#31536E" fill-opacity="0.5" cx="419.45" cy="776.567" r="28.217"/>
21
- <circle class="fill-primary" id="_x35_0-pct_13_" fill="#31536E" fill-opacity="0.5" cx="525.623" cy="776.567" r="28.217"/>
22
- <circle class="fill-primary" id="_x35_0-pct_14_" fill="#31536E" fill-opacity="0.5" cx="631.796" cy="776.567" r="28.217"/>
23
- </g>
24
- <g id="bubble_black">
25
- <path class="fill-primary" fill="#31536E" d="M937.098,575.391l-101.198-66.172v-15.054c0-25.757-13.768-38.968-39.814-38.968H291.763
26
- c-26.82,0-53.971,13.121-53.971,38.968v79.63c0,25.936,28.246,54.817,53.971,54.817h504.322c23.02,0,42.802-17.695,46.333-39.814
27
- h90.806c3.131,0,5.89-2.26,6.784-5.26C940.902,580.536,939.719,577.104,937.098,575.391z"/>
28
- <circle fill="#FFFFFF" fill-opacity="0.5" cx="641.854" cy="541.5" r="28.217"/>
29
- <circle fill="#FFFFFF" fill-opacity="0.5" cx="535.682" cy="541.5" r="28.217"/>
30
- <circle fill="#FFFFFF" fill-opacity="0.5" cx="429.509" cy="541.5" r="28.217"/>
31
- </g>
32
- <g id="stars_9" class="stars">
33
- <path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
34
- M731.204,149.355c0-14.688-18.667-35.355-35.354-35.355c15.354,0,35.354-20.333,35.354-35.355
35
- c0,15.022,16.666,35.355,35.354,35.355C747.537,114,731.204,134.667,731.204,149.355z"/>
36
- <g>
37
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="937.586" cy="323.411" r="13.5"/>
38
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="921.087" y1="306.676" x2="899.874" y2="285.463"/>
39
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="955.028" y1="340.617" x2="976.241" y2="361.83"/>
40
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="954.321" y1="307.383" x2="975.534" y2="286.17"/>
41
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="921.087" y1="340.617" x2="899.874" y2="361.83"/>
42
- </g>
43
- <g>
44
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="169.816" y1="626.094" x2="143.654" y2="652.258"/>
45
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="134.462" y1="661.449" x2="108.299" y2="687.613"/>
46
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="169.109" y1="687.613" x2="142.946" y2="661.449"/>
47
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="133.755" y1="652.258" x2="107.592" y2="626.094"/>
48
- </g>
49
- <path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
50
- M559.419,965.473c0,0-21.565,4.034-26.516,8.981c-4.948,4.948-8.982,26.517-8.982,26.517s-4.034-21.566-8.982-26.517
51
- c-4.948-4.947-26.516-8.981-26.516-8.981s22.077-4.547,26.516-8.983c4.438-4.438,8.982-26.515,8.982-26.515
52
- s4.034,21.564,8.982,26.515C537.852,961.438,559.419,965.473,559.419,965.473z"/>
53
- <g>
54
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="949.705" cy="649.667" r="16.604"/>
55
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="913.805" cy="649.667" r="6.433"/>
56
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="949.705" cy="685.568" r="6.432"/>
57
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="985.605" cy="649.667" r="6.433"/>
58
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="949.705" cy="613.766" r="6.432"/>
59
- </g>
60
- <g>
61
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="314.95" y1="78.973" x2="369.854" y2="133.878"/>
62
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="369.854" y1="78.973" x2="314.95" y2="133.878"/>
63
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="324.204" y1="106" x2="297.204" y2="106"/>
64
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="362.204" y1="106" x2="389.204" y2="106"/>
65
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="343.204" y1="125" x2="343.204" y2="152"/>
66
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="343.204" y1="87" x2="343.204" y2="60"/>
67
- </g>
68
- <g>
69
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="106.204" y1="356" x2="106.204" y2="435"/>
70
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="145.204" y1="396" x2="66.204" y2="396"/>
71
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="86.204" cy="415.5" r="7.039"/>
72
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="86.204" cy="375.5" r="7.039"/>
73
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="126.204" cy="415.5" r="7.039"/>
74
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="126.204" cy="375.5" r="7.039"/>
75
- </g>
76
- </g>
77
- </g>
78
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="debates-svg" width="1080" height="1080" x="0" y="0" enable-background="new 0 0 1080 1080" version="1.1" viewBox="0 0 1080 1080" xml:space="preserve"><g id="debates" class="stroke-primary"><g id="bubble"><path fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M787.237,226.039H282.916c-21.99,0-39.815,17.825-39.815,39.815v18.882l-97.325,60.747h97.325 c0,21.989,17.826,39.815,39.815,39.815h504.321c21.989,0,39.814-17.826,39.814-39.815v-79.629 C827.052,243.864,809.227,226.039,787.237,226.039z"/><circle id="_x35_0-pct_17_" cx="419.45" cy="304.983" r="28.217" fill="#31536E" fill-opacity=".5" class="fill-primary"/><circle id="_x35_0-pct_16_" cx="525.623" cy="304.983" r="28.217" fill="#31536E" fill-opacity=".5" class="fill-primary"/><circle id="_x35_0-pct_15_" cx="631.796" cy="304.983" r="28.217" fill="#31536E" fill-opacity=".5" class="fill-primary"/></g><g id="bubble_1_"><path id="_x32_5-pct_16_" fill="#31536E" fill-opacity=".25" d="M787.237,690.545H282.916c-25.857,0-46.894,21.036-46.894,46.894 v14.956l-93.995,58.67c-2.68,1.672-3.926,4.916-3.057,7.953c0.87,3.035,3.646,5.129,6.805,5.129h90.78 c3.422,22.511,22.908,39.814,46.36,39.814h504.321c25.856,0,46.892-21.036,46.892-46.894v-79.629 C834.129,711.581,813.094,690.545,787.237,690.545z" class="fill-primary"/><circle id="_x35_0-pct_12_" cx="419.45" cy="776.567" r="28.217" fill="#31536E" fill-opacity=".5" class="fill-primary"/><circle id="_x35_0-pct_13_" cx="525.623" cy="776.567" r="28.217" fill="#31536E" fill-opacity=".5" class="fill-primary"/><circle id="_x35_0-pct_14_" cx="631.796" cy="776.567" r="28.217" fill="#31536E" fill-opacity=".5" class="fill-primary"/></g><g id="bubble_black"><path fill="#31536E" d="M937.098,575.391l-101.198-66.172v-15.054c0-25.757-13.768-38.968-39.814-38.968H291.763 c-26.82,0-53.971,13.121-53.971,38.968v79.63c0,25.936,28.246,54.817,53.971,54.817h504.322c23.02,0,42.802-17.695,46.333-39.814 h90.806c3.131,0,5.89-2.26,6.784-5.26C940.902,580.536,939.719,577.104,937.098,575.391z" class="fill-primary"/><circle cx="641.854" cy="541.5" r="28.217" fill="#FFF" fill-opacity=".5"/><circle cx="535.682" cy="541.5" r="28.217" fill="#FFF" fill-opacity=".5"/><circle cx="429.509" cy="541.5" r="28.217" fill="#FFF" fill-opacity=".5"/></g><g id="stars_9" class="stars"><path fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4" d="M731.204,149.355c0-14.688-18.667-35.355-35.354-35.355c15.354,0,35.354-20.333,35.354-35.355 c0,15.022,16.666,35.355,35.354,35.355C747.537,114,731.204,134.667,731.204,149.355z"/><g><circle cx="937.586" cy="323.411" r="13.5" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="921.087" x2="899.874" y1="306.676" y2="285.463" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="955.028" x2="976.241" y1="340.617" y2="361.83" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="954.321" x2="975.534" y1="307.383" y2="286.17" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="921.087" x2="899.874" y1="340.617" y2="361.83" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="169.816" x2="143.654" y1="626.094" y2="652.258" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="134.462" x2="108.299" y1="661.449" y2="687.613" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="169.109" x2="142.946" y1="687.613" y2="661.449" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="133.755" x2="107.592" y1="652.258" y2="626.094" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><path fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4" d="M559.419,965.473c0,0-21.565,4.034-26.516,8.981c-4.948,4.948-8.982,26.517-8.982,26.517s-4.034-21.566-8.982-26.517 c-4.948-4.947-26.516-8.981-26.516-8.981s22.077-4.547,26.516-8.983c4.438-4.438,8.982-26.515,8.982-26.515 s4.034,21.564,8.982,26.515C537.852,961.438,559.419,965.473,559.419,965.473z"/><g><circle cx="949.705" cy="649.667" r="16.604" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="913.805" cy="649.667" r="6.433" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="949.705" cy="685.568" r="6.432" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="985.605" cy="649.667" r="6.433" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="949.705" cy="613.766" r="6.432" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="314.95" x2="369.854" y1="78.973" y2="133.878" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="369.854" x2="314.95" y1="78.973" y2="133.878" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="324.204" x2="297.204" y1="106" y2="106" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="362.204" x2="389.204" y1="106" y2="106" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="343.204" x2="343.204" y1="125" y2="152" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="343.204" x2="343.204" y1="87" y2="60" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="106.204" x2="106.204" y1="356" y2="435" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="145.204" x2="66.204" y1="396" y2="396" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="86.204" cy="415.5" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="86.204" cy="375.5" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="126.204" cy="415.5" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="126.204" cy="375.5" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g></g></g></svg>
@@ -10,6 +10,10 @@ module Decidim
10
10
  link: participatory_space_link
11
11
  )
12
12
  end
13
+
14
+ def resource_link_text
15
+ Decidim::Debates::DebatePresenter.new(resource).title
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,8 +1,10 @@
1
- <div class="card__icondata">
2
- <ul class="card-data">
3
- <li class="card-data__item">
4
- <%= icon "datetime", class: "icon--big" %>
5
- </li>
6
- <%= debate_date %>
7
- </ul>
8
- </div>
1
+ <% if debate_date.present? %>
2
+ <div class="card__icondata">
3
+ <ul class="card-data">
4
+ <li class="card-data__item">
5
+ <%= icon "datetime", class: "icon--big", role: "img", aria_label: t("decidim.debates.debates.show.date") %>
6
+ </li>
7
+ <%= debate_date %>
8
+ </ul>
9
+ </div>
10
+ <% end %>
@@ -1,5 +1,10 @@
1
1
  <div class="card__footer">
2
2
  <div class="card__support">
3
- <%= link_to t("participate", scope: "decidim.debates.debates.debate"), resource_path, class: "card__button button secondary button--sc small light" %>
3
+ <% if presenter.last_comment_by %>
4
+ <% author = presenter.last_comment_by %>
5
+ <%= cell "decidim/author", author, from: model, author_name_text: t(".commented_time_ago", time: presenter.last_comment_at), context: { extra_classes: ["author-data--small"] } %>
6
+ <% end %>
7
+
8
+ <%= link_to t("participate", scope: "decidim.debates.debates.debate"), resource_path, class: "card__button button button--sc small" %>
4
9
  </div>
5
10
  </div>
@@ -6,7 +6,7 @@
6
6
  </strong>
7
7
  <%= formatted_start_time %>
8
8
  </div>
9
- <%= icon "arrow-thin-right", class: "icon--big muted" %>
9
+ <%= icon "arrow-thin-right", class: "icon--big muted", role: "img", "aria-hidden": true %>
10
10
  <div>
11
11
  <strong>
12
12
  <%= l end_date, format: :decidim_with_month_name %>
@@ -11,14 +11,36 @@ module Decidim
11
11
  render
12
12
  end
13
13
 
14
+ def has_state?
15
+ model.closed?
16
+ end
17
+
18
+ def badge_name
19
+ I18n.t("decidim.debates.debates.closed") if model.closed?
20
+ end
21
+
22
+ def state_classes
23
+ return ["muted"] if model.closed?
24
+
25
+ super
26
+ end
27
+
28
+ def presenter
29
+ present(model)
30
+ end
31
+
14
32
  private
15
33
 
16
34
  def title
17
- present(model).title
35
+ presenter.title
36
+ end
37
+
38
+ def body
39
+ decidim_sanitize(present(model).description)
18
40
  end
19
41
 
20
42
  def description
21
- present(model).description(strip_tags: true)
43
+ strip_tags(body).truncate(200, separator: /\s/)
22
44
  end
23
45
 
24
46
  def resource_icon
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ module Admin
6
+ # A command with all the business logic when an admin closes a debate.
7
+ class CloseDebate < Rectify::Command
8
+ # Public: Initializes the command.
9
+ #
10
+ # form - A form object with the params.
11
+ def initialize(form)
12
+ @form = form
13
+ end
14
+
15
+ # Executes the command. Broadcasts these events:
16
+ #
17
+ # - :ok when everything is valid, together with the debate.
18
+ # - :invalid if the form wasn't valid and we couldn't proceed.
19
+ #
20
+ # Returns nothing.
21
+ def call
22
+ return broadcast(:invalid) if form.invalid?
23
+
24
+ close_debate
25
+ broadcast(:ok, debate)
26
+ end
27
+
28
+ private
29
+
30
+ attr_reader :form
31
+
32
+ def close_debate
33
+ @debate = Decidim.traceability.perform_action!(
34
+ :close,
35
+ form.debate,
36
+ form.current_user
37
+ ) do
38
+ form.debate.update!(
39
+ conclusions: form.conclusions,
40
+ closed_at: form.closed_at
41
+ )
42
+ end
43
+
44
+ Decidim::EventsManager.publish(
45
+ event: "decidim.events.debates.debate_closed",
46
+ event_class: Decidim::Debates::CloseDebateEvent,
47
+ resource: debate,
48
+ followers: debate.followers
49
+ )
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -28,10 +28,12 @@ module Decidim
28
28
  attr_reader :debate, :form
29
29
 
30
30
  def create_debate
31
+ parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
32
+ parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
31
33
  params = {
32
34
  category: form.category,
33
- title: form.title,
34
- description: form.description,
35
+ title: parsed_title,
36
+ description: parsed_description,
35
37
  information_updates: form.information_updates,
36
38
  instructions: form.instructions,
37
39
  end_time: form.end_time,
@@ -30,12 +30,15 @@ module Decidim
30
30
  attr_reader :debate, :form
31
31
 
32
32
  def update_debate
33
+ parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
34
+ parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
35
+
33
36
  Decidim.traceability.update!(
34
37
  debate,
35
38
  form.current_user,
36
39
  category: form.category,
37
- title: form.title,
38
- description: form.description,
40
+ title: parsed_title,
41
+ description: parsed_description,
39
42
  information_updates: form.information_updates,
40
43
  instructions: form.instructions,
41
44
  end_time: form.end_time,
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ # A command with all the business logic when a user updates a debate.
6
+ class CloseDebate < Rectify::Command
7
+ # Public: Initializes the command.
8
+ #
9
+ # form - A form object with the params.
10
+ def initialize(form)
11
+ @form = form
12
+ end
13
+
14
+ # Executes the command. Broadcasts these events:
15
+ #
16
+ # - :ok when everything is valid, together with the debate.
17
+ # - :invalid if the form wasn't valid and we couldn't proceed.
18
+ #
19
+ # Returns nothing.
20
+ def call
21
+ return broadcast(:invalid) if form.invalid?
22
+
23
+ close_debate
24
+ broadcast(:ok, debate)
25
+ end
26
+
27
+ private
28
+
29
+ attr_reader :form
30
+
31
+ def close_debate
32
+ @debate = Decidim.traceability.perform_action!(
33
+ :close,
34
+ form.debate,
35
+ form.current_user
36
+ ) do
37
+ form.debate.update!(attributes)
38
+ end
39
+
40
+ Decidim::EventsManager.publish(
41
+ event: "decidim.events.debates.debate_closed",
42
+ event_class: Decidim::Debates::CloseDebateEvent,
43
+ resource: debate,
44
+ followers: debate.followers
45
+ )
46
+ end
47
+
48
+ def attributes
49
+ {
50
+ conclusions: {
51
+ I18n.locale => form.conclusions
52
+ },
53
+ closed_at: form.closed_at
54
+ }
55
+ end
56
+ end
57
+ end
58
+ end
@@ -20,6 +20,8 @@ module Decidim
20
20
  send_notification_to_author_followers
21
21
  send_notification_to_space_followers
22
22
  end
23
+
24
+ follow_debate
23
25
  broadcast(:ok, debate)
24
26
  end
25
27
 
@@ -27,23 +29,19 @@ module Decidim
27
29
 
28
30
  attr_reader :debate, :form
29
31
 
30
- def organization
31
- @organization = form.current_component.organization
32
- end
33
-
34
- def i18n_field(field)
35
- organization.available_locales.inject({}) do |i18n, locale|
36
- i18n.update(locale => field)
37
- end
38
- end
39
-
40
32
  def create_debate
33
+ parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
34
+ parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
41
35
  params = {
42
36
  author: form.current_user,
43
37
  decidim_user_group_id: form.user_group_id,
44
38
  category: form.category,
45
- title: i18n_field(form.title),
46
- description: i18n_field(form.description),
39
+ title: {
40
+ I18n.locale => parsed_title
41
+ },
42
+ description: {
43
+ I18n.locale => parsed_description
44
+ },
47
45
  component: form.current_component
48
46
  }
49
47
 
@@ -78,6 +76,13 @@ module Decidim
78
76
  }
79
77
  )
80
78
  end
79
+
80
+ def follow_debate
81
+ follow_form = Decidim::FollowForm
82
+ .from_params(followable_gid: debate.to_signed_global_id.to_s)
83
+ .with_context(current_user: debate.author)
84
+ Decidim::CreateFollow.call(follow_form, debate.author)
85
+ end
81
86
  end
82
87
  end
83
88
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ # A command with all the business logic when a user updates a debate.
6
+ class UpdateDebate < Rectify::Command
7
+ # Public: Initializes the command.
8
+ #
9
+ # form - A form object with the params.
10
+ def initialize(form)
11
+ @form = form
12
+ end
13
+
14
+ # Executes the command. Broadcasts these events:
15
+ #
16
+ # - :ok when everything is valid, together with the debate.
17
+ # - :invalid if the form wasn't valid and we couldn't proceed.
18
+ #
19
+ # Returns nothing.
20
+ def call
21
+ return broadcast(:invalid) if form.invalid?
22
+ return broadcast(:invalid) unless form.debate.editable_by?(form.current_user)
23
+
24
+ update_debate
25
+ broadcast(:ok, @debate)
26
+ end
27
+
28
+ private
29
+
30
+ attr_reader :form
31
+
32
+ def update_debate
33
+ @debate = Decidim.traceability.update!(
34
+ @form.debate,
35
+ @form.current_user,
36
+ attributes,
37
+ visibility: "public-only"
38
+ )
39
+ end
40
+
41
+ def attributes
42
+ parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
43
+ parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
44
+ {
45
+ category: form.category,
46
+ title: {
47
+ I18n.locale => parsed_title
48
+ },
49
+ description: {
50
+ I18n.locale => parsed_description
51
+ }
52
+ }
53
+ end
54
+ end
55
+ end
56
+ end