decidim-proposals 0.27.10 → 0.28.0.rc4
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/app/cells/decidim/proposals/collaborative_draft_cell.rb +1 -1
- data/app/cells/decidim/proposals/collaborative_draft_l_cell.rb +16 -0
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal/show.erb +4 -12
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +0 -29
- data/app/cells/decidim/proposals/collaborative_draft_metadata_cell.rb +30 -0
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals_cell.rb +2 -8
- data/app/cells/decidim/proposals/cost_report/show.erb +5 -34
- data/app/cells/decidim/proposals/cost_report_cell.rb +0 -13
- data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +29 -17
- data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +34 -8
- data/app/cells/decidim/proposals/irreversible_action_modal/show.erb +9 -17
- data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +7 -9
- data/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb +21 -31
- data/app/cells/decidim/proposals/participatory_text_proposal/show.erb +5 -9
- data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +0 -9
- data/app/cells/decidim/proposals/proposal_activity_cell.rb +1 -12
- data/app/cells/decidim/proposals/proposal_cell.rb +6 -1
- data/app/cells/decidim/proposals/proposal_l_cell.rb +47 -0
- data/app/cells/decidim/proposals/proposal_link_to_collaborative_draft_cell.rb +6 -4
- data/app/cells/decidim/proposals/proposal_link_to_rejected_emendation_cell.rb +9 -7
- data/app/cells/decidim/proposals/proposal_linked_resources/show.erb +3 -8
- data/app/cells/decidim/proposals/proposal_metadata_cell.rb +61 -0
- data/app/cells/decidim/proposals/proposal_s_cell.rb +21 -0
- data/app/cells/decidim/proposals/proposals_picker/show.erb +13 -13
- data/app/cells/decidim/proposals/proposals_picker_cell.rb +15 -38
- data/app/commands/decidim/proposals/accept_access_to_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/admin/answer_proposal.rb +1 -1
- data/app/commands/decidim/proposals/admin/assign_proposals_to_valuator.rb +3 -3
- data/app/commands/decidim/proposals/admin/create_proposal.rb +2 -2
- data/app/commands/decidim/proposals/admin/create_proposal_note.rb +4 -4
- data/app/commands/decidim/proposals/admin/discard_participatory_text.rb +1 -1
- data/app/commands/decidim/proposals/admin/import_participatory_text.rb +1 -1
- data/app/commands/decidim/proposals/admin/import_proposals.rb +2 -13
- data/app/commands/decidim/proposals/admin/merge_proposals.rb +1 -1
- data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +3 -3
- data/app/commands/decidim/proposals/admin/publish_answers.rb +1 -1
- data/app/commands/decidim/proposals/admin/publish_participatory_text.rb +2 -2
- data/app/commands/decidim/proposals/admin/split_proposals.rb +1 -1
- data/app/commands/decidim/proposals/admin/unassign_proposals_from_valuator.rb +2 -2
- data/app/commands/decidim/proposals/admin/update_participatory_text.rb +1 -1
- data/app/commands/decidim/proposals/admin/update_proposal.rb +5 -1
- data/app/commands/decidim/proposals/admin/update_proposal_scope.rb +1 -1
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +13 -3
- data/app/commands/decidim/proposals/create_proposal.rb +14 -5
- data/app/commands/decidim/proposals/hashtags_methods.rb +1 -1
- data/app/commands/decidim/proposals/publish_proposal.rb +1 -1
- data/app/commands/decidim/proposals/reject_access_to_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/request_access_to_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/unvote_proposal.rb +2 -2
- data/app/commands/decidim/proposals/update_collaborative_draft.rb +12 -2
- data/app/commands/decidim/proposals/update_proposal.rb +16 -14
- data/app/commands/decidim/proposals/vote_proposal.rb +2 -2
- data/app/controllers/concerns/decidim/proposals/admin/filterable.rb +4 -13
- data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +2 -2
- data/app/controllers/decidim/proposals/admin/proposal_notes_controller.rb +1 -1
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -2
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +3 -9
- data/app/controllers/decidim/proposals/proposal_votes_controller.rb +3 -3
- data/app/controllers/decidim/proposals/proposals_controller.rb +42 -12
- data/app/events/decidim/proposals/accepted_proposal_event.rb +1 -1
- data/app/events/decidim/proposals/admin/proposal_note_created_event.rb +1 -1
- data/app/events/decidim/proposals/admin/update_proposal_category_event.rb +1 -1
- data/app/events/decidim/proposals/admin/update_proposal_scope_event.rb +1 -1
- data/app/events/decidim/proposals/collaborative_draft_access_accepted_event.rb +1 -1
- data/app/events/decidim/proposals/collaborative_draft_access_rejected_event.rb +1 -1
- data/app/events/decidim/proposals/collaborative_draft_access_request_event.rb +1 -1
- data/app/events/decidim/proposals/collaborative_draft_access_requested_event.rb +1 -1
- data/app/events/decidim/proposals/collaborative_draft_access_requester_accepted_event.rb +1 -1
- data/app/events/decidim/proposals/collaborative_draft_access_requester_rejected_event.rb +1 -1
- data/app/events/decidim/proposals/collaborative_draft_withdrawn_event.rb +1 -1
- data/app/events/decidim/proposals/evaluating_proposal_event.rb +1 -1
- data/app/events/decidim/proposals/proposal_endorsed_event.rb +1 -1
- data/app/events/decidim/proposals/proposal_mentioned_event.rb +1 -1
- data/app/events/decidim/proposals/publish_proposal_event.rb +1 -1
- data/app/events/decidim/proposals/rejected_proposal_event.rb +1 -1
- data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +1 -1
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +2 -2
- data/app/forms/decidim/proposals/admin/proposal_form.rb +1 -1
- data/app/forms/decidim/proposals/admin/proposals_fork_form.rb +1 -1
- data/app/forms/decidim/proposals/admin/valuation_assignment_form.rb +1 -1
- data/app/forms/decidim/proposals/proposal_form.rb +9 -27
- data/app/helpers/decidim/proposals/admin/proposal_bulk_actions_helper.rb +1 -1
- data/app/helpers/decidim/proposals/admin/proposals_helper.rb +13 -13
- data/app/helpers/decidim/proposals/application_helper.rb +80 -28
- data/app/helpers/decidim/proposals/collaborative_draft_helper.rb +44 -4
- data/app/helpers/decidim/proposals/map_helper.rb +3 -4
- data/app/helpers/decidim/proposals/participatory_texts_helper.rb +1 -9
- data/app/helpers/decidim/proposals/proposal_cells_helper.rb +1 -1
- data/app/helpers/decidim/proposals/proposal_votes_helper.rb +2 -24
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +14 -81
- data/app/helpers/decidim/proposals/proposals_helper.rb +0 -12
- data/app/jobs/decidim/proposals/hide_all_created_by_author_job.rb +20 -0
- data/app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb +1 -1
- data/app/jobs/decidim/proposals/settings_change_job.rb +2 -2
- data/app/models/decidim/proposals/collaborative_draft.rb +4 -16
- data/app/models/decidim/proposals/proposal.rb +33 -16
- data/app/models/decidim/proposals/proposal_vote.rb +3 -3
- data/app/models/decidim/proposals/valuation_assignment.rb +1 -2
- data/app/packs/documents/decidim/proposals/participatory_texts/participatory_text.md +9 -4
- data/app/packs/entrypoints/decidim_proposals.js +4 -0
- data/app/packs/entrypoints/decidim_proposals_admin.js +0 -1
- data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_accepted_proposals.svg +68 -1
- data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_proposal_votes.svg +34 -1
- data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_proposals.svg +64 -1
- data/app/packs/src/decidim/proposals/add_proposal.js +25 -39
- data/app/packs/src/decidim/proposals/admin/proposals.js +0 -7
- data/app/packs/src/decidim/proposals/choose_proposals.js +20 -0
- data/app/packs/stylesheets/decidim/proposals/proposals.scss +97 -0
- data/app/permissions/decidim/proposals/admin/permissions.rb +3 -3
- data/app/permissions/decidim/proposals/permissions.rb +1 -10
- data/app/presenters/decidim/proposals/admin_log/proposal_note_presenter.rb +2 -2
- data/app/presenters/decidim/proposals/admin_log/proposal_presenter.rb +7 -3
- data/app/presenters/decidim/proposals/admin_log/valuation_assignment_presenter.rb +2 -2
- data/app/presenters/decidim/proposals/admin_log/value_types/proposal_title_body_presenter.rb +3 -1
- data/app/presenters/decidim/proposals/log/resource_presenter.rb +22 -0
- data/app/presenters/decidim/proposals/log/valuation_assignment_presenter.rb +1 -1
- data/app/presenters/decidim/proposals/proposal_presenter.rb +6 -2
- data/app/services/decidim/proposals/diff_renderer.rb +3 -3
- data/app/services/decidim/proposals/proposal_builder.rb +6 -6
- data/app/views/decidim/proposals/admin/participatory_texts/_article-preview.html.erb +2 -4
- data/app/views/decidim/proposals/admin/participatory_texts/_bulk-actions.html.erb +2 -2
- data/app/views/decidim/proposals/admin/participatory_texts/index.html.erb +58 -46
- data/app/views/decidim/proposals/admin/participatory_texts/new_import.html.erb +31 -33
- data/app/views/decidim/proposals/admin/proposal_answers/_form.html.erb +17 -11
- data/app/views/decidim/proposals/admin/proposal_notes/_form.html.erb +5 -6
- data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +28 -36
- data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +27 -30
- data/app/views/decidim/proposals/admin/proposals/_documents.html.erb +13 -0
- data/app/views/decidim/proposals/admin/proposals/_endorsers.html.erb +25 -0
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +70 -90
- data/app/views/decidim/proposals/admin/proposals/_meetings.html.erb +13 -0
- data/app/views/decidim/proposals/admin/proposals/_photos.html.erb +13 -0
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +31 -25
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_assign_to_valuator.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_dropdown.html.erb +3 -2
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_merge.html.erb +4 -4
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_publish_answers.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_recategorize.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_scope-change.html.erb +4 -8
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_split.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_unassign_from_valuator.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals/edit.html.erb +17 -7
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +50 -63
- data/app/views/decidim/proposals/admin/proposals/new.html.erb +16 -6
- data/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb +2 -2
- data/app/views/decidim/proposals/admin/proposals/show.html.erb +204 -162
- data/app/views/decidim/proposals/admin/proposals/update_attribute.js.erb +5 -6
- data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +48 -34
- data/app/views/decidim/proposals/collaborative_drafts/_accept_request_access_form.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_actions.html.erb +7 -0
- data/app/views/decidim/proposals/collaborative_drafts/_collaborative_draft_aside.html.erb +53 -0
- data/app/views/decidim/proposals/collaborative_drafts/_collaborative_drafts.html.erb +12 -13
- data/app/views/decidim/proposals/collaborative_drafts/_collaborator_requests.html.erb +8 -12
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +26 -54
- data/app/views/decidim/proposals/collaborative_drafts/_reject_request_access_form.html.erb +1 -3
- data/app/views/decidim/proposals/collaborative_drafts/_request_access_form.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +23 -25
- data/app/views/decidim/proposals/collaborative_drafts/index.html.erb +30 -22
- data/app/views/decidim/proposals/collaborative_drafts/index.js.erb +0 -5
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +22 -18
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +39 -109
- data/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +2 -2
- data/app/views/decidim/proposals/proposals/_actions.html.erb +13 -0
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +31 -70
- data/app/views/decidim/proposals/proposals/_linked_proposals.html.erb +3 -35
- data/app/views/decidim/proposals/proposals/_proposal_aside.html.erb +40 -0
- data/app/views/decidim/proposals/proposals/_proposals.html.erb +18 -39
- data/app/views/decidim/proposals/proposals/_proposals_picker.html.erb +5 -0
- data/app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb +3 -3
- data/app/views/decidim/proposals/proposals/_vote_button.html.erb +16 -17
- data/app/views/decidim/proposals/proposals/_votes_count.html.erb +3 -6
- data/app/views/decidim/proposals/proposals/_voting_rules.html.erb +28 -41
- data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +19 -25
- data/app/views/decidim/proposals/proposals/compare.html.erb +17 -16
- data/app/views/decidim/proposals/proposals/complete.html.erb +26 -21
- data/app/views/decidim/proposals/proposals/edit.html.erb +32 -27
- data/app/views/decidim/proposals/proposals/edit_draft.html.erb +21 -19
- data/app/views/decidim/proposals/proposals/index.html.erb +56 -47
- data/app/views/decidim/proposals/proposals/index.js.erb +0 -5
- data/app/views/decidim/proposals/proposals/new.html.erb +30 -35
- data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +5 -5
- data/app/views/decidim/proposals/proposals/participatory_texts/_view_index.html.erb +15 -8
- data/app/views/decidim/proposals/proposals/participatory_texts/participatory_text.html.erb +32 -15
- data/app/views/decidim/proposals/proposals/preview.html.erb +37 -34
- data/app/views/decidim/proposals/proposals/show.html.erb +90 -108
- data/app/views/decidim/proposals/versions/show.html.erb +14 -6
- data/config/assets.rb +0 -1
- data/config/brakeman.ignore +31 -56
- data/config/locales/ar.yml +23 -158
- data/config/locales/bg.yml +1 -776
- data/config/locales/ca.yml +92 -150
- data/config/locales/cs.yml +75 -135
- data/config/locales/de.yml +83 -141
- data/config/locales/el.yml +58 -121
- data/config/locales/en.yml +76 -134
- data/config/locales/es-MX.yml +77 -135
- data/config/locales/es-PY.yml +76 -134
- data/config/locales/es.yml +84 -142
- data/config/locales/eu.yml +77 -135
- data/config/locales/fi-plain.yml +68 -126
- data/config/locales/fi.yml +76 -134
- data/config/locales/fr-CA.yml +73 -132
- data/config/locales/fr.yml +77 -136
- data/config/locales/ga-IE.yml +0 -45
- data/config/locales/gl.yml +12 -131
- data/config/locales/hu.yml +45 -149
- data/config/locales/id-ID.yml +9 -114
- data/config/locales/is-IS.yml +5 -60
- data/config/locales/it.yml +14 -146
- data/config/locales/ja.yml +78 -141
- data/config/locales/lb.yml +0 -5
- data/config/locales/lt.yml +65 -126
- data/config/locales/lv.yml +13 -144
- data/config/locales/nl.yml +16 -148
- data/config/locales/no.yml +11 -134
- data/config/locales/pl.yml +16 -239
- data/config/locales/pt-BR.yml +14 -199
- data/config/locales/pt.yml +11 -142
- data/config/locales/ro-RO.yml +12 -146
- data/config/locales/ru.yml +5 -70
- data/config/locales/sk.yml +19 -145
- data/config/locales/sr-CS.yml +0 -23
- data/config/locales/sv.yml +60 -195
- data/config/locales/tr-TR.yml +16 -150
- data/config/locales/uk.yml +5 -70
- data/config/locales/zh-CN.yml +9 -135
- data/config/locales/zh-TW.yml +35 -107
- data/db/migrate/20170307085300_migrate_proposal_reports_data_to_reports.rb +1 -1
- data/db/migrate/20230427105700_change_states_on_collaborative_drafts.rb +34 -0
- data/db/migrate/20230427105700_change_states_on_proposals.rb +34 -0
- data/lib/decidim/api/proposals_type.rb +2 -2
- data/lib/decidim/proposals/component.rb +11 -289
- data/lib/decidim/proposals/doc_to_markdown.rb +0 -4
- data/lib/decidim/proposals/engine.rb +43 -7
- data/lib/decidim/proposals/import/proposal_answer_creator.rb +1 -1
- data/lib/decidim/proposals/import/proposal_creator.rb +10 -10
- data/lib/decidim/proposals/markdown_to_proposals.rb +8 -2
- data/lib/decidim/proposals/proposal_serializer.rb +4 -56
- data/lib/decidim/proposals/seeds.rb +278 -0
- data/lib/decidim/proposals/test/factories.rb +106 -85
- data/lib/decidim/proposals/valuatable.rb +1 -2
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +55 -66
- data/app/cells/decidim/proposals/collaborative_draft_m/footer.erb +0 -6
- data/app/cells/decidim/proposals/collaborative_draft_m/tags.erb +0 -1
- data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +0 -44
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals/elements.erb +0 -5
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals/heading.erb +0 -1
- data/app/cells/decidim/proposals/proposal_link_to_rejected_emendation/show.erb +0 -9
- data/app/cells/decidim/proposals/proposal_m/footer.erb +0 -26
- data/app/cells/decidim/proposals/proposal_m/tags.erb +0 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +0 -151
- data/app/cells/decidim/proposals/proposal_tags/show.erb +0 -33
- data/app/cells/decidim/proposals/proposal_tags_cell.rb +0 -35
- data/app/cells/decidim/proposals/proposals_picker/proposals.erb +0 -12
- data/app/controllers/concerns/decidim/proposals/admin/picker.rb +0 -21
- data/app/controllers/decidim/proposals/widgets_controller.rb +0 -29
- data/app/helpers/decidim/proposals/admin/filterable_helper.rb +0 -17
- data/app/helpers/decidim/proposals/admin/proposals_picker_helper.rb +0 -30
- data/app/packs/src/decidim/proposals/admin/proposals_picker.js +0 -50
- data/app/packs/stylesheets/decidim/proposals/_proposals.scss +0 -1
- data/app/packs/stylesheets/decidim/proposals/proposals/_preview.scss +0 -3
- data/app/views/decidim/proposals/collaborative_drafts/_count.html.erb +0 -1
- data/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +0 -32
- data/app/views/decidim/proposals/collaborative_drafts/_filters_small_view.html.erb +0 -18
- data/app/views/decidim/proposals/collaborative_drafts/_new_collaborative_draft_button.html.erb +0 -11
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +0 -13
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_header.html.erb +0 -14
- data/app/views/decidim/proposals/proposals/_count.html.erb +0 -1
- data/app/views/decidim/proposals/proposals/_dynamic_map_instructions.html.erb +0 -4
- data/app/views/decidim/proposals/proposals/_filters.html.erb +0 -48
- data/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +0 -18
- data/app/views/decidim/proposals/proposals/_proposal_similar.html.erb +0 -22
- data/app/views/decidim/proposals/proposals/_wizard_aside.html.erb +0 -20
- data/app/views/decidim/proposals/proposals/participatory_texts/_index.html.erb +0 -19
- data/app/views/decidim/proposals/versions/index.html.erb +0 -16
- data/config/locales/he-IL.yml +0 -1
- data/db/migrate/20240404202756_add_valuation_assignments_count_to_decidim_proposals_proposals.rb +0 -16
- data/decidim-proposals.gemspec +0 -40
- data/lib/decidim/proposals/test/capybara_proposals_picker.rb +0 -59
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
# This cell renders metadata for an instance of a Proposal
|
6
|
+
class ProposalMetadataCell < Decidim::CardMetadataCell
|
7
|
+
include Decidim::Proposals::ApplicationHelper
|
8
|
+
|
9
|
+
delegate :state, to: :model
|
10
|
+
|
11
|
+
def initialize(*)
|
12
|
+
super
|
13
|
+
|
14
|
+
@items.prepend(*proposal_items)
|
15
|
+
end
|
16
|
+
|
17
|
+
def state_item
|
18
|
+
return if state.blank?
|
19
|
+
|
20
|
+
{ text: content_tag(:span, humanize_proposal_state(state), class: "label #{state_class}") }
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def proposal_items
|
26
|
+
[coauthors_item, comments_count_item, endorsements_count_item, state_item, emendation_item]
|
27
|
+
end
|
28
|
+
|
29
|
+
def proposal_items_for_map
|
30
|
+
[coauthors_item_for_map, comments_count_item, endorsements_count_item, state_item, emendation_item].compact_blank.map do |item|
|
31
|
+
{
|
32
|
+
text: item[:text].to_s.html_safe,
|
33
|
+
icon: item[:icon].present? ? icon(item[:icon]).html_safe : nil
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def coauthors_item_for_map
|
39
|
+
presented_author = official? ? Decidim::Proposals::OfficialAuthorPresenter.new : present(resource.identities.first)
|
40
|
+
|
41
|
+
{
|
42
|
+
text: presented_author.name,
|
43
|
+
icon: "account-circle-line"
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def state_class
|
48
|
+
case state
|
49
|
+
when "accepted"
|
50
|
+
"success"
|
51
|
+
when "rejected", "withdrawn"
|
52
|
+
"alert"
|
53
|
+
when "evaluating"
|
54
|
+
"warning"
|
55
|
+
else
|
56
|
+
"muted"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "cell/partial"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Proposals
|
7
|
+
# This cell renders the Search (:s) proposal card
|
8
|
+
# for an instance of a Proposal
|
9
|
+
class ProposalSCell < Decidim::CardSCell
|
10
|
+
private
|
11
|
+
|
12
|
+
def title
|
13
|
+
present(model).title(html_escape: true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def metadata_cell
|
17
|
+
"decidim/proposals/proposal_metadata"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
<input type="text" name="proposals-filter" id="proposals_filter" placeholder="<%= t("decidim.admin.filters.search_placeholder.id_string_or_title_cont", collection: proposals_collection_name) %>">
|
4
|
-
</div>
|
5
|
-
<div class="picker-content picker-list" data-picker-path="<%= picker_path %>" data-picker-more="<%= more_proposals? %>">
|
6
|
-
<%= render :proposals %>
|
7
|
-
</div>
|
8
|
-
<div class="picker-footer">
|
9
|
-
<div class="buttons button--double">
|
10
|
-
<a class="button" data-close=""><%= t("proposals_picker.close", scope: "decidim.proposals") %></a>
|
11
|
-
</div>
|
12
|
-
</div>
|
1
|
+
<label for="proposals_list">
|
2
|
+
<%= t("name", scope: "decidim.components.proposals") %>
|
13
3
|
|
14
|
-
|
4
|
+
<select id="proposals_list"
|
5
|
+
placeholder="<%= t("proposals_picker.choose_proposals", scope: "decidim.proposals") %>"
|
6
|
+
data-tm-name="<%= form_name %>"
|
7
|
+
data-tm-items="<%= selected_ids.to_json %>"
|
8
|
+
data-tm-no-results="<%= t("proposals_picker.no_proposals", scope: "decidim.proposals") %>"
|
9
|
+
class="mt-4" multiple>
|
10
|
+
<% decorated_proposals do |proposal| %>
|
11
|
+
<option value="<%= proposal.id %>"><%= proposal.id_and_title(html_escape: true) %> (<%= proposal.reference %>)</option>
|
12
|
+
<% end %>
|
13
|
+
</select>
|
14
|
+
</label>
|
@@ -9,54 +9,29 @@ module Decidim
|
|
9
9
|
MAX_PROPOSALS = 1000
|
10
10
|
|
11
11
|
def show
|
12
|
-
|
13
|
-
render :proposals
|
14
|
-
else
|
15
|
-
render
|
16
|
-
end
|
12
|
+
render
|
17
13
|
end
|
18
14
|
|
19
15
|
alias component model
|
20
16
|
|
21
|
-
def
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
def picker_path
|
26
|
-
request.path
|
17
|
+
def form
|
18
|
+
options[:form]
|
27
19
|
end
|
28
20
|
|
29
|
-
def
|
30
|
-
|
21
|
+
def field
|
22
|
+
options[:field]
|
31
23
|
end
|
32
24
|
|
33
|
-
def
|
34
|
-
|
25
|
+
def form_name
|
26
|
+
"#{form.object_name}[#{method_name}]"
|
35
27
|
end
|
36
28
|
|
37
|
-
def
|
38
|
-
|
29
|
+
def method_name
|
30
|
+
field.to_s.sub(/s$/, "_ids")
|
39
31
|
end
|
40
32
|
|
41
|
-
def
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
def decorated_proposals
|
46
|
-
filtered_proposals.limit(MAX_PROPOSALS).each do |proposal|
|
47
|
-
yield Decidim::Proposals::ProposalPresenter.new(proposal)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def filtered_proposals
|
52
|
-
@filtered_proposals ||= if filtered?
|
53
|
-
table_name = Decidim::Proposals::Proposal.table_name
|
54
|
-
proposals.where(%("#{table_name}"."title"::text ILIKE ?), "%#{search_text}%")
|
55
|
-
.or(proposals.where(%("#{table_name}"."reference" ILIKE ?), "%#{search_text}%"))
|
56
|
-
.or(proposals.where(%("#{table_name}"."id"::text ILIKE ?), "%#{search_text}%"))
|
57
|
-
else
|
58
|
-
proposals
|
59
|
-
end
|
33
|
+
def selected_ids
|
34
|
+
form.object.send(method_name)
|
60
35
|
end
|
61
36
|
|
62
37
|
def proposals
|
@@ -67,8 +42,10 @@ module Decidim
|
|
67
42
|
&.order(id: :asc)
|
68
43
|
end
|
69
44
|
|
70
|
-
def
|
71
|
-
|
45
|
+
def decorated_proposals
|
46
|
+
proposals.limit(MAX_PROPOSALS).each do |proposal|
|
47
|
+
yield Decidim::Proposals::ProposalPresenter.new(proposal)
|
48
|
+
end
|
72
49
|
end
|
73
50
|
end
|
74
51
|
end
|
@@ -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 it
|
24
|
+
# - :invalid if it was not valid and we could not proceed.
|
25
25
|
#
|
26
26
|
# Returns nothing.
|
27
27
|
def call
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
# Executes the command. Broadcasts these events:
|
18
18
|
#
|
19
19
|
# - :ok when everything is valid.
|
20
|
-
# - :invalid if the form
|
20
|
+
# - :invalid if the form was not valid and we could not proceed.
|
21
21
|
#
|
22
22
|
# Returns nothing.
|
23
23
|
def call
|
@@ -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
|
@@ -42,7 +42,7 @@ module Decidim
|
|
42
42
|
|
43
43
|
def find_assignment(proposal)
|
44
44
|
Decidim::Proposals::ValuationAssignment.find_by(
|
45
|
-
proposal
|
45
|
+
proposal:,
|
46
46
|
valuator_role: form.valuator_role
|
47
47
|
)
|
48
48
|
end
|
@@ -51,7 +51,7 @@ module Decidim
|
|
51
51
|
Decidim.traceability.create!(
|
52
52
|
Decidim::Proposals::ValuationAssignment,
|
53
53
|
form.current_user,
|
54
|
-
proposal
|
54
|
+
proposal:,
|
55
55
|
valuator_role: form.valuator_role
|
56
56
|
)
|
57
57
|
end
|
@@ -19,7 +19,7 @@ module Decidim
|
|
19
19
|
# Executes the command. Broadcasts these events:
|
20
20
|
#
|
21
21
|
# - :ok when everything is valid, together with the proposal.
|
22
|
-
# - :invalid if the form
|
22
|
+
# - :invalid if the form was not valid and we could not proceed.
|
23
23
|
#
|
24
24
|
# Returns nothing.
|
25
25
|
def call
|
@@ -53,7 +53,7 @@ module Decidim
|
|
53
53
|
|
54
54
|
def create_proposal
|
55
55
|
@proposal = Decidim::Proposals::ProposalBuilder.create(
|
56
|
-
attributes
|
56
|
+
attributes:,
|
57
57
|
author: form.author,
|
58
58
|
action_user: form.current_user
|
59
59
|
)
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
# Executes the command. Broadcasts these events:
|
18
18
|
#
|
19
19
|
# - :ok when everything is valid, together with the note proposal.
|
20
|
-
# - :invalid if the form
|
20
|
+
# - :invalid if the form was not valid and we could not proceed.
|
21
21
|
#
|
22
22
|
# Returns nothing.
|
23
23
|
def call
|
@@ -39,7 +39,7 @@ module Decidim
|
|
39
39
|
form.current_user,
|
40
40
|
{
|
41
41
|
body: form.body,
|
42
|
-
proposal
|
42
|
+
proposal:,
|
43
43
|
author: form.current_user
|
44
44
|
},
|
45
45
|
resource: {
|
@@ -50,13 +50,13 @@ module Decidim
|
|
50
50
|
|
51
51
|
def notify_admins_and_valuators
|
52
52
|
affected_users = Decidim::User.org_admins_except_me(form.current_user).all
|
53
|
-
affected_users += Decidim::Proposals::ValuationAssignment.includes(valuator_role: :user).where.not(id: form.current_user.id).where(proposal:
|
53
|
+
affected_users += Decidim::Proposals::ValuationAssignment.includes(valuator_role: :user).where.not(id: form.current_user.id).where(proposal:).map(&:valuator)
|
54
54
|
|
55
55
|
data = {
|
56
56
|
event: "decidim.events.proposals.admin.proposal_note_created",
|
57
57
|
event_class: Decidim::Proposals::Admin::ProposalNoteCreatedEvent,
|
58
58
|
resource: proposal,
|
59
|
-
affected_users:
|
59
|
+
affected_users:
|
60
60
|
}
|
61
61
|
|
62
62
|
Decidim::EventsManager.publish(**data)
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -47,22 +47,11 @@ module Decidim
|
|
47
47
|
def proposals
|
48
48
|
@proposals = Decidim::Proposals::Proposal
|
49
49
|
.where(component: origin_component)
|
50
|
-
.where(state:
|
50
|
+
.where(state: @form.states)
|
51
51
|
@proposals = @proposals.where(scope: proposal_scopes) unless proposal_scopes.empty?
|
52
52
|
@proposals
|
53
53
|
end
|
54
54
|
|
55
|
-
def proposal_states
|
56
|
-
@proposal_states = @form.states
|
57
|
-
|
58
|
-
if @form.states.include?("not_answered")
|
59
|
-
@proposal_states.delete("not_answered")
|
60
|
-
@proposal_states.push(nil)
|
61
|
-
end
|
62
|
-
|
63
|
-
@proposal_states
|
64
|
-
end
|
65
|
-
|
66
55
|
def proposal_scopes
|
67
56
|
@form.scopes
|
68
57
|
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
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
|
17
17
|
# Executes the command. Broadcasts these events:
|
18
18
|
#
|
19
|
-
# - :noop when the answer is not published or the state
|
19
|
+
# - :noop when the answer is not published or the state did not changed.
|
20
20
|
# - :ok when everything is valid.
|
21
21
|
#
|
22
22
|
# Returns nothing.
|
@@ -62,8 +62,8 @@ module Decidim
|
|
62
62
|
|
63
63
|
def publish_event(event, event_class)
|
64
64
|
Decidim::EventsManager.publish(
|
65
|
-
event
|
66
|
-
event_class
|
65
|
+
event:,
|
66
|
+
event_class:,
|
67
67
|
resource: proposal,
|
68
68
|
affected_users: proposal.notifiable_identities,
|
69
69
|
followers: proposal.followers - proposal.notifiable_identities
|
@@ -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
|
@@ -55,7 +55,7 @@ module Decidim
|
|
55
55
|
title, body = reset_proposal_title_and_body(proposal)
|
56
56
|
|
57
57
|
Decidim.traceability.perform_action!(:create, proposal, form.current_user, visibility: "all") do
|
58
|
-
proposal.update(title
|
58
|
+
proposal.update(title:, body:, published_at: Time.current)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -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
|
@@ -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
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
|
42
42
|
def find_assignment(proposal)
|
43
43
|
Decidim::Proposals::ValuationAssignment.find_by(
|
44
|
-
proposal
|
44
|
+
proposal:,
|
45
45
|
valuator_role: form.valuator_role
|
46
46
|
)
|
47
47
|
end
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
# Executes the command. Broadcasts these events:
|
18
18
|
#
|
19
19
|
# - :ok when everything is valid.
|
20
|
-
# - :invalid if the form
|
20
|
+
# - :invalid if the form was not valid and we could not proceed.
|
21
21
|
#
|
22
22
|
# Returns nothing.
|
23
23
|
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, together with the proposal.
|
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
|
@@ -57,6 +57,10 @@ module Decidim
|
|
57
57
|
|
58
58
|
attr_reader :form, :proposal, :attachment, :gallery
|
59
59
|
|
60
|
+
def delete_attachment(attachment)
|
61
|
+
Attachment.find(attachment.id).delete if attachment.id.to_i == proposal.documents.first.id
|
62
|
+
end
|
63
|
+
|
60
64
|
def update_proposal
|
61
65
|
parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
|
62
66
|
parsed_body = Decidim::ContentProcessor.parse(form.body, current_organization: form.current_organization).rewrite
|
@@ -20,7 +20,7 @@ module Decidim
|
|
20
20
|
# Executes the command. Broadcasts these events:
|
21
21
|
#
|
22
22
|
# - :ok when everything is valid, together with the collaborative draft.
|
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
|
@@ -31,7 +31,7 @@ module Decidim
|
|
31
31
|
return broadcast(:invalid) if attachments_invalid?
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
with_events(with_transaction: true) do
|
35
35
|
create_collaborative_draft
|
36
36
|
create_attachments if process_attachments?
|
37
37
|
end
|
@@ -43,6 +43,16 @@ module Decidim
|
|
43
43
|
|
44
44
|
attr_reader :form, :collaborative_draft, :attachment
|
45
45
|
|
46
|
+
def event_arguments
|
47
|
+
{
|
48
|
+
resource: collaborative_draft,
|
49
|
+
extra: {
|
50
|
+
event_author: form.current_user,
|
51
|
+
locale:
|
52
|
+
}
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
46
56
|
def create_collaborative_draft
|
47
57
|
@collaborative_draft = Decidim.traceability.perform_action!(
|
48
58
|
:create,
|
@@ -70,7 +80,7 @@ module Decidim
|
|
70
80
|
end
|
71
81
|
|
72
82
|
def user_group
|
73
|
-
@user_group ||= Decidim::UserGroup.find_by(organization
|
83
|
+
@user_group ||= Decidim::UserGroup.find_by(organization:, id: form.user_group_id)
|
74
84
|
end
|
75
85
|
|
76
86
|
def organization
|
@@ -4,7 +4,6 @@ module Decidim
|
|
4
4
|
module Proposals
|
5
5
|
# A command with all the business logic when a user creates a new proposal.
|
6
6
|
class CreateProposal < Decidim::Command
|
7
|
-
include ::Decidim::AttachmentMethods
|
8
7
|
include HashtagsMethods
|
9
8
|
|
10
9
|
# Public: Initializes the command.
|
@@ -21,7 +20,7 @@ module Decidim
|
|
21
20
|
# Executes the command. Broadcasts these events:
|
22
21
|
#
|
23
22
|
# - :ok when everything is valid, together with the proposal.
|
24
|
-
# - :invalid if the form
|
23
|
+
# - :invalid if the form was not valid and we could not proceed.
|
25
24
|
#
|
26
25
|
# Returns nothing.
|
27
26
|
def call
|
@@ -32,7 +31,7 @@ module Decidim
|
|
32
31
|
return broadcast(:invalid)
|
33
32
|
end
|
34
33
|
|
35
|
-
|
34
|
+
with_events(with_transaction: true) do
|
36
35
|
create_proposal
|
37
36
|
end
|
38
37
|
|
@@ -43,6 +42,16 @@ module Decidim
|
|
43
42
|
|
44
43
|
attr_reader :form, :proposal, :attachment
|
45
44
|
|
45
|
+
def event_arguments
|
46
|
+
{
|
47
|
+
resource: proposal,
|
48
|
+
extra: {
|
49
|
+
event_author: form.current_user,
|
50
|
+
locale:
|
51
|
+
}
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
46
55
|
# Prevent PaperTrail from creating an additional version
|
47
56
|
# in the proposal multi-step creation process (step 1: create)
|
48
57
|
#
|
@@ -65,7 +74,7 @@ module Decidim
|
|
65
74
|
},
|
66
75
|
component: form.component
|
67
76
|
)
|
68
|
-
proposal.add_coauthor(@current_user, user_group:
|
77
|
+
proposal.add_coauthor(@current_user, user_group:)
|
69
78
|
proposal.save!
|
70
79
|
proposal
|
71
80
|
end
|
@@ -87,7 +96,7 @@ module Decidim
|
|
87
96
|
end
|
88
97
|
|
89
98
|
def user_group
|
90
|
-
@user_group ||= Decidim::UserGroup.find_by(organization
|
99
|
+
@user_group ||= Decidim::UserGroup.find_by(organization:, id: form.user_group_id)
|
91
100
|
end
|
92
101
|
|
93
102
|
def organization
|
@@ -14,7 +14,7 @@ module Decidim
|
|
14
14
|
def body_with_hashtags
|
15
15
|
@body_with_hashtags ||= begin
|
16
16
|
ret = Decidim::ContentProcessor.parse(form.body, current_organization: form.current_organization).rewrite.strip
|
17
|
-
ret += "\n#{body_extra_hashtags.strip}" unless body_extra_hashtags.empty?
|
17
|
+
ret += "\n\n#{body_extra_hashtags.strip}" unless body_extra_hashtags.empty?
|
18
18
|
ret
|
19
19
|
end
|
20
20
|
end
|
@@ -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 it
|
24
|
+
# - :invalid if it was not valid and we could not proceed.
|
25
25
|
#
|
26
26
|
# Returns nothing.
|
27
27
|
def call
|
@@ -19,7 +19,7 @@ module Decidim
|
|
19
19
|
# Executes the command. Broadcasts these events:
|
20
20
|
#
|
21
21
|
# - :ok when everything is valid.
|
22
|
-
# - :invalid if it
|
22
|
+
# - :invalid if it was not valid and we could not proceed.
|
23
23
|
#
|
24
24
|
# Returns nothing.
|
25
25
|
def call
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
# Executes the command. Broadcasts these events:
|
17
17
|
#
|
18
18
|
# - :ok when everything is valid, together with the proposal.
|
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
|
@@ -57,7 +57,7 @@ module Decidim
|
|
57
57
|
def user_votes
|
58
58
|
@user_votes ||= ProposalVote.where(
|
59
59
|
author: @current_user,
|
60
|
-
proposal: Proposal.where(component:
|
60
|
+
proposal: Proposal.where(component:)
|
61
61
|
)
|
62
62
|
end
|
63
63
|
end
|