decidim-proposals 0.31.8 → 0.32.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -14
- data/app/cells/decidim/proposals/proposal_vote/show.erb +16 -1
- data/app/commands/decidim/proposals/admin/merge_proposals.rb +1 -0
- data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +13 -1
- data/app/commands/decidim/proposals/admin/update_proposal.rb +1 -1
- data/app/commands/decidim/proposals/admin/update_proposal_taxonomies.rb +1 -0
- data/app/commands/decidim/proposals/create_proposal.rb +1 -1
- data/app/commands/decidim/proposals/gallery_methods.rb +17 -0
- data/app/commands/decidim/proposals/unvote_proposal.rb +0 -1
- data/app/commands/decidim/proposals/update_proposal.rb +1 -1
- data/app/controllers/concerns/decidim/proposals/admin/filterable.rb +0 -7
- data/app/controllers/concerns/decidim/proposals/admin/needs_interpolations.rb +0 -2
- data/app/controllers/concerns/decidim/proposals/orderable.rb +22 -3
- data/app/controllers/decidim/proposals/admin/evaluation_assignments_controller.rb +2 -2
- data/app/controllers/decidim/proposals/admin/participatory_texts_controller.rb +4 -5
- data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +3 -4
- data/app/controllers/decidim/proposals/admin/proposal_states_controller.rb +2 -2
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +4 -7
- data/app/controllers/decidim/proposals/admin/proposals_imports_controller.rb +2 -2
- data/app/controllers/decidim/proposals/admin/proposals_merges_controller.rb +1 -2
- data/app/controllers/decidim/proposals/invite_coauthors_controller.rb +2 -2
- data/app/controllers/decidim/proposals/proposal_votes_controller.rb +1 -1
- data/app/controllers/decidim/proposals/proposals_controller.rb +30 -12
- data/app/controllers/decidim/proposals/versions_controller.rb +12 -10
- data/app/events/decidim/proposals/admin/proposal_assigned_to_evaluator_event.rb +1 -1
- data/app/events/decidim/proposals/admin/proposal_note_created_event.rb +1 -1
- data/app/forms/decidim/proposals/admin/proposal_form.rb +53 -4
- data/app/forms/decidim/proposals/admin/proposals_import_form.rb +2 -0
- data/app/forms/decidim/proposals/admin/proposals_merge_form.rb +3 -2
- data/app/forms/decidim/proposals/proposal_form.rb +3 -3
- data/app/helpers/decidim/proposals/application_helper.rb +25 -39
- data/app/jobs/decidim/proposals/admin/import_proposals_job.rb +1 -3
- data/app/jobs/decidim/proposals/hide_all_created_by_author_job.rb +0 -3
- data/app/models/decidim/proposals/proposal.rb +43 -20
- data/app/packs/entrypoints/decidim_proposals_geocoding.js +2 -0
- data/app/packs/stylesheets/decidim/proposals/proposals.scss +2 -2
- data/app/permissions/decidim/proposals/admin/permissions.rb +0 -13
- data/app/permissions/decidim/proposals/permissions.rb +2 -60
- data/app/presenters/decidim/proposals/admin_log/value_types/evaluator_role_user_presenter.rb +3 -4
- data/app/views/decidim/proposals/admin/participatory_texts/index.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposal_states/index.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/_actions.html.erb +2 -2
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +0 -4
- data/app/views/decidim/proposals/admin/proposals/show.html.erb +7 -19
- data/app/views/decidim/proposals/admin/proposals_merges/_form.html.erb +1 -1
- data/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +1 -1
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_proposal_actions.html.erb +4 -4
- data/app/views/decidim/proposals/proposals/_proposal_aside.html.erb +1 -2
- data/app/views/decidim/proposals/proposals/_votes_count.html.erb +16 -0
- data/app/views/decidim/proposals/proposals/index.html.erb +1 -8
- data/app/{cells/decidim/proposals/proposal_votes_count/participatory_texts.erb → views/decidim/proposals/proposals/participatory_texts/_proposal_votes_count.html.erb} +17 -17
- data/app/views/decidim/proposals/proposals/show.html.erb +2 -25
- data/app/views/decidim/proposals/versions/show.html.erb +0 -5
- data/config/locales/ar.yml +23 -105
- data/config/locales/bg.yml +25 -105
- data/config/locales/bs-BA.yml +0 -1
- data/config/locales/ca-IT.yml +36 -130
- data/config/locales/ca.yml +34 -131
- data/config/locales/cs.yml +26 -119
- data/config/locales/de.yml +28 -136
- data/config/locales/el.yml +23 -102
- data/config/locales/en.yml +27 -123
- data/config/locales/es-MX.yml +32 -129
- data/config/locales/es-PY.yml +32 -129
- data/config/locales/es.yml +32 -129
- data/config/locales/eu.yml +150 -247
- data/config/locales/fi-plain.yml +31 -128
- data/config/locales/fi.yml +31 -128
- data/config/locales/fr-CA.yml +34 -118
- data/config/locales/fr.yml +34 -127
- data/config/locales/ga-IE.yml +1 -33
- data/config/locales/gl.yml +30 -640
- data/config/locales/he-IL.yml +0 -1
- data/config/locales/hu.yml +22 -93
- data/config/locales/id-ID.yml +21 -87
- data/config/locales/is-IS.yml +4 -26
- data/config/locales/it.yml +23 -105
- data/config/locales/ja.yml +32 -127
- data/config/locales/lb.yml +0 -1
- data/config/locales/lt.yml +23 -109
- data/config/locales/lv.yml +21 -91
- data/config/locales/nl.yml +22 -91
- data/config/locales/no.yml +23 -91
- data/config/locales/pl.yml +25 -109
- data/config/locales/pt-BR.yml +36 -110
- data/config/locales/pt.yml +23 -93
- data/config/locales/ro-RO.yml +23 -95
- data/config/locales/ru.yml +11 -32
- data/config/locales/sk.yml +20 -680
- data/config/locales/sl.yml +0 -7
- data/config/locales/sr-CS.yml +0 -1
- data/config/locales/sv.yml +35 -133
- data/config/locales/tr-TR.yml +27 -95
- data/config/locales/uk.yml +11 -28
- data/config/locales/zh-CN.yml +22 -91
- data/config/locales/zh-TW.yml +23 -100
- data/db/data/20260224210316_remove_collaborative_drafts_references.rb +119 -0
- data/db/migrate/20171212102250_enable_pg_trgm_extension_for_proposals.rb +1 -1
- data/db/migrate/20200212120110_sync_proposals_state_with_amendments_state.rb +2 -2
- data/db/migrate/20200306123652_publish_existing_proposals_state.rb +2 -2
- data/db/migrate/20200827154156_add_commentable_counter_cache_to_proposals.rb +12 -4
- data/db/migrate/20210310120812_add_followable_counter_cache_to_collaborative_drafts.rb +6 -2
- data/db/migrate/20250515132352_drop_collaborative_drafts_tables.rb +12 -0
- data/decidim-proposals.gemspec +12 -15
- data/lib/decidim/api/mutations/answer_proposal_attributes.rb +2 -2
- data/lib/decidim/api/mutations/create_proposal_type.rb +52 -0
- data/lib/decidim/api/mutations/proposal_answer_type.rb +7 -15
- data/lib/decidim/api/mutations/proposal_attributes.rb +17 -0
- data/lib/decidim/api/mutations/proposal_mutation_type.rb +4 -0
- data/lib/decidim/api/mutations/proposals_mutation_type.rb +1 -0
- data/lib/decidim/api/mutations/unvote_proposal_type.rb +26 -0
- data/lib/decidim/api/mutations/update_proposal_type.rb +53 -0
- data/lib/decidim/api/mutations/vote_proposal_type.rb +30 -0
- data/lib/decidim/api/mutations/withdraw_proposal_type.rb +31 -0
- data/lib/decidim/api/proposal_type.rb +0 -2
- data/lib/decidim/proposals/api.rb +6 -0
- data/lib/decidim/proposals/commentable_proposal.rb +0 -6
- data/lib/decidim/proposals/component.rb +16 -13
- data/lib/decidim/proposals/engine.rb +0 -14
- data/lib/decidim/proposals/import/proposal_creator.rb +8 -3
- data/lib/decidim/proposals/seeds.rb +3 -58
- data/lib/decidim/proposals/test/factories.rb +3 -63
- data/lib/decidim/proposals/version.rb +1 -1
- data/lib/decidim/proposals.rb +9 -8
- metadata +34 -78
- data/app/cells/decidim/proposals/collaborative_draft_cell.rb +0 -49
- data/app/cells/decidim/proposals/collaborative_draft_l_cell.rb +0 -16
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal/show.erb +0 -5
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +0 -28
- data/app/cells/decidim/proposals/collaborative_draft_metadata_cell.rb +0 -30
- data/app/cells/decidim/proposals/collaborative_drafts/reported_content/show.erb +0 -3
- data/app/cells/decidim/proposals/collaborative_drafts/reported_content_cell.rb +0 -15
- data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +0 -78
- data/app/cells/decidim/proposals/proposal_link_to_collaborative_draft_cell.rb +0 -28
- data/app/cells/decidim/proposals/proposal_votes_count/show.erb +0 -12
- data/app/cells/decidim/proposals/proposal_votes_count_cell.rb +0 -81
- data/app/commands/decidim/proposals/accept_access_to_collaborative_draft.rb +0 -70
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +0 -85
- data/app/commands/decidim/proposals/publish_collaborative_draft.rb +0 -92
- data/app/commands/decidim/proposals/reject_access_to_collaborative_draft.rb +0 -62
- data/app/commands/decidim/proposals/request_access_to_collaborative_draft.rb +0 -49
- data/app/commands/decidim/proposals/update_collaborative_draft.rb +0 -70
- data/app/commands/decidim/proposals/withdraw_collaborative_draft.rb +0 -65
- data/app/controllers/decidim/proposals/collaborative_draft_collaborator_requests_controller.rb +0 -59
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +0 -162
- data/app/events/decidim/proposals/collaborative_draft_access_accepted_event.rb +0 -8
- data/app/events/decidim/proposals/collaborative_draft_access_rejected_event.rb +0 -8
- data/app/events/decidim/proposals/collaborative_draft_access_request_event.rb +0 -27
- data/app/events/decidim/proposals/collaborative_draft_access_requested_event.rb +0 -8
- data/app/events/decidim/proposals/collaborative_draft_access_requester_accepted_event.rb +0 -8
- data/app/events/decidim/proposals/collaborative_draft_access_requester_rejected_event.rb +0 -8
- data/app/events/decidim/proposals/collaborative_draft_withdrawn_event.rb +0 -33
- data/app/forms/decidim/proposals/accept_access_to_collaborative_draft_form.rb +0 -10
- data/app/forms/decidim/proposals/access_to_collaborative_draft_form.rb +0 -33
- data/app/forms/decidim/proposals/collaborative_draft_form.rb +0 -8
- data/app/forms/decidim/proposals/reject_access_to_collaborative_draft_form.rb +0 -9
- data/app/forms/decidim/proposals/request_access_to_collaborative_draft_form.rb +0 -20
- data/app/helpers/decidim/proposals/collaborative_draft_cells_helper.rb +0 -48
- data/app/helpers/decidim/proposals/collaborative_draft_helper.rb +0 -69
- data/app/models/decidim/proposals/collaborative_draft.rb +0 -79
- data/app/models/decidim/proposals/collaborative_draft_collaborator_request.rb +0 -11
- data/app/presenters/decidim/proposals/collaborative_draft_presenter.rb +0 -20
- data/app/services/decidim/proposals/collaborative_draft_diff_renderer.rb +0 -22
- data/app/views/decidim/proposals/collaborative_drafts/_accept_request_access_form.html.erb +0 -8
- data/app/views/decidim/proposals/collaborative_drafts/_collaborative_actions.html.erb +0 -9
- data/app/views/decidim/proposals/collaborative_drafts/_collaborative_draft_aside.html.erb +0 -38
- data/app/views/decidim/proposals/collaborative_drafts/_collaborative_drafts.html.erb +0 -15
- data/app/views/decidim/proposals/collaborative_drafts/_collaborator_requests.html.erb +0 -16
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +0 -26
- data/app/views/decidim/proposals/collaborative_drafts/_reject_request_access_form.html.erb +0 -8
- data/app/views/decidim/proposals/collaborative_drafts/_request_access_form.html.erb +0 -7
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +0 -31
- data/app/views/decidim/proposals/collaborative_drafts/index.html.erb +0 -35
- data/app/views/decidim/proposals/collaborative_drafts/index.js.erb +0 -5
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +0 -30
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +0 -74
- data/lib/decidim/proposals/commentable_collaborative_draft.rb +0 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e42a3076ac40dede627a7f03d7aaad459a2b0caf0164c2df9fdcac1aa50101b8
|
|
4
|
+
data.tar.gz: b3648c993a746a2e530fd2ee2bf766392a45a16ebdd56b5f336ffe4fed1116aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8651a09e209979a5eaca293fb56dc5c33eba17bf38393edb10deeddccf82b58fec4ad43eb2c0bf3f466dd7010f24a42c043751044673590140a0b5fe22055b69
|
|
7
|
+
data.tar.gz: cd789df1ac62a3b52d3278e3a55e0cca8bf8375351cf5f6ac5a897f6f0e2582c29780754b738849e8eeb16e37303831762a2678817d251205fe6d5696a72286c
|
data/README.md
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# decidim-proposals
|
|
2
2
|
|
|
3
|
-
The Proposals module adds one of the main components of Decidim: allows users to contribute to a participatory
|
|
3
|
+
The Proposals module adds one of the main components of Decidim: allows users to contribute to a participatory space by creating proposals.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
Proposals will be available as a Component for a Participatory
|
|
7
|
+
Proposals will be available as a Component for a Participatory Space.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```ruby
|
|
14
|
-
gem 'decidim-proposals'
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
And then execute:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
bundle
|
|
21
|
-
```
|
|
11
|
+
This is on the default Decidim installation so you should not change anything to use this component.
|
|
22
12
|
|
|
23
13
|
## Global Search
|
|
24
14
|
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
<% if !current_settings.votes_hidden? && (current_component.participatory_space.can_participate?(current_user) || current_user&.admin?) %>
|
|
2
|
+
<% if component_settings.participatory_texts_enabled? && from_proposals_list %>
|
|
3
|
+
<%= render partial: "decidim/proposals/proposals/participatory_texts/proposal_votes_count", locals: { proposal: resource, from_proposals_list: true } %>
|
|
4
|
+
<% else %>
|
|
5
|
+
<% progress ||= resource.proposal_votes_count || 0 %>
|
|
6
|
+
<% total ||= resource.maximum_votes || 0 %>
|
|
7
|
+
<%= cell(
|
|
8
|
+
"decidim/progress_bar",
|
|
9
|
+
progress,
|
|
10
|
+
total:,
|
|
11
|
+
units_name: "decidim.proposals.proposals.votes_count.count",
|
|
12
|
+
element_id: "proposal-#{resource.id}-votes-count",
|
|
13
|
+
class: total.positive? ? "card__proposals-votes-limited" : "card__proposals-votes-unlimited"
|
|
14
|
+
) %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
2
17
|
|
|
3
18
|
<% button_classes = "button button__sm button__secondary w-full" %>
|
|
4
19
|
|
|
@@ -27,6 +27,7 @@ module Decidim
|
|
|
27
27
|
transaction do
|
|
28
28
|
increment_score
|
|
29
29
|
notify_followers
|
|
30
|
+
notify_authors
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
|
|
@@ -48,11 +49,22 @@ module Decidim
|
|
|
48
49
|
event: "decidim.events.proposals.proposal_state_changed",
|
|
49
50
|
event_class: Decidim::Proposals::ProposalStateChangedEvent,
|
|
50
51
|
resource: proposal,
|
|
51
|
-
affected_users: proposal.notifiable_identities,
|
|
52
52
|
followers: proposal.followers - proposal.notifiable_identities
|
|
53
53
|
)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
def notify_authors
|
|
57
|
+
return if proposal.state == "not_answered"
|
|
58
|
+
|
|
59
|
+
Decidim::EventsManager.publish(
|
|
60
|
+
event: "decidim.events.proposals.proposal_state_changed_for_authors",
|
|
61
|
+
event_class: Decidim::Proposals::ProposalStateChangedEvent,
|
|
62
|
+
resource: proposal,
|
|
63
|
+
affected_users: proposal.authors,
|
|
64
|
+
extra: { force_email: true }
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
56
68
|
def increment_score
|
|
57
69
|
if proposal.accepted?
|
|
58
70
|
proposal.coauthorships.find_each do |coauthorship|
|
|
@@ -36,7 +36,7 @@ module Decidim
|
|
|
36
36
|
transaction do
|
|
37
37
|
update_proposal
|
|
38
38
|
update_proposal_author
|
|
39
|
-
|
|
39
|
+
document_cleanup!(include_all_attachments: true)
|
|
40
40
|
create_attachments(first_weight: first_attachment_weight) if process_attachments?
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -6,6 +6,7 @@ module Decidim
|
|
|
6
6
|
# A command with all the business logic when an admin batch updates proposals taxonomies.
|
|
7
7
|
class UpdateProposalTaxonomies < UpdateResourcesTaxonomies
|
|
8
8
|
include TranslatableAttributes
|
|
9
|
+
|
|
9
10
|
# Public: Initializes the command.
|
|
10
11
|
#
|
|
11
12
|
# taxonomy_ids - the taxonomy ids to update
|
|
@@ -82,7 +82,7 @@ module Decidim
|
|
|
82
82
|
)
|
|
83
83
|
|
|
84
84
|
proposal.taxonomizations = form.taxonomizations if form.taxonomizations.present?
|
|
85
|
-
proposal.
|
|
85
|
+
proposal.documents = form.documents if form.documents.present?
|
|
86
86
|
if form.geocoded?
|
|
87
87
|
proposal.latitude = form.latitude
|
|
88
88
|
proposal.longitude = form.longitude
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Proposals
|
|
5
|
+
# A module with all the gallery common methods for proposals commands.
|
|
6
|
+
# Allows to create several image attachments at once
|
|
7
|
+
module GalleryMethods
|
|
8
|
+
include ::Decidim::GalleryMethods
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def gallery_allowed?
|
|
13
|
+
@form.current_component.settings.attachments_allowed?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -27,18 +27,11 @@ module Decidim
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def accessible_proposals_collection
|
|
30
|
-
# Administrators can manage every proposal, even when they also
|
|
31
|
-
# hold an evaluator role, matching the admin permissions.
|
|
32
|
-
return collection if current_user.admin?
|
|
33
30
|
return collection if current_participatory_space.user_roles(:evaluator).where(user: current_user).empty?
|
|
34
31
|
|
|
35
32
|
collection.with_evaluation_assigned_to(current_user, current_participatory_space)
|
|
36
33
|
end
|
|
37
34
|
|
|
38
|
-
def search_field_predicate
|
|
39
|
-
:id_string_or_title_cont
|
|
40
|
-
end
|
|
41
|
-
|
|
42
35
|
def filter_config
|
|
43
36
|
@filter_config ||= Decidim::AdminFilter.new(:proposals).build_for(self)
|
|
44
37
|
end
|
|
@@ -22,9 +22,10 @@ module Decidim
|
|
|
22
22
|
@possible_orders ||= begin
|
|
23
23
|
possible_orders = %w(random recent)
|
|
24
24
|
possible_orders << "most_voted" if most_voted_order_available?
|
|
25
|
-
possible_orders << "most_liked" if
|
|
26
|
-
possible_orders << "most_commented" if
|
|
27
|
-
possible_orders << "most_followed"
|
|
25
|
+
possible_orders << "most_liked" if most_liked_order_available?
|
|
26
|
+
possible_orders << "most_commented" if most_commented_order_available?
|
|
27
|
+
possible_orders << "most_followed" # always shown, as the author automatically follows their proposals
|
|
28
|
+
possible_orders << "with_more_authors" if with_more_authors_order_available?
|
|
28
29
|
possible_orders
|
|
29
30
|
end
|
|
30
31
|
end
|
|
@@ -52,6 +53,24 @@ module Decidim
|
|
|
52
53
|
current_settings.votes_enabled? && !current_settings.votes_hidden?
|
|
53
54
|
end
|
|
54
55
|
|
|
56
|
+
def with_more_authors_order_available?
|
|
57
|
+
return @with_more_authors_order_available if defined?(@with_more_authors_order_available)
|
|
58
|
+
|
|
59
|
+
@with_more_authors_order_available = Decidim::Proposals::Proposal.with_more_authors_available?(current_component)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def most_commented_order_available?
|
|
63
|
+
return @most_commented_order_available if defined?(@most_commented_order_available)
|
|
64
|
+
|
|
65
|
+
@most_commented_order_available = Decidim::Proposals::Proposal.most_commented_available?(current_component)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def most_liked_order_available?
|
|
69
|
+
return @most_liked_order_available if defined?(@most_liked_order_available)
|
|
70
|
+
|
|
71
|
+
@most_liked_order_available = Decidim::Proposals::Proposal.most_liked_available?(current_component)
|
|
72
|
+
end
|
|
73
|
+
|
|
55
74
|
def order_by_votes?
|
|
56
75
|
most_voted_order_available? && current_settings.votes_blocked?
|
|
57
76
|
end
|
|
@@ -34,12 +34,12 @@ module Decidim
|
|
|
34
34
|
Admin::UnassignProposalsFromEvaluator.call(@form) do
|
|
35
35
|
on(:ok) do |_proposal|
|
|
36
36
|
flash.keep[:notice] = I18n.t("evaluation_assignments.delete.success", scope: "decidim.proposals.admin")
|
|
37
|
-
|
|
37
|
+
redirect_back_or_to(EngineRouter.admin_proxy(current_component).root_path)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
on(:invalid) do
|
|
41
41
|
flash.keep[:alert] = I18n.t("evaluation_assignments.delete.invalid", scope: "decidim.proposals.admin")
|
|
42
|
-
|
|
42
|
+
redirect_back_or_to(EngineRouter.admin_proxy(current_component).root_path)
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -9,7 +9,6 @@ module Decidim
|
|
|
9
9
|
helper ParticipatoryTextsHelper
|
|
10
10
|
|
|
11
11
|
def index
|
|
12
|
-
enforce_permission_to :manage, :participatory_texts
|
|
13
12
|
@drafts = Proposal.where(component: current_component).drafts.order(:position)
|
|
14
13
|
@preview_form = form(Admin::PreviewParticipatoryTextForm).instance
|
|
15
14
|
@preview_form.from_models(@drafts)
|
|
@@ -33,12 +32,12 @@ module Decidim
|
|
|
33
32
|
|
|
34
33
|
on(:invalid) do
|
|
35
34
|
flash.now[:alert] = I18n.t("participatory_texts.import.invalid", scope: "decidim.proposals.admin")
|
|
36
|
-
render action: "new_import", status: :
|
|
35
|
+
render action: "new_import", status: :unprocessable_content
|
|
37
36
|
end
|
|
38
37
|
|
|
39
38
|
on(:invalid_file) do
|
|
40
39
|
flash.now[:alert] = I18n.t("participatory_texts.import.invalid_file", scope: "decidim.proposals.admin")
|
|
41
|
-
render action: "new_import", status: :
|
|
40
|
+
render action: "new_import", status: :unprocessable_content
|
|
42
41
|
end
|
|
43
42
|
end
|
|
44
43
|
end
|
|
@@ -63,7 +62,7 @@ module Decidim
|
|
|
63
62
|
failures.each_pair { |id, msg| alert_msg << "ID:[#{id}] #{msg}" }
|
|
64
63
|
flash.now[:alert] = alert_msg.join("<br/>").html_safe
|
|
65
64
|
index
|
|
66
|
-
render action: "index", status: :
|
|
65
|
+
render action: "index", status: :unprocessable_content
|
|
67
66
|
end
|
|
68
67
|
end
|
|
69
68
|
else
|
|
@@ -78,7 +77,7 @@ module Decidim
|
|
|
78
77
|
failures.each_pair { |id, msg| alert_msg << "ID:[#{id}] #{msg}" }
|
|
79
78
|
flash.now[:alert] = alert_msg.join("<br/>").html_safe
|
|
80
79
|
index
|
|
81
|
-
render action: "index", status: :
|
|
80
|
+
render action: "index", status: :unprocessable_content
|
|
82
81
|
end
|
|
83
82
|
end
|
|
84
83
|
end
|
|
@@ -34,13 +34,12 @@ module Decidim
|
|
|
34
34
|
|
|
35
35
|
on(:invalid) do
|
|
36
36
|
flash.keep[:alert] = I18n.t("proposals.answer.invalid", scope: "decidim.proposals.admin")
|
|
37
|
-
render template: "decidim/proposals/admin/proposals/show", status: :
|
|
37
|
+
render template: "decidim/proposals/admin/proposals/show", status: :unprocessable_content
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def update_multiple_answers
|
|
43
|
-
enforce_permission_to(:read, :component, component: current_component)
|
|
44
43
|
valid_proposals = []
|
|
45
44
|
failed_proposals = []
|
|
46
45
|
proposals.each do |proposal|
|
|
@@ -88,7 +87,7 @@ module Decidim
|
|
|
88
87
|
def template
|
|
89
88
|
return unless Decidim.module_installed?(:templates)
|
|
90
89
|
|
|
91
|
-
@template ||= Decidim::Templates::Template.
|
|
90
|
+
@template ||= Decidim::Templates::Template.find_by(id: params[:template][:template_id])
|
|
92
91
|
end
|
|
93
92
|
|
|
94
93
|
def answer_form(proposal)
|
|
@@ -96,7 +95,7 @@ module Decidim
|
|
|
96
95
|
end
|
|
97
96
|
|
|
98
97
|
def proposal_state
|
|
99
|
-
@proposal_state ||= Decidim::Proposals::ProposalState.
|
|
98
|
+
@proposal_state ||= Decidim::Proposals::ProposalState.find_by(id: template&.field_values&.dig("proposal_state_id"))
|
|
100
99
|
end
|
|
101
100
|
end
|
|
102
101
|
end
|
|
@@ -30,7 +30,7 @@ module Decidim
|
|
|
30
30
|
on(:invalid) do
|
|
31
31
|
flash.keep[:alert] = I18n.t("proposal_states.create.error", scope: "decidim.proposals.admin")
|
|
32
32
|
|
|
33
|
-
render action: :new, status: :
|
|
33
|
+
render action: :new, status: :unprocessable_content
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -54,7 +54,7 @@ module Decidim
|
|
|
54
54
|
on(:invalid) do
|
|
55
55
|
flash.now[:alert] = I18n.t("proposal_states.update.error", scope: "decidim.proposals.admin")
|
|
56
56
|
|
|
57
|
-
render action: :edit, status: :
|
|
57
|
+
render action: :edit, status: :unprocessable_content
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
end
|
|
@@ -18,12 +18,9 @@ module Decidim
|
|
|
18
18
|
|
|
19
19
|
before_action :check_admin_session_filters, only: [:index]
|
|
20
20
|
|
|
21
|
-
def index
|
|
22
|
-
enforce_permission_to :read, :proposal
|
|
23
|
-
end
|
|
21
|
+
def index; end
|
|
24
22
|
|
|
25
23
|
def show
|
|
26
|
-
enforce_permission_to(:read, :proposal, proposal:)
|
|
27
24
|
@notes_form = form(ProposalNoteForm).instance
|
|
28
25
|
@answer_form = form(Admin::ProposalAnswerForm).from_model(proposal)
|
|
29
26
|
end
|
|
@@ -47,7 +44,7 @@ module Decidim
|
|
|
47
44
|
|
|
48
45
|
on(:invalid) do
|
|
49
46
|
flash.now[:alert] = I18n.t("proposals.create.invalid", scope: "decidim.proposals.admin")
|
|
50
|
-
render action: "new", status: :
|
|
47
|
+
render action: "new", status: :unprocessable_content
|
|
51
48
|
end
|
|
52
49
|
end
|
|
53
50
|
end
|
|
@@ -132,7 +129,7 @@ module Decidim
|
|
|
132
129
|
|
|
133
130
|
on(:invalid) do
|
|
134
131
|
flash.now[:alert] = t("proposals.update.error", scope: "decidim")
|
|
135
|
-
render :edit, status: :
|
|
132
|
+
render :edit, status: :unprocessable_content
|
|
136
133
|
end
|
|
137
134
|
end
|
|
138
135
|
end
|
|
@@ -160,7 +157,7 @@ module Decidim
|
|
|
160
157
|
end
|
|
161
158
|
|
|
162
159
|
def proposal
|
|
163
|
-
@proposal ||=
|
|
160
|
+
@proposal ||= collection.find(params[:id])
|
|
164
161
|
end
|
|
165
162
|
|
|
166
163
|
def proposal_ids
|
|
@@ -23,7 +23,7 @@ module Decidim
|
|
|
23
23
|
|
|
24
24
|
on(:invalid) do
|
|
25
25
|
flash.now[:alert] = I18n.t("proposals_imports.create.invalid", scope: "decidim.proposals.admin")
|
|
26
|
-
render action: "new", status: :
|
|
26
|
+
render action: "new", status: :unprocessable_content
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -33,7 +33,7 @@ module Decidim
|
|
|
33
33
|
component = current_participatory_space.components.find_by(id: params[:origin_id])
|
|
34
34
|
|
|
35
35
|
if component
|
|
36
|
-
states = Decidim::Proposals::ProposalState
|
|
36
|
+
states = Decidim::Proposals::ProposalState
|
|
37
37
|
.where(component:)
|
|
38
38
|
.map { |s| { token: s.token, title: translated_attribute(s.title) } }
|
|
39
39
|
states << { token: "not_answered", title: I18n.t("decidim.proposals.answers.not_answered") }
|
|
@@ -8,7 +8,6 @@ module Decidim
|
|
|
8
8
|
helper Decidim::Proposals::Admin::ProposalsHelper
|
|
9
9
|
|
|
10
10
|
def new
|
|
11
|
-
enforce_permission_to :merge, :proposals
|
|
12
11
|
@form = form(Admin::ProposalsMergeForm).from_params(
|
|
13
12
|
params.merge(attachment: form(AttachmentForm).from_params({}))
|
|
14
13
|
)
|
|
@@ -30,7 +29,7 @@ module Decidim
|
|
|
30
29
|
I18n.t("proposals_merges.create.invalid", scope: "decidim.proposals.admin"),
|
|
31
30
|
@form
|
|
32
31
|
).message
|
|
33
|
-
render :new, status: :
|
|
32
|
+
render :new, status: :unprocessable_content
|
|
34
33
|
end
|
|
35
34
|
end
|
|
36
35
|
end
|
|
@@ -53,7 +53,7 @@ module Decidim
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
on(:invalid) do
|
|
56
|
-
render json: { message: I18n.t("update.error", scope: "decidim.proposals.invite_coauthors") }, status: :
|
|
56
|
+
render json: { message: I18n.t("update.error", scope: "decidim.proposals.invite_coauthors") }, status: :unprocessable_content
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -68,7 +68,7 @@ module Decidim
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
on(:invalid) do
|
|
71
|
-
render json: { message: I18n.t("destroy.error", scope: "decidim.proposals.invite_coauthors") }, status: :
|
|
71
|
+
render json: { message: I18n.t("destroy.error", scope: "decidim.proposals.invite_coauthors") }, status: :unprocessable_content
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|
|
@@ -29,7 +29,7 @@ module Decidim
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
on(:invalid) do
|
|
32
|
-
render json: { error: I18n.t("proposal_votes.create.error", scope: "decidim.proposals") }, status: :
|
|
32
|
+
render json: { error: I18n.t("proposal_votes.create.error", scope: "decidim.proposals") }, status: :unprocessable_content
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -20,7 +20,7 @@ module Decidim
|
|
|
20
20
|
|
|
21
21
|
before_action :authenticate_user!, only: [:new, :create]
|
|
22
22
|
before_action :ensure_is_draft, only: [:preview, :publish, :edit_draft, :update_draft, :destroy_draft]
|
|
23
|
-
before_action :
|
|
23
|
+
before_action :proposal, only: [:show, :edit, :update, :withdraw]
|
|
24
24
|
before_action :edit_form, only: [:edit_draft, :edit]
|
|
25
25
|
before_action :set_view_mode, only: [:index]
|
|
26
26
|
|
|
@@ -32,8 +32,6 @@ module Decidim
|
|
|
32
32
|
# rubocop:enable Naming/VariableNumber
|
|
33
33
|
|
|
34
34
|
def index
|
|
35
|
-
enforce_permission_to :read, :proposal
|
|
36
|
-
|
|
37
35
|
if component_settings.participatory_texts_enabled?
|
|
38
36
|
@proposals = Decidim::Proposals::Proposal
|
|
39
37
|
.where(component: current_component)
|
|
@@ -54,8 +52,6 @@ module Decidim
|
|
|
54
52
|
|
|
55
53
|
def show
|
|
56
54
|
raise ActionController::RoutingError, "Not Found" if @proposal.blank? || !can_show_proposal?
|
|
57
|
-
|
|
58
|
-
enforce_permission_to :read, :proposal, proposal: @proposal
|
|
59
55
|
end
|
|
60
56
|
|
|
61
57
|
def new
|
|
@@ -83,7 +79,7 @@ module Decidim
|
|
|
83
79
|
|
|
84
80
|
on(:invalid) do
|
|
85
81
|
flash.now[:alert] = I18n.t("proposals.create.error", scope: "decidim")
|
|
86
|
-
render :new, status: :
|
|
82
|
+
render :new, status: :unprocessable_content
|
|
87
83
|
end
|
|
88
84
|
end
|
|
89
85
|
end
|
|
@@ -105,7 +101,7 @@ module Decidim
|
|
|
105
101
|
|
|
106
102
|
on(:invalid) do
|
|
107
103
|
flash.now[:alert] = I18n.t("proposals.publish.error", scope: "decidim")
|
|
108
|
-
render :edit_draft, status: :
|
|
104
|
+
render :edit_draft, status: :unprocessable_content
|
|
109
105
|
end
|
|
110
106
|
end
|
|
111
107
|
end
|
|
@@ -128,7 +124,7 @@ module Decidim
|
|
|
128
124
|
|
|
129
125
|
on(:invalid) do
|
|
130
126
|
flash.now[:alert] = I18n.t("proposals.update_draft.error", scope: "decidim")
|
|
131
|
-
render :edit_draft, status: :
|
|
127
|
+
render :edit_draft, status: :unprocessable_content
|
|
132
128
|
end
|
|
133
129
|
end
|
|
134
130
|
end
|
|
@@ -144,7 +140,7 @@ module Decidim
|
|
|
144
140
|
|
|
145
141
|
on(:invalid) do
|
|
146
142
|
flash.now[:alert] = I18n.t("proposals.destroy_draft.error", scope: "decidim")
|
|
147
|
-
render :edit_draft, status: :
|
|
143
|
+
render :edit_draft, status: :unprocessable_content
|
|
148
144
|
end
|
|
149
145
|
end
|
|
150
146
|
end
|
|
@@ -165,7 +161,7 @@ module Decidim
|
|
|
165
161
|
|
|
166
162
|
on(:invalid) do
|
|
167
163
|
flash.now[:alert] = I18n.t("proposals.update.error", scope: "decidim")
|
|
168
|
-
render :edit, status: :
|
|
164
|
+
render :edit, status: :unprocessable_content
|
|
169
165
|
end
|
|
170
166
|
end
|
|
171
167
|
end
|
|
@@ -220,8 +216,8 @@ module Decidim
|
|
|
220
216
|
redirect_to Decidim::ResourceLocatorPresenter.new(@proposal).path unless @proposal.draft?
|
|
221
217
|
end
|
|
222
218
|
|
|
223
|
-
def
|
|
224
|
-
@proposal
|
|
219
|
+
def proposal
|
|
220
|
+
@proposal ||= Proposal.published.not_hidden.where(component: current_component).find_by(id: params[:id])
|
|
225
221
|
end
|
|
226
222
|
|
|
227
223
|
# Returns true if the proposal is NOT an emendation or the user IS an admin.
|
|
@@ -299,6 +295,28 @@ module Decidim
|
|
|
299
295
|
def default_view_mode
|
|
300
296
|
@default_view_mode ||= current_component.settings.attachments_allowed? ? "grid" : "list"
|
|
301
297
|
end
|
|
298
|
+
|
|
299
|
+
def add_parent_breadcrumb_item
|
|
300
|
+
return {} if proposal.blank?
|
|
301
|
+
|
|
302
|
+
object = proposal.emendation? ? proposal.amendable : proposal
|
|
303
|
+
{
|
|
304
|
+
label: translated_attribute(object.title),
|
|
305
|
+
url: Decidim::EngineRouter.main_proxy(current_component).proposal_path(object),
|
|
306
|
+
active: false
|
|
307
|
+
}
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
def add_breadcrumb_item
|
|
311
|
+
return {} if proposal.blank?
|
|
312
|
+
return {} if proposal.amendable?
|
|
313
|
+
|
|
314
|
+
{
|
|
315
|
+
label: I18n.t("decidim.amendments.name"),
|
|
316
|
+
url: Decidim::EngineRouter.main_proxy(current_component).proposal_path(proposal),
|
|
317
|
+
active: false
|
|
318
|
+
}
|
|
319
|
+
end
|
|
302
320
|
end
|
|
303
321
|
end
|
|
304
322
|
end
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module Proposals
|
|
5
|
-
# Exposes Proposals versions so users can see how a Proposal
|
|
6
|
-
# has been updated through time.
|
|
5
|
+
# Exposes Proposals versions so users can see how a Proposal has been updated through time.
|
|
7
6
|
class VersionsController < Decidim::Proposals::ApplicationController
|
|
8
7
|
include Decidim::ApplicationHelper
|
|
9
8
|
include Decidim::ResourceVersionsConcern
|
|
10
9
|
|
|
11
|
-
private
|
|
12
|
-
|
|
13
10
|
def versioned_resource
|
|
14
|
-
@versioned_resource ||=
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
@versioned_resource ||= Proposal.not_hidden.published.where(component: current_component).find(params[:proposal_id])
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def add_breadcrumb_item
|
|
15
|
+
return {} if versioned_resource.blank?
|
|
16
|
+
|
|
17
|
+
{
|
|
18
|
+
label: translated_attribute(versioned_resource.title),
|
|
19
|
+
url: Decidim::EngineRouter.main_proxy(current_component).proposal_path(versioned_resource),
|
|
20
|
+
active: false
|
|
21
|
+
}
|
|
20
22
|
end
|
|
21
23
|
end
|
|
22
24
|
end
|