decidim-initiatives 0.19.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -0
  3. data/app/assets/config/admin_decidim_initiatives_manifest.js +2 -1
  4. data/app/assets/images/decidim/gamification/badges/initiatives.svg +1 -87
  5. data/app/assets/images/decidim/initiatives/icon.svg +1 -3
  6. data/app/assets/javascripts/decidim/initiatives/admin/initiatives_types.js.es6 +20 -0
  7. data/app/assets/stylesheet/decidim/initiatives/initiatives-votes.css.scss +0 -1
  8. data/app/assets/stylesheet/decidim/initiatives/initiatives.scss +0 -8
  9. data/app/assets/stylesheet/decidim/initiatives/popularity_item.css.scss +0 -1
  10. data/app/assets/stylesheet/decidim/initiatives/print-initiative.css.scss +0 -3
  11. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +4 -3
  12. data/app/cells/decidim/initiatives/initiative_m/footer.erb +1 -1
  13. data/app/cells/decidim/initiatives/initiative_m_cell.rb +11 -0
  14. data/app/commands/decidim/initiatives/admin/create_initiative_type.rb +5 -1
  15. data/app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb +17 -0
  16. data/app/commands/decidim/initiatives/admin/update_initiative.rb +29 -10
  17. data/app/commands/decidim/initiatives/admin/update_initiative_type.rb +7 -5
  18. data/app/commands/decidim/initiatives/attachment_methods.rb +33 -0
  19. data/app/commands/decidim/initiatives/create_initiative.rb +23 -1
  20. data/app/commands/decidim/initiatives/vote_initiative.rb +16 -0
  21. data/app/controllers/concerns/decidim/initiatives/admin/filterable.rb +51 -0
  22. data/app/controllers/concerns/decidim/initiatives/orderable.rb +3 -1
  23. data/app/controllers/concerns/decidim/initiatives/single_initiative_type.rb +26 -0
  24. data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +26 -13
  25. data/app/controllers/decidim/initiatives/create_initiative_controller.rb +43 -9
  26. data/app/controllers/decidim/initiatives/initiatives_controller.rb +17 -3
  27. data/app/controllers/decidim/initiatives/versions_controller.rb +20 -0
  28. data/app/events/decidim/initiatives/admin/initiative_sent_to_technical_validation_event.rb +21 -0
  29. data/app/events/decidim/initiatives/admin/support_threshold_reached_event.rb +13 -0
  30. data/app/forms/decidim/initiatives/admin/initiative_form.rb +32 -1
  31. data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +25 -6
  32. data/app/forms/decidim/initiatives/admin/initiative_type_scope_form.rb +0 -1
  33. data/app/forms/decidim/initiatives/initiative_form.rb +48 -2
  34. data/app/forms/decidim/initiatives/vote_form.rb +3 -1
  35. data/app/helpers/decidim/initiatives/application_helper.rb +104 -0
  36. data/app/helpers/decidim/initiatives/create_initiative_helper.rb +10 -11
  37. data/app/helpers/decidim/initiatives/initiative_helper.rb +13 -0
  38. data/app/helpers/decidim/initiatives/initiatives_helper.rb +10 -0
  39. data/app/jobs/decidim/initiatives/export_initiatives_job.rb +25 -0
  40. data/app/mailers/decidim/initiatives/initiatives_mailer.rb +0 -21
  41. data/app/models/concerns/decidim/initiatives/has_area.rb +30 -0
  42. data/app/models/decidim/initiative.rb +99 -21
  43. data/app/models/decidim/initiatives_type.rb +12 -15
  44. data/app/models/decidim/initiatives_type_scope.rb +5 -2
  45. data/app/permissions/decidim/initiatives/admin/permissions.rb +19 -8
  46. data/app/permissions/decidim/initiatives/permissions.rb +36 -10
  47. data/app/queries/decidim/initiatives/admin/manageable_initiatives.rb +7 -39
  48. data/app/serializers/decidim/initiatives/initiative_serializer.rb +32 -0
  49. data/app/services/decidim/initiatives/diff_renderer.rb +18 -0
  50. data/app/services/decidim/initiatives/initiative_search.rb +59 -15
  51. data/app/services/decidim/initiatives/status_change_notifier.rb +4 -5
  52. data/app/types/decidim/initiatives/initiative_api_type.rb +26 -0
  53. data/app/types/decidim/initiatives/initiative_committee_member_type.rb +18 -0
  54. data/app/types/decidim/initiatives/initiative_type.rb +42 -0
  55. data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +8 -0
  56. data/app/views/decidim/initiatives/admin/initiatives/_form.html.erb +25 -2
  57. data/app/views/decidim/initiatives/admin/initiatives/_initiative_attachments.erb +43 -0
  58. data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +10 -45
  59. data/app/views/decidim/initiatives/admin/initiatives_types/_form.html.erb +20 -2
  60. data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +59 -16
  61. data/app/views/decidim/initiatives/create_initiative/finish.html.erb +17 -10
  62. data/app/views/decidim/initiatives/create_initiative/previous_form.html.erb +2 -1
  63. data/app/views/decidim/initiatives/create_initiative/promotal_committee.html.erb +1 -1
  64. data/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb +1 -2
  65. data/app/views/decidim/initiatives/create_initiative/show_similar_initiatives.html.erb +1 -1
  66. data/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb +1 -0
  67. data/app/views/decidim/initiatives/initiatives/_author.html.erb +1 -1
  68. data/app/views/decidim/initiatives/initiatives/_filters.html.erb +16 -28
  69. data/app/views/decidim/initiatives/initiatives/_index_header.html.erb +4 -4
  70. data/app/views/decidim/initiatives/initiatives/_initiatives.html.erb +1 -1
  71. data/app/views/decidim/initiatives/initiatives/_interactions.html.erb +2 -3
  72. data/app/views/decidim/initiatives/initiatives/_tags.html.erb +4 -1
  73. data/app/views/decidim/initiatives/initiatives/index.html.erb +1 -1
  74. data/app/views/decidim/initiatives/initiatives/show.html.erb +4 -3
  75. data/app/views/decidim/initiatives/initiatives/signature_identities.html.erb +1 -1
  76. data/app/views/decidim/initiatives/initiatives_type_scopes/search.html.erb +1 -1
  77. data/app/views/decidim/initiatives/versions/index.html.erb +8 -0
  78. data/app/views/decidim/initiatives/versions/show.html.erb +10 -0
  79. data/app/views/layouts/decidim/_initiative_creation_header.html.erb +3 -1
  80. data/app/views/layouts/decidim/_initiative_header.html.erb +2 -1
  81. data/app/views/layouts/decidim/_initiative_signature_creation_header.html.erb +1 -1
  82. data/app/views/layouts/decidim/admin/initiative.html.erb +1 -1
  83. data/app/views/layouts/decidim/initiative_creation.html.erb +1 -2
  84. data/app/views/layouts/decidim/initiative_signature_creation.html.erb +2 -2
  85. data/config/locales/ar.yml +17 -17
  86. data/config/locales/bg-BG.yml +13 -0
  87. data/config/locales/ca.yml +97 -32
  88. data/config/locales/cs.yml +93 -28
  89. data/config/locales/da-DK.yml +1 -0
  90. data/config/locales/de.yml +68 -17
  91. data/config/locales/el-GR.yml +1 -0
  92. data/config/locales/el.yml +529 -0
  93. data/config/locales/en.yml +85 -20
  94. data/config/locales/es-MX.yml +82 -17
  95. data/config/locales/es-PY.yml +82 -17
  96. data/config/locales/es.yml +84 -19
  97. data/config/locales/et-EE.yml +1 -0
  98. data/config/locales/eu.yml +14 -17
  99. data/config/locales/fi-plain.yml +82 -17
  100. data/config/locales/fi.yml +106 -41
  101. data/config/locales/fr-CA.yml +529 -0
  102. data/config/locales/fr.yml +97 -46
  103. data/config/locales/ga-IE.yml +1 -0
  104. data/config/locales/gl.yml +14 -17
  105. data/config/locales/hr-HR.yml +1 -0
  106. data/config/locales/hu.yml +26 -20
  107. data/config/locales/id-ID.yml +14 -17
  108. data/config/locales/is-IS.yml +261 -0
  109. data/config/locales/it.yml +108 -57
  110. data/config/locales/ja-JP.yml +535 -0
  111. data/config/locales/lt-LT.yml +1 -0
  112. data/config/locales/lv-LV.yml +529 -0
  113. data/config/locales/mt-MT.yml +1 -0
  114. data/config/locales/nl.yml +125 -74
  115. data/config/locales/no.yml +461 -0
  116. data/config/locales/pl.yml +242 -177
  117. data/config/locales/pt-BR.yml +15 -18
  118. data/config/locales/pt.yml +228 -177
  119. data/config/locales/ro-RO.yml +532 -0
  120. data/config/locales/ru.yml +14 -17
  121. data/config/locales/sk-SK.yml +468 -0
  122. data/config/locales/sk.yml +462 -0
  123. data/config/locales/sl.yml +18 -0
  124. data/config/locales/sr-CS.yml +8 -0
  125. data/config/locales/sv.yml +78 -27
  126. data/config/locales/tr-TR.yml +14 -17
  127. data/config/locales/uk.yml +14 -17
  128. data/db/migrate/20190925145648_add_promoting_committee_option.rb +7 -0
  129. data/db/migrate/20191002082220_move_signature_type_to_initative_type.rb +38 -0
  130. data/db/migrate/20200320105920_index_foreign_keys_in_decidim_initiatives.rb +8 -0
  131. data/db/migrate/20200320105921_index_foreign_keys_in_decidim_initiatives_votes.rb +8 -0
  132. data/db/migrate/20200417120551_add_custom_signature_end_time_option.rb +7 -0
  133. data/db/migrate/20200424110930_add_attachments_enabled_option.rb +7 -0
  134. data/db/migrate/20200514085422_add_area_to_initiatives.rb +7 -0
  135. data/db/migrate/20200514102631_add_area_enabled_option_to_initiatives.rb +7 -0
  136. data/db/seeds/city2.jpeg +0 -0
  137. data/lib/decidim/api/initiative_type_interface.rb +13 -0
  138. data/lib/decidim/initiatives.rb +0 -14
  139. data/lib/decidim/initiatives/admin_engine.rb +5 -1
  140. data/lib/decidim/initiatives/api.rb +7 -0
  141. data/lib/decidim/initiatives/engine.rb +9 -0
  142. data/lib/decidim/initiatives/participatory_space.rb +13 -1
  143. data/lib/decidim/initiatives/query_extensions.rb +40 -0
  144. data/lib/decidim/initiatives/test/factories.rb +54 -11
  145. data/lib/decidim/initiatives/version.rb +1 -1
  146. metadata +69 -17
  147. data/app/views/decidim/initiatives/initiative_widgets/show.html.erb +0 -4
  148. data/app/views/decidim/initiatives/initiatives_mailer/notify_validating_request.html.erb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93cc6571aa86c1b7226857bae6067e594c5916a1cfb37b04fa9de4e70ff6272d
