decidim-initiatives 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -0
- data/app/assets/images/decidim/gamification/badges/initiatives.svg +1 -87
- data/app/assets/images/decidim/initiatives/icon.svg +1 -3
- data/app/assets/stylesheet/decidim/initiatives/initiatives-votes.css.scss +0 -1
- data/app/assets/stylesheet/decidim/initiatives/initiatives.scss +0 -8
- data/app/assets/stylesheet/decidim/initiatives/popularity_item.css.scss +0 -1
- data/app/assets/stylesheet/decidim/initiatives/print-initiative.css.scss +0 -3
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +4 -3
- data/app/cells/decidim/initiatives/initiative_m_cell.rb +11 -0
- data/app/commands/decidim/initiatives/admin/create_initiative_type.rb +3 -0
- data/app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb +17 -0
- data/app/commands/decidim/initiatives/admin/update_initiative.rb +29 -10
- data/app/commands/decidim/initiatives/admin/update_initiative_type.rb +3 -0
- data/app/commands/decidim/initiatives/attachment_methods.rb +33 -0
- data/app/commands/decidim/initiatives/create_initiative.rb +23 -1
- data/app/commands/decidim/initiatives/vote_initiative.rb +16 -0
- data/app/controllers/concerns/decidim/initiatives/admin/filterable.rb +18 -4
- data/app/controllers/concerns/decidim/initiatives/orderable.rb +3 -1
- data/app/controllers/concerns/decidim/initiatives/single_initiative_type.rb +26 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +20 -1
- data/app/controllers/decidim/initiatives/create_initiative_controller.rb +35 -5
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +17 -3
- data/app/controllers/decidim/initiatives/versions_controller.rb +20 -0
- data/app/events/decidim/initiatives/admin/initiative_sent_to_technical_validation_event.rb +21 -0
- data/app/events/decidim/initiatives/admin/support_threshold_reached_event.rb +13 -0
- data/app/forms/decidim/initiatives/admin/initiative_form.rb +31 -0
- data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +5 -1
- data/app/forms/decidim/initiatives/initiative_form.rb +34 -0
- data/app/forms/decidim/initiatives/vote_form.rb +3 -1
- data/app/helpers/decidim/initiatives/application_helper.rb +104 -0
- data/app/helpers/decidim/initiatives/initiative_helper.rb +13 -0
- data/app/helpers/decidim/initiatives/initiatives_helper.rb +10 -0
- data/app/jobs/decidim/initiatives/export_initiatives_job.rb +25 -0
- data/app/mailers/decidim/initiatives/initiatives_mailer.rb +0 -21
- data/app/models/concerns/decidim/initiatives/has_area.rb +30 -0
- data/app/models/decidim/initiative.rb +62 -10
- data/app/permissions/decidim/initiatives/admin/permissions.rb +7 -0
- data/app/permissions/decidim/initiatives/permissions.rb +35 -10
- data/app/serializers/decidim/initiatives/initiative_serializer.rb +32 -0
- data/app/services/decidim/initiatives/diff_renderer.rb +18 -0
- data/app/services/decidim/initiatives/initiative_search.rb +59 -15
- data/app/services/decidim/initiatives/status_change_notifier.rb +4 -5
- data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +8 -0
- data/app/views/decidim/initiatives/admin/initiatives/_form.html.erb +24 -1
- data/app/views/decidim/initiatives/admin/initiatives/_initiative_attachments.erb +43 -0
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +8 -3
- data/app/views/decidim/initiatives/admin/initiatives_types/_form.html.erb +12 -0
- data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +44 -10
- data/app/views/decidim/initiatives/create_initiative/finish.html.erb +17 -10
- data/app/views/decidim/initiatives/create_initiative/previous_form.html.erb +2 -1
- data/app/views/decidim/initiatives/create_initiative/promotal_committee.html.erb +1 -1
- data/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb +1 -2
- data/app/views/decidim/initiatives/create_initiative/show_similar_initiatives.html.erb +1 -1
- data/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb +1 -0
- data/app/views/decidim/initiatives/initiatives/_author.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_filters.html.erb +16 -28
- data/app/views/decidim/initiatives/initiatives/_index_header.html.erb +3 -3
- data/app/views/decidim/initiatives/initiatives/_initiatives.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_interactions.html.erb +2 -3
- data/app/views/decidim/initiatives/initiatives/_tags.html.erb +3 -0
- data/app/views/decidim/initiatives/initiatives/index.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/show.html.erb +1 -0
- data/app/views/decidim/initiatives/versions/index.html.erb +8 -0
- data/app/views/decidim/initiatives/versions/show.html.erb +10 -0
- data/app/views/layouts/decidim/_initiative_creation_header.html.erb +2 -1
- data/app/views/layouts/decidim/_initiative_header.html.erb +2 -1
- data/app/views/layouts/decidim/_initiative_signature_creation_header.html.erb +1 -1
- data/app/views/layouts/decidim/initiative_creation.html.erb +1 -2
- data/app/views/layouts/decidim/initiative_signature_creation.html.erb +2 -2
- data/config/locales/ar.yml +12 -19
- data/config/locales/bg-BG.yml +13 -0
- data/config/locales/ca.yml +79 -17
- data/config/locales/cs.yml +88 -26
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/de.yml +67 -16
- data/config/locales/el.yml +528 -0
- data/config/locales/en.yml +82 -20
- data/config/locales/es-MX.yml +79 -17
- data/config/locales/es-PY.yml +79 -17
- data/config/locales/es.yml +81 -19
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/eu.yml +4 -7
- data/config/locales/fi-plain.yml +79 -17
- data/config/locales/fi.yml +97 -35
- data/config/locales/fr-CA.yml +529 -0
- data/config/locales/fr.yml +66 -16
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +4 -7
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hu.yml +21 -18
- data/config/locales/id-ID.yml +4 -7
- data/config/locales/is-IS.yml +4 -7
- data/config/locales/it.yml +105 -57
- data/config/locales/ja-JP.yml +535 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lv-LV.yml +529 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/nl.yml +66 -16
- data/config/locales/no.yml +14 -29
- data/config/locales/pl.yml +241 -176
- data/config/locales/pt-BR.yml +5 -8
- data/config/locales/pt.yml +227 -176
- data/config/locales/ro-RO.yml +532 -0
- data/config/locales/ru.yml +4 -7
- data/config/locales/sk-SK.yml +468 -0
- data/config/locales/sk.yml +462 -0
- data/config/locales/sl.yml +18 -0
- data/config/locales/sr-CS.yml +8 -0
- data/config/locales/sv.yml +77 -26
- data/config/locales/tr-TR.yml +4 -7
- data/config/locales/uk.yml +4 -7
- data/db/migrate/20200320105920_index_foreign_keys_in_decidim_initiatives.rb +8 -0
- data/db/migrate/20200320105921_index_foreign_keys_in_decidim_initiatives_votes.rb +8 -0
- data/db/migrate/20200417120551_add_custom_signature_end_time_option.rb +7 -0
- data/db/migrate/20200424110930_add_attachments_enabled_option.rb +7 -0
- data/db/migrate/20200514085422_add_area_to_initiatives.rb +7 -0
- data/db/migrate/20200514102631_add_area_enabled_option_to_initiatives.rb +7 -0
- data/db/seeds/city2.jpeg +0 -0
- data/lib/decidim/initiatives/admin_engine.rb +4 -0
- data/lib/decidim/initiatives/engine.rb +1 -0
- data/lib/decidim/initiatives/participatory_space.rb +9 -1
- data/lib/decidim/initiatives/test/factories.rb +30 -1
- data/lib/decidim/initiatives/version.rb +1 -1
- metadata +55 -15
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c17f1f5c3ad33e6ca352c73fc8e551b3e58e486a223598804acfd6819671bb31
|
4
|
+
data.tar.gz: b6cce6c33ad0ddb6a82473190b019a6808ddbf105fe1644df72b9589032a74b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,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>
|
@@ -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
|
-
<
|
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
|
-
<
|
14
|
+
<span class="card__title"><%= decidim_html_escape(translated_attribute(initiative.title)) %></span>
|
14
15
|
<% end %>
|
15
16
|
</div>
|
16
|
-
</
|
17
|
+
</div>
|
17
18
|
</div>
|
18
19
|
<% end %>
|
19
20
|
</div>
|
@@ -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"
|
@@ -41,7 +41,10 @@ module Decidim
|
|
41
41
|
title: form.title,
|
42
42
|
description: form.description,
|
43
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,
|
45
48
|
promoting_committee_enabled: form.promoting_committee_enabled,
|
46
49
|
minimum_committee_members: form.minimum_committee_members,
|
47
50
|
banner_image: form.banner_image,
|
@@ -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
|
57
|
-
|
58
|
-
attrs[:
|
59
|
-
attrs[:
|
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",
|
@@ -43,7 +43,10 @@ module Decidim
|
|
43
43
|
title: form.title,
|
44
44
|
description: form.description,
|
45
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,
|
47
50
|
promoting_committee_enabled: form.promoting_committee_enabled,
|
48
51
|
minimum_committee_members: form.minimum_committee_members,
|
49
52
|
collect_user_extra_fields: form.collect_user_extra_fields,
|
@@ -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
|
@@ -5,6 +5,7 @@ module Decidim
|
|
5
5
|
# A command with all the business logic that creates a new initiative.
|
6
6
|
class CreateInitiative < Rectify::Command
|
7
7
|
include CurrentLocale
|
8
|
+
include AttachmentMethods
|
8
9
|
|
9
10
|
# Public: Initializes the command.
|
10
11
|
#
|
@@ -24,6 +25,11 @@ module Decidim
|
|
24
25
|
def call
|
25
26
|
return broadcast(:invalid) if form.invalid?
|
26
27
|
|
28
|
+
if process_attachments?
|
29
|
+
build_attachment
|
30
|
+
return broadcast(:invalid) if attachment_invalid?
|
31
|
+
end
|
32
|
+
|
27
33
|
initiative = create_initiative
|
28
34
|
|
29
35
|
if initiative.persisted?
|
@@ -35,7 +41,7 @@ module Decidim
|
|
35
41
|
|
36
42
|
private
|
37
43
|
|
38
|
-
attr_reader :form, :current_user
|
44
|
+
attr_reader :form, :current_user, :attachment
|
39
45
|
|
40
46
|
# Creates the initiative and all default components
|
41
47
|
def create_initiative
|
@@ -44,6 +50,8 @@ module Decidim
|
|
44
50
|
|
45
51
|
initiative.transaction do
|
46
52
|
initiative.save!
|
53
|
+
@attached_to = initiative
|
54
|
+
create_attachment if process_attachments?
|
47
55
|
create_components_for(initiative)
|
48
56
|
send_notification(initiative)
|
49
57
|
add_author_as_follower(initiative)
|
@@ -61,7 +69,9 @@ module Decidim
|
|
61
69
|
author: current_user,
|
62
70
|
decidim_user_group_id: form.decidim_user_group_id,
|
63
71
|
scoped_type: scoped_type,
|
72
|
+
area: area,
|
64
73
|
signature_type: form.signature_type,
|
74
|
+
signature_end_date: signature_end_date,
|
65
75
|
state: "created"
|
66
76
|
)
|
67
77
|
end
|
@@ -73,6 +83,18 @@ module Decidim
|
|
73
83
|
)
|
74
84
|
end
|
75
85
|
|
86
|
+
def signature_end_date
|
87
|
+
return nil unless form.context.initiative_type.custom_signature_end_date_enabled?
|
88
|
+
|
89
|
+
form.signature_end_date
|
90
|
+
end
|
91
|
+
|
92
|
+
def area
|
93
|
+
return nil unless form.context.initiative_type.area_enabled?
|
94
|
+
|
95
|
+
form.area
|
96
|
+
end
|
97
|
+
|
76
98
|
def create_components_for(initiative)
|
77
99
|
Decidim::Initiatives.default_components.each do |component_name|
|
78
100
|
component = Decidim::Component.create!(
|