decidim-initiatives 0.27.5 → 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -3
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb +17 -18
- data/app/cells/decidim/initiatives/initiative_cell.rb +6 -1
- data/app/cells/decidim/initiatives/initiative_dropdown_metadata_cell.rb +19 -0
- data/app/cells/decidim/initiatives/initiative_g_cell.rb +31 -0
- data/app/cells/decidim/initiatives/initiative_metadata_g_cell.rb +62 -0
- data/app/cells/decidim/initiatives/initiative_s_cell.rb +15 -0
- data/app/cells/decidim/initiatives_votes/vote/show.erb +25 -19
- data/app/cells/decidim/initiatives_votes/vote_cell.rb +3 -1
- data/app/commands/decidim/initiatives/admin/accept_initiative.rb +40 -0
- data/app/commands/decidim/initiatives/admin/create_initiative_type.rb +1 -1
- data/app/commands/decidim/initiatives/admin/create_initiative_type_scope.rb +1 -1
- data/app/commands/decidim/initiatives/admin/discard_initiative.rb +40 -0
- data/app/commands/decidim/initiatives/admin/publish_initiative.rb +1 -1
- data/app/commands/decidim/initiatives/admin/reject_initiative.rb +40 -0
- data/app/commands/decidim/initiatives/admin/send_initiative_to_technical_validation.rb +2 -2
- data/app/commands/decidim/initiatives/admin/unpublish_initiative.rb +1 -1
- data/app/commands/decidim/initiatives/admin/update_initiative.rb +1 -1
- data/app/commands/decidim/initiatives/admin/update_initiative_answer.rb +1 -1
- data/app/commands/decidim/initiatives/admin/update_initiative_type.rb +1 -1
- data/app/commands/decidim/initiatives/admin/update_initiative_type_scope.rb +1 -1
- data/app/commands/decidim/initiatives/admin/update_initiatives_settings.rb +1 -1
- data/app/commands/decidim/initiatives/attachment_methods.rb +2 -24
- data/app/commands/decidim/initiatives/create_initiative.rb +19 -14
- data/app/commands/decidim/initiatives/send_initiative_to_technical_validation.rb +2 -2
- data/app/commands/decidim/initiatives/spawn_committee_request.rb +1 -1
- data/app/commands/decidim/initiatives/unvote_initiative.rb +1 -1
- data/app/commands/decidim/initiatives/update_initiative.rb +9 -2
- data/app/commands/decidim/initiatives/validate_mobile_phone.rb +2 -2
- data/app/commands/decidim/initiatives/vote_initiative.rb +5 -5
- data/app/constraints/decidim/initiatives/current_initiative.rb +1 -1
- data/app/controllers/concerns/decidim/initiatives/admin/filterable.rb +2 -2
- data/app/controllers/concerns/decidim/initiatives/needs_initiative.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/answers_controller.rb +3 -0
- data/app/controllers/decidim/initiatives/admin/committee_requests_controller.rb +2 -0
- data/app/controllers/decidim/initiatives/admin/components_controller.rb +3 -0
- data/app/controllers/decidim/initiatives/admin/initiative_attachments_controller.rb +2 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +17 -6
- data/app/controllers/decidim/initiatives/admin/initiatives_permissions_controller.rb +3 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_settings_controller.rb +2 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_type_scopes_controller.rb +30 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_types_controller.rb +14 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_types_permissions_controller.rb +21 -0
- data/app/controllers/decidim/initiatives/admin/moderations/reports_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/admin/moderations_controller.rb +4 -2
- data/app/controllers/decidim/initiatives/application_controller.rb +0 -1
- data/app/controllers/decidim/initiatives/authorization_create_modals_controller.rb +25 -0
- data/app/controllers/decidim/initiatives/authorization_sign_modals_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/committee_requests_controller.rb +0 -2
- data/app/controllers/decidim/initiatives/create_initiative_controller.rb +62 -115
- data/app/controllers/decidim/initiatives/initiative_signatures_controller.rb +113 -81
- data/app/controllers/decidim/initiatives/initiative_types_controller.rb +7 -0
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +37 -17
- data/app/controllers/decidim/initiatives/versions_controller.rb +0 -1
- data/app/events/decidim/initiatives/admin/initiative_sent_to_technical_validation_event.rb +1 -1
- data/app/events/decidim/initiatives/admin/support_threshold_reached_event.rb +1 -1
- data/app/events/decidim/initiatives/approve_membership_request_event.rb +12 -12
- data/app/events/decidim/initiatives/create_initiative_event.rb +6 -6
- data/app/events/decidim/initiatives/endorse_initiative_event.rb +1 -1
- data/app/events/decidim/initiatives/extend_initiative_event.rb +1 -1
- data/app/events/decidim/initiatives/initiative_sent_to_technical_validation_event.rb +1 -1
- data/app/events/decidim/initiatives/milestone_completed_event.rb +1 -1
- data/app/events/decidim/initiatives/revoke_membership_request_event.rb +12 -12
- data/app/events/decidim/initiatives/spawn_committee_request_event.rb +12 -12
- data/app/forms/decidim/initiatives/admin/initiative_form.rb +1 -1
- data/app/forms/decidim/initiatives/initiative_form.rb +22 -31
- data/app/forms/decidim/initiatives/previous_form.rb +4 -0
- data/app/forms/decidim/initiatives/vote_form.rb +11 -11
- data/app/helpers/decidim/initiatives/admin/initiatives_helper.rb +1 -1
- data/app/helpers/decidim/initiatives/application_helper.rb +4 -61
- data/app/helpers/decidim/initiatives/initiative_helper.rb +48 -5
- data/app/helpers/decidim/initiatives/initiatives_helper.rb +33 -12
- data/app/jobs/decidim/initiatives/export_initiatives_job.rb +1 -1
- data/app/models/decidim/initiative.rb +16 -14
- data/app/models/decidim/initiatives_vote.rb +1 -1
- data/app/packs/entrypoints/decidim_initiatives.js +3 -0
- data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_initiatives.svg +42 -1
- data/app/packs/src/decidim/initiatives/application.js +0 -1
- data/app/packs/src/decidim/initiatives/scoped_type.js +1 -1
- data/app/packs/stylesheets/decidim/initiatives/initiatives-votes.scss +21 -21
- data/app/packs/stylesheets/decidim/initiatives/print-initiative.scss +47 -35
- data/app/packs/stylesheets/initiatives.scss +171 -0
- data/app/permissions/decidim/initiatives/permissions.rb +3 -3
- data/app/presenters/decidim/initiatives/admin_log/initiative_presenter.rb +2 -2
- data/app/presenters/decidim/initiatives/admin_log/initiatives_settings_presenter.rb +2 -2
- data/app/presenters/decidim/initiatives/admin_log/initiatives_type_presenter.rb +2 -2
- data/app/queries/decidim/initiatives/organization_prioritized_initiatives.rb +1 -1
- data/app/queries/decidim/initiatives/similar_initiatives.rb +2 -2
- data/app/queries/decidim/initiatives/support_period_finished_initiatives.rb +1 -1
- data/app/queries/decidim/initiatives/user_authorizations.rb +1 -1
- data/app/services/decidim/initiatives/pdf_signature_example.rb +44 -52
- data/app/views/decidim/initiatives/_modal.html.erb +15 -0
- data/app/views/decidim/initiatives/admin/answers/_info_initiative.html.erb +21 -19
- data/app/views/decidim/initiatives/admin/answers/edit.html.erb +41 -27
- data/app/views/decidim/initiatives/admin/committee_requests/index.html.erb +41 -48
- data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +8 -7
- data/app/views/decidim/initiatives/admin/initiatives/_form.html.erb +111 -95
- data/app/views/decidim/initiatives/admin/initiatives/_initiative_attachments.erb +7 -7
- data/app/views/decidim/initiatives/admin/initiatives/_signatures.html.erb +87 -0
- data/app/views/decidim/initiatives/admin/initiatives/edit.html.erb +72 -60
- data/app/views/decidim/initiatives/admin/initiatives/export_pdf_signatures.html.erb +8 -0
- data/app/views/decidim/initiatives/admin/initiatives/export_pdf_signatures.pdf.erb +5 -78
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +76 -75
- data/app/views/decidim/initiatives/admin/initiatives_settings/_form.html.erb +7 -8
- data/app/views/decidim/initiatives/admin/initiatives_settings/edit.html.erb +17 -5
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/_form.html.erb +11 -6
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/edit.html.erb +16 -22
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/new.html.erb +17 -15
- data/app/views/decidim/initiatives/admin/initiatives_types/_form.html.erb +93 -76
- data/app/views/decidim/initiatives/admin/initiatives_types/_initiative_type_scopes.html.erb +35 -33
- data/app/views/decidim/initiatives/admin/initiatives_types/edit.html.erb +16 -12
- data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +39 -48
- data/app/views/decidim/initiatives/admin/initiatives_types/new.html.erb +16 -9
- data/app/views/decidim/initiatives/committee_requests/new.html.erb +21 -19
- data/app/views/decidim/initiatives/create_initiative/_share_committee_link.html.erb +15 -20
- data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +62 -100
- data/app/views/decidim/initiatives/create_initiative/finish.html.erb +24 -28
- data/app/views/decidim/initiatives/create_initiative/promotal_committee.html.erb +15 -17
- data/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb +32 -46
- data/app/views/decidim/initiatives/initiative_signatures/_wizard_steps.html.erb +15 -19
- data/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb +25 -36
- data/app/views/decidim/initiatives/initiative_signatures/finish.html.erb +5 -16
- data/app/views/decidim/initiatives/initiative_signatures/sms_code.html.erb +8 -19
- data/app/views/decidim/initiatives/initiative_signatures/sms_phone_number.html.erb +8 -20
- data/app/views/decidim/initiatives/initiatives/_committee_members.html.erb +48 -66
- data/app/views/decidim/initiatives/initiatives/_form.html.erb +49 -95
- data/app/views/decidim/initiatives/initiatives/_initiative_badge.html.erb +3 -5
- data/app/views/decidim/initiatives/initiatives/_initiative_hero.html.erb +13 -0
- data/app/views/decidim/initiatives/initiatives/_initiatives.html.erb +6 -15
- data/app/views/decidim/initiatives/initiatives/_interactions.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_new_initiative_button.html.erb +28 -0
- data/app/views/decidim/initiatives/initiatives/_progress_bar.html.erb +2 -6
- data/app/views/decidim/initiatives/initiatives/_result.html.erb +15 -21
- data/app/views/decidim/initiatives/initiatives/_send_to_technical_validation.html.erb +3 -3
- data/app/views/decidim/initiatives/initiatives/_tags_type.html.erb +1 -0
- data/app/views/decidim/initiatives/initiatives/_vote_button.html.erb +9 -9
- data/app/views/decidim/initiatives/initiatives/_vote_cabin.html.erb +7 -7
- data/app/views/decidim/initiatives/initiatives/edit.html.erb +63 -68
- data/app/views/decidim/initiatives/initiatives/index.html.erb +17 -18
- data/app/views/decidim/initiatives/initiatives/index.js.erb +0 -5
- data/app/views/decidim/initiatives/initiatives/print.html.erb +123 -120
- data/app/views/decidim/initiatives/initiatives/show.html.erb +188 -70
- data/app/views/decidim/initiatives/initiatives_mailer/notify_creation.html.erb +2 -2
- data/app/views/decidim/initiatives/initiatives_type_scopes/search.html.erb +2 -1
- data/app/views/decidim/initiatives/versions/show.html.erb +14 -5
- data/app/views/layouts/decidim/_initiative_creation_header.html.erb +17 -28
- data/app/views/layouts/decidim/_initiative_header.html.erb +3 -23
- data/app/views/layouts/decidim/_initiative_header_steps.html.erb +4 -12
- data/app/views/layouts/decidim/_initiative_signature_creation_header.html.erb +5 -26
- data/app/views/layouts/decidim/admin/initiative.html.erb +12 -13
- data/app/views/layouts/decidim/admin/initiatives.html.erb +40 -11
- data/app/views/layouts/decidim/initiative.html.erb +16 -11
- data/app/views/layouts/decidim/initiative_creation.html.erb +7 -18
- data/app/views/layouts/decidim/initiative_head.html.erb +15 -0
- data/app/views/layouts/decidim/initiative_signature_creation.html.erb +3 -11
- data/config/assets.rb +0 -1
- data/config/initializers/wicked_pdf.rb +1 -1
- data/config/locales/ar.yml +1 -93
- data/config/locales/ca.yml +65 -104
- data/config/locales/cs.yml +70 -109
- data/config/locales/de.yml +72 -111
- data/config/locales/el.yml +1 -98
- data/config/locales/en.yml +69 -108
- data/config/locales/es-MX.yml +65 -104
- data/config/locales/es-PY.yml +65 -104
- data/config/locales/es.yml +65 -104
- data/config/locales/eu.yml +66 -105
- data/config/locales/fi-plain.yml +67 -106
- data/config/locales/fi.yml +67 -106
- data/config/locales/fr-CA.yml +69 -108
- data/config/locales/fr.yml +67 -106
- data/config/locales/ga-IE.yml +0 -35
- data/config/locales/gl.yml +1 -89
- data/config/locales/hu.yml +25 -105
- data/config/locales/id-ID.yml +1 -89
- data/config/locales/is-IS.yml +1 -60
- data/config/locales/it.yml +6 -111
- data/config/locales/ja.yml +62 -106
- data/config/locales/lb.yml +6 -86
- data/config/locales/lt.yml +52 -103
- data/config/locales/lv.yml +1 -99
- data/config/locales/nl.yml +6 -104
- data/config/locales/no.yml +6 -114
- data/config/locales/pl.yml +6 -119
- data/config/locales/pt-BR.yml +21 -119
- data/config/locales/pt.yml +6 -111
- data/config/locales/ro-RO.yml +13 -108
- data/config/locales/ru.yml +1 -68
- data/config/locales/sk.yml +1 -85
- data/config/locales/sl.yml +3 -5
- data/config/locales/sv.yml +16 -107
- data/config/locales/tr-TR.yml +9 -110
- data/config/locales/uk.yml +1 -68
- data/config/locales/zh-CN.yml +6 -102
- data/config/locales/zh-TW.yml +31 -95
- data/db/migrate/20171017091734_add_scopes_for_all_initiative_types.rb +1 -1
- data/db/migrate/20171017095143_update_initiative_scoped_type.rb +1 -1
- data/db/migrate/20191002082220_move_signature_type_to_initative_type.rb +1 -1
- data/lib/decidim/api/initiative_committee_member_type.rb +2 -2
- data/lib/decidim/initiatives/admin_engine.rb +13 -93
- data/lib/decidim/initiatives/content_blocks/registry_manager.rb +22 -0
- data/lib/decidim/initiatives/engine.rb +45 -23
- data/lib/decidim/initiatives/menu.rb +150 -0
- data/lib/decidim/initiatives/participatory_space.rb +6 -91
- data/lib/decidim/initiatives/query_extensions.rb +5 -5
- data/lib/decidim/initiatives/seeds.rb +95 -0
- data/lib/decidim/initiatives/test/factories.rb +25 -7
- data/lib/decidim/initiatives/version.rb +1 -1
- data/lib/decidim/initiatives.rb +1 -1
- data/lib/tasks/decidim_initiatives.rake +2 -2
- data/lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake +1 -1
- metadata +47 -76
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +0 -28
- data/app/cells/decidim/initiatives/initiative_m/author.erb +0 -10
- data/app/cells/decidim/initiatives/initiative_m/footer.erb +0 -28
- data/app/cells/decidim/initiatives/initiative_m/tags.erb +0 -9
- data/app/cells/decidim/initiatives/initiative_m_cell.rb +0 -77
- data/app/controllers/decidim/initiatives/widgets_controller.rb +0 -30
- data/app/packs/stylesheets/decidim/initiatives/admin.scss +0 -33
- data/app/packs/stylesheets/decidim/initiatives/initiatives.scss +0 -64
- data/app/packs/stylesheets/decidim/initiatives/popularity_item.scss +0 -76
- data/app/packs/stylesheets/decidim/initiatives/statistics.scss +0 -15
- data/app/views/decidim/initiatives/create_initiative/_finish_help.html.erb +0 -2
- data/app/views/decidim/initiatives/create_initiative/previous_form.html.erb +0 -40
- data/app/views/decidim/initiatives/create_initiative/show_similar_initiatives.html.erb +0 -23
- data/app/views/decidim/initiatives/initiatives/_author.html.erb +0 -35
- data/app/views/decidim/initiatives/initiatives/_count.html.erb +0 -1
- data/app/views/decidim/initiatives/initiatives/_filters.html.erb +0 -33
- data/app/views/decidim/initiatives/initiatives/_filters_small_view.html.erb +0 -18
- data/app/views/decidim/initiatives/initiatives/_index_header.html.erb +0 -44
- data/app/views/decidim/initiatives/initiatives/_tags.html.erb +0 -7
- data/app/views/decidim/initiatives/versions/index.html.erb +0 -8
- data/config/environment.rb +0 -3
- data/db/seeds/city.jpeg +0 -0
- data/db/seeds/city2.jpeg +0 -0
- data/lib/decidim/initiatives/initiatives_filter_form_builder.rb +0 -56
- data/lib/gem_overrides/origami/date.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94122b5162ecd273467e354ff489ba748d195a75c21117126e482cb1948be7b8
|
4
|
+
data.tar.gz: ed119c245be320af5c574cdfd7ca4a5424fde46a7786b6e94d2c52cf6840952b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7ab211a5052a18997c2bd54668f6b1fb5ef387a7511a6da45c357d2cde1f3a0d5c5376dd88adb4736f1470c34d0234160c9c728ea8bb7302c7c1eb69b563f5e
|
7
|
+
data.tar.gz: aa7fc49579be2765fbb0e7752e9c6b60d01e90fb1a3780cdd78a052d30c059ffc7c328cc16c4fe3741ad2d430d7962816a306859d612d0268f6f968f2a7fbeca
|
data/README.md
CHANGED
@@ -49,18 +49,22 @@ Some of the settings of the module need to be set in the code of your app, for e
|
|
49
49
|
This is the case if you want to enable the creation of initiatives even when no authorization method is set.
|
50
50
|
|
51
51
|
Just use the following line:
|
52
|
-
|
52
|
+
|
53
|
+
```ruby
|
53
54
|
Decidim::Initiatives.do_not_require_authorization = true
|
54
55
|
```
|
55
56
|
|
56
57
|
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/develop/decidim-initiatives/lib/decidim/initiatives.rb).
|
57
58
|
|
58
59
|
For example, you can also change the minimum number of required committee members to 1 (default is 2) by adding this line:
|
59
|
-
|
60
|
+
|
61
|
+
```ruby
|
60
62
|
Decidim::Initiatives.minimum_committee_members = 1
|
61
63
|
```
|
64
|
+
|
62
65
|
Or change the number of days given to gather signatures to 365 (default is 120) with:
|
63
|
-
|
66
|
+
|
67
|
+
```ruby
|
64
68
|
Decidim::Initiatives.default_signature_time_period_length = 365
|
65
69
|
```
|
66
70
|
|
@@ -3,37 +3,36 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
5
|
module ContentBlocks
|
6
|
-
class HighlightedInitiativesCell < Decidim::
|
7
|
-
|
6
|
+
class HighlightedInitiativesCell < Decidim::ContentBlocks::HighlightedParticipatorySpacesCell
|
7
|
+
BLOCK_ID = "highlighted-initiatives"
|
8
8
|
|
9
9
|
delegate :current_organization, to: :controller
|
10
10
|
|
11
|
-
def
|
12
|
-
|
11
|
+
def highlighted_spaces
|
12
|
+
@highlighted_spaces ||= OrganizationPrioritizedInitiatives
|
13
|
+
.new(current_organization, order)
|
14
|
+
.query
|
13
15
|
end
|
14
16
|
|
15
|
-
def
|
16
|
-
|
17
|
+
def i18n_scope
|
18
|
+
"decidim.initiatives.pages.home.highlighted_initiatives"
|
17
19
|
end
|
18
20
|
|
19
|
-
def
|
20
|
-
|
21
|
+
def all_path
|
22
|
+
Decidim::Initiatives::Engine.routes.url_helpers.initiatives_path
|
21
23
|
end
|
22
24
|
|
23
|
-
|
24
|
-
@highlighted_initiatives ||= OrganizationPrioritizedInitiatives
|
25
|
-
.new(current_organization, order)
|
26
|
-
.query
|
27
|
-
.limit(max_results)
|
28
|
-
end
|
25
|
+
private
|
29
26
|
|
30
|
-
def
|
31
|
-
|
27
|
+
def max_results
|
28
|
+
model.settings.max_results
|
32
29
|
end
|
33
30
|
|
34
|
-
def
|
35
|
-
|
31
|
+
def order
|
32
|
+
model.settings.order
|
36
33
|
end
|
34
|
+
|
35
|
+
def block_id = BLOCK_ID
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
class InitiativeDropdownMetadataCell < Decidim::ParticipatorySpaceDropdownMetadataCell
|
6
|
+
include InitiativesHelper
|
7
|
+
include Decidim::ComponentPathHelper
|
8
|
+
include ActiveLinkTo
|
9
|
+
|
10
|
+
def decidim_initiatives
|
11
|
+
Decidim::Initiatives::Engine.routes.url_helpers
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def nav_items_method = :initiative_nav_items
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
# This cell renders the Grid (:g) initiative card
|
6
|
+
# for a given instance of an Initiative
|
7
|
+
class InitiativeGCell < Decidim::CardGCell
|
8
|
+
private
|
9
|
+
|
10
|
+
def resource_path
|
11
|
+
Decidim::Initiatives::Engine.routes.url_helpers.initiative_path(model)
|
12
|
+
end
|
13
|
+
|
14
|
+
def has_image?
|
15
|
+
image.present?
|
16
|
+
end
|
17
|
+
|
18
|
+
def image
|
19
|
+
@image ||= model.attachments.find(&:image?)
|
20
|
+
end
|
21
|
+
|
22
|
+
def resource_image_path
|
23
|
+
image.url if has_image?
|
24
|
+
end
|
25
|
+
|
26
|
+
def metadata_cell
|
27
|
+
"decidim/initiatives/initiative_metadata_g"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
# This cell renders the assembly metadata for g card
|
6
|
+
class InitiativeMetadataGCell < Decidim::CardMetadataCell
|
7
|
+
include Cell::ViewModel::Partial
|
8
|
+
include Decidim::Initiatives::InitiativeHelper
|
9
|
+
|
10
|
+
alias current_initiative resource
|
11
|
+
alias initiative resource
|
12
|
+
|
13
|
+
def initialize(*)
|
14
|
+
super
|
15
|
+
|
16
|
+
@items.prepend(*initiative_items)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def initiative_items
|
22
|
+
[dates_item, progress_bar_item, state_item].compact
|
23
|
+
end
|
24
|
+
|
25
|
+
def start_date
|
26
|
+
initiative.signature_start_date
|
27
|
+
end
|
28
|
+
|
29
|
+
def end_date
|
30
|
+
initiative.signature_end_date
|
31
|
+
end
|
32
|
+
|
33
|
+
def state_item
|
34
|
+
return if initiative.state.blank?
|
35
|
+
|
36
|
+
{
|
37
|
+
text: content_tag(
|
38
|
+
:span,
|
39
|
+
t(initiative.state, scope: "decidim.initiatives.show.badge_name"),
|
40
|
+
class: "label #{metadata_badge_css_class(initiative.state)} initiative-status"
|
41
|
+
)
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def progress_bar_item
|
46
|
+
return if %w(created validating discarded).include?(initiative.state)
|
47
|
+
|
48
|
+
type_scope = initiative.votable_initiative_type_scopes[0]
|
49
|
+
|
50
|
+
{
|
51
|
+
cell: "decidim/progress_bar",
|
52
|
+
args: [initiative.supports_count_for(type_scope.scope), {
|
53
|
+
total: type_scope.supports_required,
|
54
|
+
element_id: "initiative-#{initiative.id}-votes-count",
|
55
|
+
class: "progress-bar__sm"
|
56
|
+
}],
|
57
|
+
icon: nil
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
# This cell renders the Search (:s) initiative card
|
6
|
+
# for a given instance of an Initiative
|
7
|
+
class InitiativeSCell < Decidim::CardSCell
|
8
|
+
private
|
9
|
+
|
10
|
+
def metadata_cell
|
11
|
+
"decidim/initiatives/initiative_metadata_g"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,33 +1,39 @@
|
|
1
|
+
<% collect_user_extra_fields = model.initiative.type.collect_user_extra_fields %>
|
2
|
+
<% cell_small_width = collect_user_extra_fields ? "9.4%" : "15.6%" %>
|
3
|
+
<% style_initiatives_votes_table_row = "width: 100%; display: inline-block; min-height: 33pt; border-bottom: 1pt solid black;" %>
|
4
|
+
<% style_initiatives_votes_table_cell = "width: #{cell_small_width}; padding-left: 5pt; word-wrap: break-word; display: inline-block; float: left; min-height: 36pt;" %>
|
1
5
|
<br>
|
2
|
-
<div class="initiatives-votes-table-row" style="
|
3
|
-
<div class="initiatives-votes-table-cell w11" style="
|
6
|
+
<div class="initiatives-votes-table-row" style="<%= style_initiatives_votes_table_row %>">
|
7
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
4
8
|
<%= initiative_id %>
|
5
9
|
</div>
|
6
|
-
<div class="initiatives-votes-table-cell w11" style="
|
10
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
7
11
|
<%= initiative_title %>
|
8
12
|
</div>
|
9
|
-
|
10
|
-
<%=
|
11
|
-
|
12
|
-
|
13
|
-
<%=
|
14
|
-
|
15
|
-
|
16
|
-
<%=
|
17
|
-
|
18
|
-
|
19
|
-
<%=
|
20
|
-
|
21
|
-
|
13
|
+
<% if collect_user_extra_fields %>
|
14
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
15
|
+
<%= name_and_surname %>
|
16
|
+
</div>
|
17
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
18
|
+
<%= document_number %>
|
19
|
+
</div>
|
20
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
21
|
+
<%= date_of_birth %>
|
22
|
+
</div>
|
23
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
24
|
+
<%= postal_code %>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
22
28
|
<%= time_and_date %>
|
23
29
|
</div>
|
24
|
-
<div class="initiatives-votes-table-cell w11" style="
|
30
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
25
31
|
<%= timestamp %>
|
26
32
|
</div>
|
27
|
-
<div class="initiatives-votes-table-cell w11" style="
|
33
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
28
34
|
<%= hash_id %>
|
29
35
|
</div>
|
30
|
-
<div class="initiatives-votes-table-cell w11" style="
|
36
|
+
<div class="initiatives-votes-table-cell w11" style="<%= style_initiatives_votes_table_cell %>">
|
31
37
|
<%= scope %>
|
32
38
|
</div>
|
33
39
|
</div>
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Decidim
|
4
4
|
module InitiativesVotes
|
5
5
|
class VoteCell < Decidim::ViewModel
|
6
|
+
include Decidim::SanitizeHelper
|
7
|
+
|
6
8
|
delegate :timestamp, :hash_id, to: :model
|
7
9
|
|
8
10
|
def show
|
@@ -14,7 +16,7 @@ module Decidim
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def initiative_title
|
17
|
-
translated_attribute(model.initiative.title)
|
19
|
+
decidim_sanitize(translated_attribute(model.initiative.title))
|
18
20
|
end
|
19
21
|
|
20
22
|
def name_and_surname
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic that accepts an
|
7
|
+
# existing initiative.
|
8
|
+
class AcceptInitiative < Decidim::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# initiative - Decidim::Initiative
|
12
|
+
# current_user - the user performing the action
|
13
|
+
def initialize(initiative, current_user)
|
14
|
+
@initiative = initiative
|
15
|
+
@current_user = current_user
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) if initiative.accepted?
|
26
|
+
|
27
|
+
@initiative = Decidim.traceability.perform_action!(:accept, initiative, current_user) do
|
28
|
+
initiative.accepted!
|
29
|
+
initiative
|
30
|
+
end
|
31
|
+
broadcast(:ok, initiative)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :initiative, :current_user
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
# Executes the command. Broadcasts these events:
|
17
17
|
#
|
18
18
|
# - :ok when everything is valid.
|
19
|
-
# - :invalid if the form
|
19
|
+
# - :invalid if the form was not valid and we could not proceed.
|
20
20
|
#
|
21
21
|
# Returns nothing.
|
22
22
|
def call
|
@@ -15,7 +15,7 @@ module Decidim
|
|
15
15
|
# Executes the command. Broadcasts these events:
|
16
16
|
#
|
17
17
|
# - :ok when everything is valid.
|
18
|
-
# - :invalid if the form
|
18
|
+
# - :invalid if the form was not valid and we could not proceed.
|
19
19
|
#
|
20
20
|
# Returns nothing.
|
21
21
|
def call
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic that discards an
|
7
|
+
# existing initiative.
|
8
|
+
class DiscardInitiative < Decidim::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# initiative - Decidim::Initiative
|
12
|
+
# current_user - the user performing the action
|
13
|
+
def initialize(initiative, current_user)
|
14
|
+
@initiative = initiative
|
15
|
+
@current_user = current_user
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) if initiative.discarded?
|
26
|
+
|
27
|
+
@initiative = Decidim.traceability.perform_action!(:discard, initiative, current_user) do
|
28
|
+
initiative.discarded!
|
29
|
+
initiative
|
30
|
+
end
|
31
|
+
broadcast(:ok, initiative)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :initiative, :current_user
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
module Admin
|
6
|
+
# A command with all the business logic that rejects an
|
7
|
+
# existing initiative.
|
8
|
+
class RejectInitiative < Decidim::Command
|
9
|
+
# Public: Initializes the command.
|
10
|
+
#
|
11
|
+
# initiative - Decidim::Initiative
|
12
|
+
# current_user - the user performing the action
|
13
|
+
def initialize(initiative, current_user)
|
14
|
+
@initiative = initiative
|
15
|
+
@current_user = current_user
|
16
|
+
end
|
17
|
+
|
18
|
+
# Executes the command. Broadcasts these events:
|
19
|
+
#
|
20
|
+
# - :ok when everything is valid.
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
|
+
#
|
23
|
+
# Returns nothing.
|
24
|
+
def call
|
25
|
+
return broadcast(:invalid) if initiative.rejected?
|
26
|
+
|
27
|
+
@initiative = Decidim.traceability.perform_action!(:reject, initiative, current_user) do
|
28
|
+
initiative.rejected!
|
29
|
+
initiative
|
30
|
+
end
|
31
|
+
broadcast(:ok, initiative)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :initiative, :current_user
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -47,7 +47,7 @@ module Decidim
|
|
47
47
|
event: "decidim.events.initiatives.admin.initiative_sent_to_technical_validation",
|
48
48
|
event_class: Decidim::Initiatives::Admin::InitiativeSentToTechnicalValidationEvent,
|
49
49
|
resource: initiative,
|
50
|
-
affected_users
|
50
|
+
affected_users:,
|
51
51
|
force_send: true
|
52
52
|
}
|
53
53
|
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
# Executes the command. Broadcasts these events:
|
23
23
|
#
|
24
24
|
# - :ok when everything is valid.
|
25
|
-
# - :invalid if the form
|
25
|
+
# - :invalid if the form was not valid and we could not proceed.
|
26
26
|
#
|
27
27
|
# Returns nothing.
|
28
28
|
def call
|
@@ -20,7 +20,7 @@ module Decidim
|
|
20
20
|
# Executes the command. Broadcasts these events:
|
21
21
|
#
|
22
22
|
# - :ok when everything is valid.
|
23
|
-
# - :invalid if the form
|
23
|
+
# - :invalid if the form was not valid and we could not proceed.
|
24
24
|
#
|
25
25
|
# Returns nothing.
|
26
26
|
def call
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
# Executes the command. Broadcasts these events:
|
22
22
|
#
|
23
23
|
# - :ok when everything is valid.
|
24
|
-
# - :invalid if the form
|
24
|
+
# - :invalid if the form was not valid and we could not proceed.
|
25
25
|
#
|
26
26
|
# Returns nothing.
|
27
27
|
def call
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form
|
21
|
+
# - :invalid if the form was not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
19
19
|
#
|
20
20
|
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form or initiatives_settings
|
21
|
+
# - :invalid if the form or initiatives_settings is not valid and we could not proceed.
|
22
22
|
#
|
23
23
|
# Returns nothing.
|
24
24
|
def call
|
@@ -3,31 +3,9 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
5
|
module AttachmentMethods
|
6
|
-
|
7
|
-
|
8
|
-
def build_attachment(attached_to = nil)
|
9
|
-
attached_to = @attached_to if attached_to.blank?
|
10
|
-
attached_to = form.current_organization if attached_to.blank? && form.respond_to?(:current_organization)
|
11
|
-
|
12
|
-
@attachment = Attachment.new(
|
13
|
-
title: { I18n.locale => @form.attachment.title },
|
14
|
-
attached_to: attached_to,
|
15
|
-
file: @form.attachment.file, # Define attached_to before this
|
16
|
-
content_type: @form.attachment.file.content_type
|
17
|
-
)
|
18
|
-
end
|
6
|
+
include Decidim::AttachmentMethods
|
19
7
|
|
20
|
-
|
21
|
-
if attachment.invalid? && attachment.errors.has_key?(:file)
|
22
|
-
@form.attachment.errors.add :file, attachment.errors[:file]
|
23
|
-
true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def create_attachment
|
28
|
-
attachment.attached_to = @attached_to
|
29
|
-
attachment.save!
|
30
|
-
end
|
8
|
+
private
|
31
9
|
|
32
10
|
def process_attachments?
|
33
11
|
@form.attachment && @form.attachment.file.present? &&
|