4
- data.tar.gz: da66cd9b4eaf1eb96e7243e794a69e965063a3a415c332012b6fc6c5a947f953
3
+ metadata.gz: c17f1f5c3ad33e6ca352c73fc8e551b3e58e486a223598804acfd6819671bb31
4
+ data.tar.gz: b6cce6c33ad0ddb6a82473190b019a6808ddbf105fe1644df72b9589032a74b7
5
5
  SHA512:
6
- metadata.gz: c7a85d429198247f6afbb1872f619f9afb6e2ac9297f9e4791761b114cc66261c5cac18fbb84ec99de374046c18798aed7b112a5f580af4024c978fcd5cdb68b
7
- data.tar.gz: 2e8006fd534e54a1abc8a6f02e27d6dc919eb1b31d39b4bed35730bc9bcfe2960ea0b38a617bde28911e635eee866434fd38aff28a56fe357bc83463bae765aa
6
+ metadata.gz: 077066ebe56b6f9f8fdb094afe847261f70809c23d37d79a90c75aa67107e52dad6f7d875269531198e3a28a5cbea1960484ac04ed7557e03cb4fd4b4d4dc417
7
+ data.tar.gz: c5eba0295d92b0be850c4ab997f2bbc3fb854641a57eb44893bbbcfbac25b6fc8a0c74bc7f5e102e1ef6b2650345e3122d74d955c63a79bea0105dbe39a5d296
data/README.md CHANGED
@@ -42,6 +42,28 @@ The database requires the extension pg_trgm enabled. Contact your DBA to enable
42
42
  CREATE EXTENSION pg_trgm;
43
43
  ```
44
44
 
45
+ ## Deactivating authorization requirement and other module settings
46
+
47
+ Some of the settings of the module need to be set in the code of your app, for example in the file `config/initializers/decidim.rb`.
48
+
49
+ This is the case if you want to enable the creation of initiatives even when no authorization method is set.
50
+
51
+ Just use the following line:
52
+ ```
53
+ Decidim::Initiatives.do_not_require_authorization = true
54
+ ```
55
+
56
+ All the settings and their default values which can be overriden can be found in the file [`lib/decidim/initiatives.rb`](https://github.com/decidim/decidim/blob/master/decidim-initiatives/lib/decidim/initiatives.rb).
57
+
58
+ For example, you can also change the minimum number of required committee members to 1 (default is 2) by adding this line:
59
+ ```
60
+ Decidim::Initiatives.minimum_committee_members = 1
61
+ ```
62
+ Or change the number of days given to gather signatures to 365 (default is 120) with:
63
+ ```
64
+ Decidim::Initiatives.default_signature_time_period_length = 365
65
+ ```
66
+
45
67
  ## Rake tasks
46
68
 
47
69
  This engine comes with three rake tasks that should be executed on daily basis. The best
@@ -1,3 +1,4 @@
1
1
  //= link decidim/initiatives/admin/invite_users.js
2
+ //= link decidim/initiatives/admin/initiatives_types.js
2
3
  //= link decidim/initiatives/scoped_type.js
3
- //= link decidim/initiatives/print-initiative.css
4
+ //= link decidim/initiatives/print-initiative.css
@@ -1,87 +1 @@
1
- <svg version="1.1" id="initiatives-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="initiatives" class="stroke-primary">
6
- <polygon class="fill-primary" id="contact" fill="#31536E" points="500.5,967.5 580.5,967.5 610.5,911.5 470.5,911.5 "/>
7
- <g id="cap">
8
- <path class="fill-primary" id="_x35_0-pct_4_" fill="#31536E" fill-opacity="0.5" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
9
- M687.5,682.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106
10
- c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V682.054z"/>
11
- <path class="fill-primary" id="_x32_5-pct_6_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
12
- M687.5,733.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106
13
- c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V733.054z"/>
14
- <path class="fill-primary" id="_x35_0-pct_5_" fill="#31536E" fill-opacity="0.5" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
15
- M687.5,784.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106
16
- c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V784.054z"/>
17
- <path class="fill-primary" id="_x32_5-pct_5_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
18
- M687.5,835.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106
19
- c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V835.054z"/>
20
- <path class="fill-primary" id="_x35_0-pct_6_" fill="#31536E" fill-opacity="0.5" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
21
- M687.5,886.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106
22
- c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V886.054z"/>
23
- </g>
24
- <path id="glass" fill="none" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
25
- M789.571,371.337c0-137.578-111.529-249.079-249.107-249.079S291.357,233.801,291.357,371.379
26
- c0,80.795,38.475,152.121,98.09,198.121h-0.022c27.35,24,47.839,54.127,58.972,87.004l183.387-0.06
27
- c10.664-31.493,29.915-59.944,55.556-83.944h-0.022C749.299,527.5,789.571,453.998,789.571,371.337z"/>
28
- <g id="filament">
29
- <path class="fill-primary" id="_x35_0-pct_7_" fill="#31536E" fill-opacity="0.5" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
30
- M491.354,656.5c0,0,28.136-43.203,34.573-59.054c5.723-14.089,14.573-59.054,14.573-59.054s8.851,44.966,14.573,59.055
31
- c6.438,15.85,34.573,59.053,34.573,59.053H540.5H491.354z"/>
32
- <path class="fill-primary" id="_x32_5-pct_7_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
33
- M496.393,407.685c28.994,28.995,44.37,131.34,44.37,131.34s-102.346-15.375-131.34-44.37
34
- c-28.995-28.995-33.032-71.969-9.016-95.985C424.423,374.653,467.396,378.69,496.393,407.685z"/>
35
- <path class="fill-primary" id="_x32_5-pct_8_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
36
- M671.747,494.655c-28.994,28.995-131.34,44.371-131.34,44.371s15.375-102.346,44.37-131.34
37
- c28.994-28.996,71.97-33.032,95.984-9.016C704.779,422.686,700.742,465.66,671.747,494.655z"/>
38
- <line fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="462.749" y1="461.011" x2="540.5" y2="538.393"/>
39
- <line fill="none" stroke="#31536E" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="540.5" y1="538.393" x2="618.421" y2="461.011"/>
40
- </g>
41
- <g id="stars_4" class="stars">
42
- <path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
43
- M130.5,374.396c0-14.688-18.667-35.355-35.355-35.355c15.355,0,35.355-20.333,35.355-35.355c0,15.022,16.666,35.355,35.355,35.355
44
- C146.833,339.041,130.5,359.708,130.5,374.396z"/>
45
- <g>
46
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="919.852" cy="859.217" r="13.5"/>
47
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="903.353" y1="842.481" x2="882.14" y2="821.269"/>
48
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="937.294" y1="876.423" x2="958.507" y2="897.636"/>
49
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="936.587" y1="843.188" x2="957.8" y2="821.976"/>
50
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="903.353" y1="876.423" x2="882.14" y2="897.636"/>
51
- </g>
52
- <g>
53
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="885.448" y1="566.135" x2="859.286" y2="592.299"/>
54
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="850.094" y1="601.49" x2="823.931" y2="627.654"/>
55
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="884.741" y1="627.654" x2="858.578" y2="601.49"/>
56
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="849.387" y1="592.299" x2="823.224" y2="566.135"/>
57
- </g>
58
- <path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
59
- M945.602,73.542c0,0-21.564,4.034-26.516,8.981c-4.948,4.948-8.982,26.516-8.982,26.516s-4.035-21.565-8.982-26.516
60
- 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
61
- s4.034,21.564,8.982,26.515C924.035,69.506,945.602,73.542,945.602,73.542z"/>
62
- <g>
63
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="962.656" cy="362.498" r="16.604"/>
64
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="926.755" cy="362.498" r="6.432"/>
65
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="962.656" cy="398.399" r="6.432"/>
66
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="998.558" cy="362.498" r="6.432"/>
67
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="962.656" cy="326.597" r="6.432"/>
68
- </g>
69
- <g>
70
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="108.246" y1="727.014" x2="163.149" y2="781.919"/>
71
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="163.149" y1="727.014" x2="108.246" y2="781.919"/>
72
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="117.5" y1="754.041" x2="90.5" y2="754.041"/>
73
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="155.5" y1="754.041" x2="182.5" y2="754.041"/>
74
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="136.5" y1="773.041" x2="136.5" y2="800.041"/>
75
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="136.5" y1="735.041" x2="136.5" y2="708.041"/>
76
- </g>
77
- <g>
78
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="320" y1="54.041" x2="320" y2="133.041"/>
79
- <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="359" y1="94.041" x2="280" y2="94.041"/>
80
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="300" cy="113.541" r="7.039"/>
81
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="300" cy="73.541" r="7.039"/>
82
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="340" cy="113.541" r="7.039"/>
83
- <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="340" cy="73.541" r="7.039"/>
84
- </g>
85
- </g>
86
- </g>
87
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="initiatives-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="initiatives" class="stroke-primary"><polygon id="contact" fill="#31536E" points="500.5 967.5 580.5 967.5 610.5 911.5 470.5 911.5" class="fill-primary"/><g id="cap"><path id="_x35_0-pct_4_" fill="#31536E" fill-opacity=".5" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M687.5,682.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106 c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V682.054z" class="fill-primary"/><path id="_x32_5-pct_6_" fill="#31536E" fill-opacity=".25" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M687.5,733.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106 c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V733.054z" class="fill-primary"/><path id="_x35_0-pct_5_" fill="#31536E" fill-opacity=".5" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M687.5,784.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106 c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V784.054z" class="fill-primary"/><path id="_x32_5-pct_5_" fill="#31536E" fill-opacity=".25" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M687.5,835.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106 c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V835.054z" class="fill-primary"/><path id="_x35_0-pct_6_" fill="#31536E" fill-opacity=".5" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M687.5,886.054c0,14.054-11.393,25.446-25.446,25.446H418.946c-14.054,0-25.446-11.393-25.446-25.446v-0.106 c0-14.055,11.393-25.447,25.446-25.447h243.106c14.055,0,25.447,11.393,25.447,25.446V886.054z" class="fill-primary"/></g><path id="glass" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M789.571,371.337c0-137.578-111.529-249.079-249.107-249.079S291.357,233.801,291.357,371.379 c0,80.795,38.475,152.121,98.09,198.121h-0.022c27.35,24,47.839,54.127,58.972,87.004l183.387-0.06 c10.664-31.493,29.915-59.944,55.556-83.944h-0.022C749.299,527.5,789.571,453.998,789.571,371.337z"/><g id="filament"><path id="_x35_0-pct_7_" fill="#31536E" fill-opacity=".5" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M491.354,656.5c0,0,28.136-43.203,34.573-59.054c5.723-14.089,14.573-59.054,14.573-59.054s8.851,44.966,14.573,59.055 c6.438,15.85,34.573,59.053,34.573,59.053H540.5H491.354z" class="fill-primary"/><path id="_x32_5-pct_7_" fill="#31536E" fill-opacity=".25" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M496.393,407.685c28.994,28.995,44.37,131.34,44.37,131.34s-102.346-15.375-131.34-44.37 c-28.995-28.995-33.032-71.969-9.016-95.985C424.423,374.653,467.396,378.69,496.393,407.685z" class="fill-primary"/><path id="_x32_5-pct_8_" fill="#31536E" fill-opacity=".25" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="16" d="M671.747,494.655c-28.994,28.995-131.34,44.371-131.34,44.371s15.375-102.346,44.37-131.34 c28.994-28.996,71.97-33.032,95.984-9.016C704.779,422.686,700.742,465.66,671.747,494.655z" class="fill-primary"/><line x1="462.749" x2="540.5" y1="461.011" y2="538.393" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="8"/><line x1="540.5" x2="618.421" y1="538.393" y2="461.011" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="8"/></g><g id="stars_4" class="stars"><path fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4" d="M130.5,374.396c0-14.688-18.667-35.355-35.355-35.355c15.355,0,35.355-20.333,35.355-35.355c0,15.022,16.666,35.355,35.355,35.355 C146.833,339.041,130.5,359.708,130.5,374.396z"/><g><circle cx="919.852" cy="859.217" r="13.5" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="903.353" x2="882.14" y1="842.481" y2="821.269" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="937.294" x2="958.507" y1="876.423" y2="897.636" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="936.587" x2="957.8" y1="843.188" y2="821.976" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="903.353" x2="882.14" y1="876.423" y2="897.636" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="885.448" x2="859.286" y1="566.135" y2="592.299" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="850.094" x2="823.931" y1="601.49" y2="627.654" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="884.741" x2="858.578" y1="627.654" y2="601.49" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="849.387" x2="823.224" y1="592.299" y2="566.135" 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="M945.602,73.542c0,0-21.564,4.034-26.516,8.981c-4.948,4.948-8.982,26.516-8.982,26.516s-4.035-21.565-8.982-26.516 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.515C924.035,69.506,945.602,73.542,945.602,73.542z"/><g><circle cx="962.656" cy="362.498" r="16.604" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="926.755" cy="362.498" r="6.432" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="962.656" cy="398.399" r="6.432" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="998.558" cy="362.498" r="6.432" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="962.656" cy="326.597" r="6.432" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="108.246" x2="163.149" y1="727.014" y2="781.919" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="163.149" x2="108.246" y1="727.014" y2="781.919" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="117.5" x2="90.5" y1="754.041" y2="754.041" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="155.5" x2="182.5" y1="754.041" y2="754.041" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="136.5" x2="136.5" y1="773.041" y2="800.041" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="136.5" x2="136.5" y1="735.041" y2="708.041" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g><g><line x1="320" x2="320" y1="54.041" y2="133.041" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><line x1="359" x2="280" y1="94.041" y2="94.041" fill="none" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="300" cy="113.541" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="300" cy="73.541" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="340" cy="113.541" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/><circle cx="340" cy="73.541" r="7.039" fill="#FFD92B" stroke="#31536E" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="4"/></g></g></g></svg>
@@ -1,3 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34 34">
2
- <path d="M17 1.889C8.654 1.889 1.889 8.654 1.889 17S8.654 32.111 17 32.111 32.111 25.346 32.111 17 25.346 1.889 17 1.889zM17 0c9.389 0 17 7.611 17 17s-7.611 17-17 17S0 26.389 0 17 7.611 0 17 0zm4.722 18.082v-2.97a.944.944 0 1 0-1.889 0v2.97a.944.944 0 1 0 1.89 0zm-2.833 0v-2.97a.944.944 0 0 0-1.889 0v2.97a.944.944 0 1 0 1.889 0zm-3.778.488V8.5a.944.944 0 0 0-1.889 0v10.07a.944.944 0 0 0 1.89 0zM8.5 16.92c.814 0 1.593.78 1.593 1.594v.2c0 4.131 3.302 7.432 7.373 7.356 4.114 0 7.415-3.301 7.339-7.373V15.11a.944.944 0 0 0-1.889 0v3.603c.056 3.025-2.385 5.468-5.467 5.468-3.025.056-5.467-2.386-5.467-5.468v-.2c0-1.857-1.625-3.482-3.482-3.482a.944.944 0 0 0 0 1.889z"/>
3
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34 34"><path d="M17 1.889C8.654 1.889 1.889 8.654 1.889 17S8.654 32.111 17 32.111 32.111 25.346 32.111 17 25.346 1.889 17 1.889zM17 0c9.389 0 17 7.611 17 17s-7.611 17-17 17S0 26.389 0 17 7.611 0 17 0zm4.722 18.082v-2.97a.944.944 0 1 0-1.889 0v2.97a.944.944 0 1 0 1.89 0zm-2.833 0v-2.97a.944.944 0 0 0-1.889 0v2.97a.944.944 0 1 0 1.889 0zm-3.778.488V8.5a.944.944 0 0 0-1.889 0v10.07a.944.944 0 0 0 1.89 0zM8.5 16.92c.814 0 1.593.78 1.593 1.594v.2c0 4.131 3.302 7.432 7.373 7.356 4.114 0 7.415-3.301 7.339-7.373V15.11a.944.944 0 0 0-1.889 0v3.603c.056 3.025-2.385 5.468-5.467 5.468-3.025.056-5.467-2.386-5.467-5.468v-.2c0-1.857-1.625-3.482-3.482-3.482a.944.944 0 0 0 0 1.889z"/></svg>
@@ -0,0 +1,20 @@
1
+ (() => {
2
+ const $scope = $("#promoting-committee-details");
3
+
4
+ const $promotingCommitteeCheckbox = $(
5
+ "#initiatives_type_promoting_committee_enabled",
6
+ $scope
7
+ );
8
+
9
+ const toggleVisibility = () => {
10
+ if ($promotingCommitteeCheckbox.is(":checked")) {
11
+ $(".minimum-committee-members-details", $scope).show();
12
+ } else {
13
+ $(".minimum-committee-members-details", $scope).hide();
14
+ }
15
+ };
16
+
17
+ $($promotingCommitteeCheckbox).click(() => toggleVisibility());
18
+
19
+ toggleVisibility();
20
+ })();
@@ -4,7 +4,6 @@
4
4
  margin: 15pt 0;
5
5
  font-size: 12pt;
6
6
  font-weight: bold;
7
- text-transform: uppercase;
8
7
  text-align: center;
9
8
  }
10
9
 
@@ -44,14 +44,6 @@
44
44
  }
45
45
  }
46
46
 
47
- .pull-left{
48
- float: left;
49
- }
50
-
51
- .pull-right{
52
- float: right;
53
- }
54
-
55
47
  .lowercase{
56
48
  text-transform: lowercase !important;
57
49
  }
@@ -20,7 +20,6 @@
20
20
 
21
21
  .popularity__desc{
22
22
  color: #8c838a;
23
- text-transform: uppercase;
24
23
  font-size: 90%;
25
24
  padding-top: .3rem;
26
25
  display: block;
@@ -13,7 +13,6 @@
13
13
  margin: 15pt 0;
14
14
  font-size: 12pt;
15
15
  font-weight: bold;
16
- text-transform: uppercase;
17
16
  text-align: center;
18
17
  }
19
18
 
@@ -26,7 +25,6 @@
26
25
  background-color: lightgray;
27
26
  display: inline-block;
28
27
  width: 100%;
29
- text-transform: uppercase;
30
28
  padding-left: 5pt;
31
29
  font-size: 12pt;
32
30
  font-weight: bold;
@@ -92,7 +90,6 @@
92
90
  font-size: 12pt;
93
91
  font-weight: bold;
94
92
  margin-top: 15pt;
95
- text-transform: uppercase;
96
93
  }
97
94
 
98
95
  .print-initiative-legal-text{
@@ -5,15 +5,16 @@
5
5
  <div class="row small-up-1 smallmedium-up-2 mediumlarge-up-3 large-up-4 card-grid">
6
6
  <% highlighted_initiatives.each do |initiative| %>
7
7
  <div class="column">
8
- <article class="card card--initiative card--mini">
8
+ <div class="card card--initiative card--mini">
9
9
  <%= link_to decidim_initiatives.initiative_path(initiative), class: "card__link" do %>
10
+ <span class="show-for-sr"><%= translated_attribute initiative.title %></span>
10
11
  <% end %>
11
12
  <div class="card__content">
12
13
  <%= link_to decidim_initiatives.initiative_path(initiative), class: "card__link" do %>
13
- <h4 class="card__title"><%= decidim_html_escape(translated_attribute(initiative.title)) %></h4>
14
+ <span class="card__title"><%= decidim_html_escape(translated_attribute(initiative.title)) %></span>
14
15
  <% end %>
15
16
  </div>
16
- </article>
17
+ </div>
17
18
  </div>
18
19
  <% end %>
19
20
  </div>
@@ -15,7 +15,7 @@
15
15
  <div class="card__support__data"></div>
16
16
  <% end %>
17
17
 
18
- <% if model.closed? || model.offline? %>
18
+ <% if model.closed? || model.offline_signature_type? %>
19
19
  <%= link_to t("initiatives.initiative.check", scope: "layouts.decidim"),
20
20
  resource_path,
21
21
  class: "card__button button button--sc small light secondary" %>
@@ -23,6 +23,17 @@ module Decidim
23
23
  true
24
24
  end
25
25
 
26
+ # Explicitely commenting the used I18n keys so their are not flagged as unused
27
+ # i18n-tasks-use t('decidim.initiatives.show.badge_name.accepted')
28
+ # i18n-tasks-use t('decidim.initiatives.show.badge_name.created')
29
+ # i18n-tasks-use t('decidim.initiatives.show.badge_name.discarded')
30
+ # i18n-tasks-use t('decidim.initiatives.show.badge_name.published')
31
+ # i18n-tasks-use t('decidim.initiatives.show.badge_name.rejected')
32
+ # i18n-tasks-use t('decidim.initiatives.show.badge_name.validating')
33
+ def badge_name
34
+ I18n.t(model.state, scope: "decidim.initiatives.show.badge_name")
35
+ end
36
+
26
37
  def state_classes
27
38
  case state
28
39
  when "accepted", "published"
@@ -40,8 +40,12 @@ module Decidim
40
40
  organization: form.current_organization,
41
41
  title: form.title,
42
42
  description: form.description,
43
- online_signature_enabled: form.online_signature_enabled,
43
+ signature_type: form.signature_type,
44
+ attachments_enabled: form.attachments_enabled,
44
45
  undo_online_signatures_enabled: form.undo_online_signatures_enabled,
46
+ custom_signature_end_date_enabled: form.custom_signature_end_date_enabled,
47
+ area_enabled: form.area_enabled,
48
+ promoting_committee_enabled: form.promoting_committee_enabled,
45
49
  minimum_committee_members: form.minimum_committee_members,
46
50
  banner_image: form.banner_image,
47
51
  collect_user_extra_fields: form.collect_user_extra_fields,
@@ -30,12 +30,29 @@ module Decidim
30
30
  initiative.validating!
31
31
  initiative
32
32
  end
33
+
34
+ notify_admins
35
+
33
36
  broadcast(:ok, initiative)
34
37
  end
35
38
 
36
39
  private
37
40
 
38
41
  attr_reader :initiative, :current_user
42
+
43
+ def notify_admins
44
+ affected_users = Decidim::User.org_admins_except_me(current_user).all
45
+
46
+ data = {
47
+ event: "decidim.events.initiatives.admin.initiative_sent_to_technical_validation",
48
+ event_class: Decidim::Initiatives::Admin::InitiativeSentToTechnicalValidationEvent,
49
+ resource: initiative,
50
+ affected_users: affected_users,
51
+ force_send: true
52
+ }
53
+
54
+ Decidim::EventsManager.publish(data)
55
+ end
39
56
  end
40
57
  end
41
58
  end
@@ -6,6 +6,8 @@ module Decidim
6
6
  # A command with all the business logic that updates an
7
7
  # existing initiative.
8
8
  class UpdateInitiative < Rectify::Command
9
+ include Decidim::Initiatives::AttachmentMethods
10
+
9
11
  # Public: Initializes the command.
10
12
  #
11
13
  # initiative - Decidim::Initiative
@@ -14,6 +16,7 @@ module Decidim
14
16
  @form = form
15
17
  @initiative = initiative
16
18
  @current_user = current_user
19
+ @attached_to = initiative
17
20
  end
18
21
 
19
22
  # Executes the command. Broadcasts these events:
@@ -25,11 +28,19 @@ module Decidim
25
28
  def call
26
29
  return broadcast(:invalid) if form.invalid?
27
30
 
31
+ if process_attachments?
32
+ @initiative.attachments.destroy_all
33
+
34
+ build_attachment
35
+ return broadcast(:invalid) if attachment_invalid?
36
+ end
37
+
28
38
  @initiative = Decidim.traceability.update!(
29
39
  initiative,
30
40
  current_user,
31
41
  attributes
32
42
  )
43
+ create_attachment if process_attachments?
33
44
  notify_initiative_is_extended if @notify_extended
34
45
  broadcast(:ok, initiative)
35
46
  rescue ActiveRecord::RecordInvalid
@@ -38,7 +49,7 @@ module Decidim
38
49
 
39
50
  private
40
51
 
41
- attr_reader :form, :initiative, :current_user
52
+ attr_reader :form, :initiative, :current_user, :attachment
42
53
 
43
54
  def attributes
44
55
  attrs = {
@@ -53,20 +64,28 @@ module Decidim
53
64
  end
54
65
 
55
66
  if current_user.admin?
56
- attrs[:signature_start_date] = form.signature_start_date
57
- attrs[:signature_end_date] = form.signature_end_date
58
- attrs[:offline_votes] = form.offline_votes if form.offline_votes
59
- attrs[:state] = form.state if form.state
60
-
61
- if initiative.published?
62
- @notify_extended = true if form.signature_end_date != initiative.signature_end_date &&
63
- form.signature_end_date > initiative.signature_end_date
64
- end
67
+ add_admin_accessible_attrs(attrs)
68
+ elsif initiative.created?
69
+ attrs[:signature_end_date] = form.signature_end_date if initiative.custom_signature_end_date_enabled?
70
+ attrs[:decidim_area_id] = form.area_id if initiative.area_enabled?
65
71
  end
66
72
 
67
73
  attrs
68
74
  end
69
75
 
76
+ def add_admin_accessible_attrs(attrs)
77
+ attrs[:signature_start_date] = form.signature_start_date
78
+ attrs[:signature_end_date] = form.signature_end_date
79
+ attrs[:offline_votes] = form.offline_votes if form.offline_votes
80
+ attrs[:state] = form.state if form.state
81
+ attrs[:decidim_area_id] = form.area_id
82
+
83
+ if initiative.published?
84
+ @notify_extended = true if form.signature_end_date != initiative.signature_end_date &&
85
+ form.signature_end_date > initiative.signature_end_date
86
+ end
87
+ end
88
+
70
89
  def notify_initiative_is_extended
71
90
  Decidim::EventsManager.publish(
72
91
  event: "decidim.events.initiatives.initiative_extended",
@@ -42,8 +42,12 @@ module Decidim
42
42
  result = {
43
43
  title: form.title,
44
44
  description: form.description,
45
- online_signature_enabled: form.online_signature_enabled,
45
+ signature_type: form.signature_type,
46
+ attachments_enabled: form.attachments_enabled,
46
47
  undo_online_signatures_enabled: form.undo_online_signatures_enabled,
48
+ custom_signature_end_date_enabled: form.custom_signature_end_date_enabled,
49
+ area_enabled: form.area_enabled,
50
+ promoting_committee_enabled: form.promoting_committee_enabled,
47
51
  minimum_committee_members: form.minimum_committee_members,
48
52
  collect_user_extra_fields: form.collect_user_extra_fields,
49
53
  extra_fields_legal_information: form.extra_fields_legal_information,
@@ -56,10 +60,8 @@ module Decidim
56
60
  end
57
61
 
58
62
  def upate_initiatives_signature_type
59
- unless initiative_type.online_signature_enabled
60
- initiative_type.initiatives.signature_type_updatable.each do |initiative|
61
- initiative.update!(signature_type: Initiative.signature_types["offline"])
62
- end
63
+ initiative_type.initiatives.signature_type_updatable.each do |initiative|
64
+ initiative.update!(signature_type: initiative_type.signature_type)
63
65
  end
64
66
  end
65
67
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ module AttachmentMethods
6
+ private
7
+
8
+ def build_attachment
9
+ @attachment = Attachment.new(
10
+ title: @form.attachment.title,
11
+ file: @form.attachment.file,
12
+ attached_to: @attached_to
13
+ )
14
+ end
15
+
16
+ def attachment_invalid?
17
+ if attachment.invalid? && attachment.errors.has_key?(:file)
18
+ @form.attachment.errors.add :file, attachment.errors[:file]
19
+ true
20
+ end
21
+ end
22
+
23
+ def create_attachment
24
+ attachment.attached_to = @attached_to
25
+ attachment.save!
26
+ end
27
+
28
+ def process_attachments?
29
+ @form.attachment && @form.attachment.file.present?
30
+ end
31
+ end
32
+ end
33
+ end