decidim-proposals 0.20.1 → 0.23.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/admin/decidim_proposals_manifest.js +1 -0
- data/app/assets/images/decidim/gamification/badges/accepted_proposals.svg +1 -234
- data/app/assets/images/decidim/gamification/badges/proposal_votes.svg +1 -95
- data/app/assets/images/decidim/gamification/badges/proposals.svg +1 -229
- data/app/assets/images/decidim/proposals/icon.svg +1 -3
- data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +6 -0
- data/app/assets/javascripts/decidim/proposals/admin/proposals.es6 +24 -11
- data/app/assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 +3 -5
- data/app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6 +35 -0
- data/app/cells/decidim/proposals/collaborative_draft_cell.rb +1 -1
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +1 -1
- data/app/cells/decidim/proposals/collaborative_draft_m/footer.erb +1 -1
- data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -1
- data/app/cells/decidim/proposals/cost_report/show.erb +35 -0
- data/app/cells/decidim/proposals/cost_report_cell.rb +42 -0
- data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +3 -3
- data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +1 -1
- data/app/cells/decidim/proposals/irreversible_action_modal/show.erb +2 -2
- data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +1 -1
- data/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb +3 -3
- data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +2 -2
- data/app/cells/decidim/proposals/proposal_cell.rb +1 -1
- data/app/cells/decidim/proposals/proposal_m/footer.erb +4 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +37 -9
- data/app/cells/decidim/proposals/proposal_tags/show.erb +18 -10
- data/app/cells/decidim/proposals/proposal_tags_cell.rb +5 -0
- data/app/cells/decidim/proposals/proposals_picker/proposals.erb +12 -0
- data/app/cells/decidim/proposals/proposals_picker/show.erb +14 -0
- data/app/cells/decidim/proposals/proposals_picker_cell.rb +72 -0
- data/app/commands/decidim/proposals/admin/answer_proposal.rb +24 -46
- data/app/commands/decidim/proposals/admin/assign_proposals_to_valuator.rb +61 -0
- data/app/commands/decidim/proposals/admin/create_proposal.rb +10 -3
- data/app/commands/decidim/proposals/admin/create_proposal_note.rb +15 -0
- data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +85 -0
- data/app/commands/decidim/proposals/admin/publish_answers.rb +67 -0
- data/app/commands/decidim/proposals/admin/publish_participatory_text.rb +6 -1
- data/app/commands/decidim/proposals/admin/unassign_proposals_from_valuator.rb +62 -0
- data/app/commands/decidim/proposals/admin/update_participatory_text.rb +10 -2
- data/app/commands/decidim/proposals/admin/update_proposal.rb +5 -3
- data/app/commands/decidim/proposals/admin/update_proposal_scope.rb +75 -0
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/create_proposal.rb +7 -3
- data/app/commands/decidim/proposals/gallery_methods.rb +2 -51
- data/app/commands/decidim/proposals/publish_collaborative_draft.rb +2 -2
- data/app/commands/decidim/proposals/update_proposal.rb +25 -9
- data/app/controllers/concerns/decidim/proposals/admin/filterable.rb +82 -0
- data/app/controllers/concerns/decidim/proposals/admin/picker.rb +21 -0
- data/app/controllers/concerns/decidim/proposals/orderable.rb +1 -1
- data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +16 -6
- data/app/controllers/decidim/proposals/admin/proposal_notes_controller.rb +8 -9
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +107 -31
- data/app/controllers/decidim/proposals/admin/valuation_assignments_controller.rb +58 -0
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +10 -3
- data/app/controllers/decidim/proposals/proposals_controller.rb +30 -10
- data/app/controllers/decidim/proposals/versions_controller.rb +9 -16
- data/app/controllers/decidim/proposals/{proposal_widgets_controller.rb → widgets_controller.rb} +2 -2
- data/app/events/decidim/proposals/admin/proposal_note_created_event.rb +27 -0
- data/app/events/decidim/proposals/admin/update_proposal_scope_event.rb +11 -0
- data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +3 -1
- data/app/forms/decidim/proposals/admin/participatory_text_proposal_form.rb +20 -0
- data/app/forms/decidim/proposals/admin/preview_participatory_text_form.rb +2 -2
- data/app/forms/decidim/proposals/admin/proposal_answer_form.rb +27 -2
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +136 -0
- data/app/forms/decidim/proposals/admin/proposal_form.rb +6 -117
- data/app/forms/decidim/proposals/admin/valuation_assignment_form.rb +37 -0
- data/app/forms/decidim/proposals/proposal_form.rb +25 -12
- data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +13 -1
- data/app/helpers/decidim/proposals/admin/filterable_helper.rb +17 -0
- data/app/helpers/decidim/proposals/admin/proposal_bulk_actions_helper.rb +35 -0
- data/app/helpers/decidim/proposals/admin/proposal_rankings_helper.rb +63 -0
- data/app/helpers/decidim/proposals/admin/proposals_helper.rb +124 -0
- data/app/helpers/decidim/proposals/admin/proposals_picker_helper.rb +30 -0
- data/app/helpers/decidim/proposals/application_helper.rb +54 -38
- data/app/helpers/decidim/proposals/collaborative_draft_helper.rb +9 -9
- data/app/helpers/decidim/proposals/control_version_helper.rb +1 -37
- data/app/helpers/decidim/proposals/proposal_cells_helper.rb +1 -1
- data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +0 -145
- data/app/helpers/decidim/proposals/proposal_votes_helper.rb +2 -2
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +24 -7
- data/app/helpers/decidim/proposals/proposals_helper.rb +24 -0
- data/app/models/decidim/proposals/collaborative_draft.rb +2 -2
- data/app/models/decidim/proposals/participatory_text.rb +3 -0
- data/app/models/decidim/proposals/proposal.rb +152 -42
- data/app/models/decidim/proposals/valuation_assignment.rb +24 -0
- data/app/permissions/decidim/proposals/admin/permissions.rb +77 -11
- data/app/permissions/decidim/proposals/permissions.rb +1 -22
- data/app/presenters/decidim/proposals/admin_log/proposal_presenter.rb +1 -1
- data/app/presenters/decidim/proposals/admin_log/valuation_assignment_presenter.rb +51 -0
- data/app/presenters/decidim/proposals/admin_log/value_types/proposal_title_body_presenter.rb +6 -1
- data/app/presenters/decidim/proposals/admin_log/value_types/valuator_role_user_presenter.rb +19 -0
- data/app/presenters/decidim/proposals/collaborative_draft_presenter.rb +2 -28
- data/app/presenters/decidim/proposals/log/valuation_assignment_presenter.rb +22 -0
- data/app/presenters/decidim/proposals/official_author_presenter.rb +1 -29
- data/app/presenters/decidim/proposals/proposal_presenter.rb +79 -5
- data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +1 -2
- data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +15 -12
- data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +5 -4
- data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +2 -8
- data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +3 -9
- data/app/queries/decidim/proposals/similar_proposals.rb +4 -4
- data/app/services/decidim/proposals/collaborative_draft_search.rb +8 -10
- data/app/services/decidim/proposals/diff_renderer.rb +17 -5
- data/app/services/decidim/proposals/proposal_builder.rb +9 -3
- data/app/services/decidim/proposals/proposal_search.rb +11 -69
- data/app/types/decidim/proposals/proposal_input_filter.rb +29 -0
- data/app/types/decidim/proposals/proposal_input_sort.rb +22 -0
- data/app/types/decidim/proposals/proposal_type.rb +34 -13
- data/app/types/decidim/proposals/proposals_type.rb +22 -15
- data/app/validators/proposal_length_validator.rb +38 -0
- data/app/views/decidim/proposals/admin/participatory_texts/index.html.erb +9 -1
- data/app/views/decidim/proposals/admin/proposal_answers/_form.html.erb +35 -0
- data/app/views/decidim/proposals/admin/proposal_notes/_form.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +8 -2
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +8 -28
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +26 -27
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_assign_to_valuator.html.erb +15 -0
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_dropdown.html.erb +21 -1
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_publish_answers.html.erb +14 -0
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_scope-change.html.erb +25 -0
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_unassign_from_valuator.html.erb +15 -0
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +18 -9
- data/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb +12 -0
- data/app/views/decidim/proposals/admin/proposals/show.html.erb +186 -0
- data/app/views/decidim/proposals/admin/proposals/update_category.js.erb +3 -2
- data/app/views/decidim/proposals/admin/proposals/update_scope.js.erb +27 -0
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +11 -9
- data/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +10 -8
- data/app/views/decidim/proposals/collaborative_drafts/_new_collaborative_draft_button.html.erb +4 -4
- data/app/views/decidim/proposals/collaborative_drafts/_reject_request_access_form.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +4 -2
- data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +2 -0
- data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +2 -0
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +3 -1
- data/app/views/decidim/proposals/collaborative_drafts/index.html.erb +4 -2
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +4 -0
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +29 -30
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +52 -22
- data/app/views/decidim/proposals/proposals/_endorsements_card_row.html.erb +0 -16
- data/app/views/decidim/proposals/proposals/_filters.html.erb +18 -16
- data/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +1 -4
- data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +1 -11
- data/app/views/decidim/proposals/proposals/_proposal_similar.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_proposals.html.erb +14 -0
- data/app/views/decidim/proposals/proposals/_vote_button.html.erb +14 -7
- data/app/views/decidim/proposals/proposals/_wizard_aside.html.erb +4 -2
- data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +4 -3
- data/app/views/decidim/proposals/proposals/compare.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/complete.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/edit.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/edit_draft.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/index.html.erb +6 -13
- data/app/views/decidim/proposals/proposals/new.html.erb +6 -2
- data/app/views/decidim/proposals/proposals/participatory_texts/_index.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +10 -3
- data/app/views/decidim/proposals/proposals/participatory_texts/_view_index.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/preview.html.erb +7 -8
- data/app/views/decidim/proposals/proposals/show.html.erb +62 -50
- data/app/views/decidim/proposals/versions/index.html.erb +14 -32
- data/app/views/decidim/proposals/versions/show.html.erb +16 -34
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +62 -66
- data/config/locales/bg-BG.yml +237 -0
- data/config/locales/bg.yml +237 -0
- data/config/locales/ca.yml +176 -66
- data/config/locales/cs.yml +188 -78
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +169 -62
- data/config/locales/el.yml +876 -0
- data/config/locales/en.yml +179 -69
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +173 -63
- data/config/locales/es-PY.yml +173 -63
- data/config/locales/es.yml +179 -69
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +28 -61
- data/config/locales/fi-plain.yml +174 -64
- data/config/locales/fi.yml +210 -100
- data/config/locales/fr-CA.yml +906 -0
- data/config/locales/fr.yml +184 -66
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +28 -61
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +135 -63
- data/config/locales/id-ID.yml +28 -60
- data/config/locales/is-IS.yml +14 -30
- data/config/locales/is.yml +274 -0
- data/config/locales/it.yml +166 -80
- data/config/locales/ja-JP.yml +865 -0
- data/config/locales/ja.yml +889 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +858 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +151 -63
- data/config/locales/no.yml +62 -67
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +525 -392
- data/config/locales/pt-BR.yml +30 -66
- data/config/locales/pt.yml +439 -330
- data/config/locales/ro-RO.yml +841 -0
- data/config/locales/ru.yml +14 -45
- data/config/locales/sk-SK.yml +896 -0
- data/config/locales/sk.yml +869 -0
- data/config/locales/sl.yml +26 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +126 -0
- data/config/locales/sv.yml +285 -169
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +28 -61
- data/config/locales/uk.yml +14 -45
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +885 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20181003074440_fix_user_groups_ids_in_proposals_endorsements.rb +4 -0
- data/db/migrate/20191206154128_add_endorsements_counter_cache_to_proposals.rb +7 -0
- data/db/migrate/20200120215928_move_proposal_endorsements_to_core_endorsements.rb +54 -0
- data/db/migrate/20200120230130_drop_proposal_endorsements.rb +8 -0
- data/db/migrate/20200203111239_add_proposal_valuation_assignments.rb +12 -0
- data/db/migrate/20200210135152_add_costs_to_proposals.rb +9 -0
- data/db/migrate/20200212120110_sync_proposals_state_with_amendments_state.rb +28 -0
- data/db/migrate/20200227175922_add_state_published_at_to_proposals.rb +7 -0
- data/db/migrate/20200306123652_publish_existing_proposals_state.rb +15 -0
- data/db/migrate/20200708091228_move_proposals_fields_to_i18n.rb +86 -0
- data/db/migrate/20200730131631_move_proposal_endorsed_event_notifications_to_resource_endorsed_event.rb +20 -0
- data/db/migrate/20200827154156_add_commentable_counter_cache_to_proposals.rb +12 -0
- data/db/migrate/20200915151348_fix_proposals_data_to_ensure_title_and_body_are_hashes.rb +37 -0
- data/db/migrate/20201002085508_fix_proposals_data.rb +37 -0
- data/lib/decidim/content_renderers/proposal_renderer.rb +3 -1
- data/lib/decidim/proposals.rb +1 -0
- data/lib/decidim/proposals/admin_engine.rb +7 -3
- data/lib/decidim/proposals/component.rb +55 -28
- data/lib/decidim/proposals/engine.rb +3 -7
- data/lib/decidim/proposals/markdown_to_proposals.rb +2 -2
- data/lib/decidim/proposals/proposal_serializer.rb +3 -3
- data/lib/decidim/proposals/test/capybara_proposals_picker.rb +49 -0
- data/lib/decidim/proposals/test/factories.rb +100 -28
- data/lib/decidim/proposals/valuatable.rb +21 -0
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +117 -55
- data/app/assets/javascripts/decidim/proposals/identity_selector_dialog.js.es6 +0 -56
- data/app/cells/decidim/proposals/endorsers_list/show.erb +0 -17
- data/app/cells/decidim/proposals/endorsers_list_cell.rb +0 -31
- data/app/commands/decidim/proposals/attachment_methods.rb +0 -43
- data/app/commands/decidim/proposals/endorse_proposal.rb +0 -59
- data/app/commands/decidim/proposals/unendorse_proposal.rb +0 -40
- data/app/controllers/decidim/proposals/proposal_endorsements_controller.rb +0 -60
- data/app/models/decidim/proposals/proposal_endorsement.rb +0 -37
- data/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +0 -22
- data/app/views/decidim/proposals/admin/proposal_notes/index.html.erb +0 -3
- data/app/views/decidim/proposals/admin/shared/_info_proposal.html.erb +0 -20
- data/app/views/decidim/proposals/proposal_endorsements/_identity.html.erb +0 -9
- data/app/views/decidim/proposals/proposal_endorsements/identities.html.erb +0 -12
- data/app/views/decidim/proposals/proposal_endorsements/update_buttons_and_counters.js.erb +0 -20
- data/app/views/decidim/proposals/proposal_widgets/show.html.erb +0 -4
- data/app/views/decidim/proposals/proposals/_endorsement_button.html.erb +0 -11
- data/app/views/decidim/proposals/proposals/_endorsement_identities_cabin.html.erb +0 -13
- data/app/views/decidim/proposals/versions/_version.html.erb +0 -20
@@ -0,0 +1 @@
|
|
1
|
+
zh-TW:
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class FixUserGroupsIdsInProposalsEndorsements < ActiveRecord::Migration[5.2]
|
4
|
+
class ProposalEndorsement < ApplicationRecord
|
5
|
+
self.table_name = :decidim_proposals_proposal_endorsements
|
6
|
+
end
|
7
|
+
|
4
8
|
# rubocop:disable Rails/SkipsModelValidations
|
5
9
|
def change
|
6
10
|
Decidim::UserGroup.find_each do |group|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This migration must be executed after CreateDecidimEndorsements migration in decidim-core.
|
4
|
+
class MoveProposalEndorsementsToCoreEndorsements < ActiveRecord::Migration[5.2]
|
5
|
+
class ProposalEndorsement < ApplicationRecord
|
6
|
+
self.table_name = :decidim_proposals_proposal_endorsements
|
7
|
+
end
|
8
|
+
|
9
|
+
class Endorsement < ApplicationRecord
|
10
|
+
self.table_name = :decidim_endorsements
|
11
|
+
end
|
12
|
+
|
13
|
+
# Move ProposalEndorsements to Endorsements
|
14
|
+
def up
|
15
|
+
non_duplicated_group_endorsements = ProposalEndorsement.select(
|
16
|
+
"MIN(id) as id, decidim_user_group_id"
|
17
|
+
).group(:decidim_user_group_id).where.not(decidim_user_group_id: nil).map(&:id)
|
18
|
+
|
19
|
+
ProposalEndorsement.where("id IN (?) OR decidim_user_group_id IS NULL", non_duplicated_group_endorsements).find_each do |prop_endorsement|
|
20
|
+
Endorsement.create!(
|
21
|
+
resource_type: Decidim::Proposals::Proposal.name,
|
22
|
+
resource_id: prop_endorsement.decidim_proposal_id,
|
23
|
+
decidim_author_type: prop_endorsement.decidim_author_type,
|
24
|
+
decidim_author_id: prop_endorsement.decidim_author_id,
|
25
|
+
decidim_user_group_id: prop_endorsement.decidim_user_group_id
|
26
|
+
)
|
27
|
+
end
|
28
|
+
# update new `decidim_proposals_proposal.endorsements_count` counter cache
|
29
|
+
Decidim::Proposals::Proposal.select(:id).all.find_each do |proposal|
|
30
|
+
Decidim::Proposals::Proposal.reset_counters(proposal.id, :endorsements)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def down
|
35
|
+
non_duplicated_group_endorsements = Endorsement.select(
|
36
|
+
"MIN(id) as id, decidim_user_group_id"
|
37
|
+
).group(:decidim_user_group_id).where.not(decidim_user_group_id: nil).map(&:id)
|
38
|
+
|
39
|
+
Endorsement
|
40
|
+
.where(resource_type: "Decidim::Proposals::Proposal")
|
41
|
+
.where("id IN (?) OR decidim_user_group_id IS NULL", non_duplicated_group_endorsements).find_each do |endorsement|
|
42
|
+
ProposalEndorsement.find_or_create_by!(
|
43
|
+
decidim_proposal_id: endorsement.resource_id,
|
44
|
+
decidim_author_type: endorsement.decidim_author_type,
|
45
|
+
decidim_author_id: endorsement.decidim_author_id,
|
46
|
+
decidim_user_group_id: endorsement.decidim_user_group_id
|
47
|
+
)
|
48
|
+
end
|
49
|
+
# update `decidim_proposals_proposal.proposal_endorsements_count` counter cache
|
50
|
+
Decidim::Proposals::Proposal.select(:id).all.find_each do |proposal|
|
51
|
+
Decidim::Proposals::Proposal.reset_counters(proposal.id, :proposal_endorsements)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DropProposalEndorsements < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
drop_table :decidim_proposals_proposal_endorsements, if_exists: true, force: :restrict
|
6
|
+
remove_column :decidim_proposals_proposals, :proposal_endorsements_count
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddProposalValuationAssignments < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_proposals_valuation_assignments do |t|
|
6
|
+
t.references :decidim_proposal, null: false, index: { name: "decidim_proposals_valuation_assignment_proposal" }
|
7
|
+
t.references :valuator_role, polymorphic: true, null: false, index: { name: "decidim_proposals_valuation_assignment_valuator_role" }
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddCostsToProposals < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_column :decidim_proposals_proposals, :cost, :decimal
|
6
|
+
add_column :decidim_proposals_proposals, :cost_report, :jsonb
|
7
|
+
add_column :decidim_proposals_proposals, :execution_period, :jsonb
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SyncProposalsStateWithAmendmentsState < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
execute <<-SQL.squish
|
6
|
+
UPDATE decidim_proposals_proposals AS proposals
|
7
|
+
SET state = amendments.state
|
8
|
+
FROM decidim_amendments AS amendments
|
9
|
+
WHERE
|
10
|
+
proposals.state IS NULL AND
|
11
|
+
amendments.decidim_emendation_type = 'Decidim::Proposals::Proposal' AND
|
12
|
+
amendments.decidim_emendation_id = proposals.id AND
|
13
|
+
amendments.state IS NOT NULL
|
14
|
+
SQL
|
15
|
+
end
|
16
|
+
|
17
|
+
def down
|
18
|
+
execute <<-SQL.squish
|
19
|
+
UPDATE decidim_proposals_proposals AS proposals
|
20
|
+
SET state = NULL
|
21
|
+
FROM decidim_amendments AS amendments
|
22
|
+
WHERE
|
23
|
+
amendments.decidim_emendation_type = 'Decidim::Proposals::Proposal' AND
|
24
|
+
amendments.decidim_emendation_id = proposals.id AND
|
25
|
+
amendments.state IS NOT NULL
|
26
|
+
SQL
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class PublishExistingProposalsState < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
execute <<-SQL.squish
|
6
|
+
UPDATE decidim_proposals_proposals SET state_published_at = COALESCE(answered_at, published_at) WHERE state IS NOT NULL
|
7
|
+
SQL
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
execute <<-SQL.squish
|
12
|
+
UPDATE decidim_proposals_proposals SET state_published_at = NULL
|
13
|
+
SQL
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class MoveProposalsFieldsToI18n < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
add_column :decidim_proposals_proposals, :new_title, :jsonb
|
6
|
+
add_column :decidim_proposals_proposals, :new_body, :jsonb
|
7
|
+
|
8
|
+
reset_column_information
|
9
|
+
|
10
|
+
PaperTrail.request(enabled: false) do
|
11
|
+
Decidim::Proposals::Proposal.find_each do |proposal|
|
12
|
+
author = proposal.coauthorships.first.author
|
13
|
+
|
14
|
+
locale = if author
|
15
|
+
author.try(:locale).presence || author.try(:default_locale).presence || author.try(:organization).try(:default_locale).presence
|
16
|
+
elsif proposal.component && proposal.component.participatory_space
|
17
|
+
proposal.component.participatory_space.organization.default_locale
|
18
|
+
else
|
19
|
+
I18n.default_locale.to_s
|
20
|
+
end
|
21
|
+
|
22
|
+
proposal.new_title = {
|
23
|
+
locale => proposal.title
|
24
|
+
}
|
25
|
+
proposal.new_body = {
|
26
|
+
locale => proposal.body
|
27
|
+
}
|
28
|
+
|
29
|
+
proposal.save(validate: false)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
remove_indexs
|
34
|
+
|
35
|
+
remove_column :decidim_proposals_proposals, :title
|
36
|
+
rename_column :decidim_proposals_proposals, :new_title, :title
|
37
|
+
remove_column :decidim_proposals_proposals, :body
|
38
|
+
rename_column :decidim_proposals_proposals, :new_body, :body
|
39
|
+
|
40
|
+
create_indexs
|
41
|
+
|
42
|
+
reset_column_information
|
43
|
+
end
|
44
|
+
|
45
|
+
def down
|
46
|
+
add_column :decidim_proposals_proposals, :new_title, :string
|
47
|
+
add_column :decidim_proposals_proposals, :new_body, :string
|
48
|
+
|
49
|
+
reset_column_information
|
50
|
+
|
51
|
+
Decidim::Proposals::Proposal.find_each do |proposal|
|
52
|
+
proposal.new_title = proposal.title.values.first
|
53
|
+
proposal.new_body = proposal.body.values.first
|
54
|
+
|
55
|
+
proposal.save!
|
56
|
+
end
|
57
|
+
|
58
|
+
remove_indexs
|
59
|
+
|
60
|
+
remove_column :decidim_proposals_proposals, :title
|
61
|
+
rename_column :decidim_proposals_proposals, :new_title, :title
|
62
|
+
remove_column :decidim_proposals_proposals, :body
|
63
|
+
rename_column :decidim_proposals_proposals, :new_body, :body
|
64
|
+
|
65
|
+
create_indexs
|
66
|
+
|
67
|
+
reset_column_information
|
68
|
+
end
|
69
|
+
|
70
|
+
def reset_column_information
|
71
|
+
Decidim::User.reset_column_information
|
72
|
+
Decidim::Coauthorship.reset_column_information
|
73
|
+
Decidim::Proposals::Proposal.reset_column_information
|
74
|
+
Decidim::Organization.reset_column_information
|
75
|
+
end
|
76
|
+
|
77
|
+
def remove_indexs
|
78
|
+
remove_index :decidim_proposals_proposals, name: "decidim_proposals_proposal_title_search"
|
79
|
+
remove_index :decidim_proposals_proposals, name: "decidim_proposals_proposal_body_search"
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_indexs
|
83
|
+
execute "CREATE INDEX decidim_proposals_proposal_title_search ON decidim_proposals_proposals(md5(title::text))"
|
84
|
+
execute "CREATE INDEX decidim_proposals_proposal_body_search ON decidim_proposals_proposals(md5(body::text))"
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class MoveProposalEndorsedEventNotificationsToResourceEndorsedEvent < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
Decidim::Notification.where(event_name: "decidim.events.proposals.proposal_endorsed", event_class: "Decidim::Proposals::ProposalEndorsedEvent").find_each do |notification|
|
6
|
+
notification.update(event_name: "decidim.events.resource_endorsed", event_class: "Decidim::ResourceEndorsedEvent")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
Decidim::Notification.where(
|
12
|
+
event_name: "decidim.events.resource_endorsed",
|
13
|
+
event_class: "Decidim::ResourceEndorsedEvent",
|
14
|
+
decidim_resource_type: "Decidim::Proposals::Proposal"
|
15
|
+
)
|
16
|
+
.find_each do |notification|
|
17
|
+
notification.update(event_name: "decidim.events.proposals.proposal_endorsed", event_class: "Decidim::Proposals::ProposalEndorsedEvent")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddCommentableCounterCacheToProposals < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
add_column :decidim_proposals_proposals, :comments_count, :integer, null: false, default: 0, index: true
|
6
|
+
add_column :decidim_proposals_collaborative_drafts, :comments_count, :integer, null: false, default: 0, index: true
|
7
|
+
Decidim::Proposals::Proposal.reset_column_information
|
8
|
+
Decidim::Proposals::Proposal.find_each(&:update_comments_count)
|
9
|
+
Decidim::Proposals::CollaborativeDraft.reset_column_information
|
10
|
+
Decidim::Proposals::CollaborativeDraft.find_each(&:update_comments_count)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class FixProposalsDataToEnsureTitleAndBodyAreHashes < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
reset_column_information
|
6
|
+
|
7
|
+
PaperTrail.request(enabled: false) do
|
8
|
+
Decidim::Proposals::Proposal.find_each do |proposal|
|
9
|
+
next if proposal.title.is_a?(Hash) && proposal.body.is_a?(Hash)
|
10
|
+
|
11
|
+
author = proposal.coauthorships.first.author
|
12
|
+
|
13
|
+
locale = author.try(:locale).presence || author.try(:default_locale).presence || author.try(:organization).try(:default_locale).presence
|
14
|
+
|
15
|
+
proposal.title = {
|
16
|
+
locale => proposal.title
|
17
|
+
}
|
18
|
+
proposal.body = {
|
19
|
+
locale => proposal.body
|
20
|
+
}
|
21
|
+
|
22
|
+
proposal.save!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
reset_column_information
|
27
|
+
end
|
28
|
+
|
29
|
+
def down; end
|
30
|
+
|
31
|
+
def reset_column_information
|
32
|
+
Decidim::User.reset_column_information
|
33
|
+
Decidim::Coauthorship.reset_column_information
|
34
|
+
Decidim::Proposals::Proposal.reset_column_information
|
35
|
+
Decidim::Organization.reset_column_information
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class FixProposalsData < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
reset_column_information
|
6
|
+
|
7
|
+
PaperTrail.request(enabled: false) do
|
8
|
+
Decidim::Proposals::Proposal.find_each do |proposal|
|
9
|
+
next if proposal.title.is_a?(Hash) && proposal.body.is_a?(Hash)
|
10
|
+
|
11
|
+
author = proposal.coauthorships.first.author
|
12
|
+
|
13
|
+
locale = author.try(:locale).presence || author.try(:default_locale).presence || author.try(:organization).try(:default_locale).presence
|
14
|
+
|
15
|
+
proposal.title = {
|
16
|
+
locale => proposal.title
|
17
|
+
}
|
18
|
+
proposal.body = {
|
19
|
+
locale => proposal.body
|
20
|
+
}
|
21
|
+
|
22
|
+
proposal.save!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
reset_column_information
|
27
|
+
end
|
28
|
+
|
29
|
+
def down; end
|
30
|
+
|
31
|
+
def reset_column_information
|
32
|
+
Decidim::User.reset_column_information
|
33
|
+
Decidim::Coauthorship.reset_column_information
|
34
|
+
Decidim::Proposals::Proposal.reset_column_information
|
35
|
+
Decidim::Organization.reset_column_information
|
36
|
+
end
|
37
|
+
end
|
@@ -17,7 +17,9 @@ module Decidim
|
|
17
17
|
# invalid Decidim::Proposals::Proposal are replaced with '???' string.
|
18
18
|
#
|
19
19
|
# @return [String] the content ready to display (contains HTML)
|
20
|
-
def render
|
20
|
+
def render(_options = nil)
|
21
|
+
return content unless content.respond_to?(:gsub)
|
22
|
+
|
21
23
|
content.gsub(GLOBAL_ID_REGEX) do |proposal_gid|
|
22
24
|
proposal = GlobalID::Locator.locate(proposal_gid)
|
23
25
|
Decidim::Proposals::ProposalPresenter.new(proposal).display_mention
|
data/lib/decidim/proposals.rb
CHANGED
@@ -17,6 +17,7 @@ module Decidim
|
|
17
17
|
autoload :ParticipatoryTextSection, "decidim/proposals/participatory_text_section"
|
18
18
|
autoload :DocToMarkdown, "decidim/proposals/doc_to_markdown"
|
19
19
|
autoload :OdtToMarkdown, "decidim/proposals/odt_to_markdown"
|
20
|
+
autoload :Valuatable, "decidim/proposals/valuatable"
|
20
21
|
|
21
22
|
include ActiveSupport::Configurable
|
22
23
|
|
@@ -10,15 +10,19 @@ module Decidim
|
|
10
10
|
paths["lib/tasks"] = nil
|
11
11
|
|
12
12
|
routes do
|
13
|
-
resources :proposals, only: [:index, :new, :create, :edit, :update] do
|
14
|
-
|
13
|
+
resources :proposals, only: [:show, :index, :new, :create, :edit, :update] do
|
14
|
+
resources :valuation_assignments, only: [:destroy]
|
15
15
|
collection do
|
16
|
+
post :update_category
|
17
|
+
post :publish_answers
|
18
|
+
post :update_scope
|
16
19
|
resource :proposals_import, only: [:new, :create]
|
17
20
|
resource :proposals_merge, only: [:create]
|
18
21
|
resource :proposals_split, only: [:create]
|
22
|
+
resource :valuation_assignment, only: [:create, :destroy]
|
19
23
|
end
|
20
24
|
resources :proposal_answers, only: [:edit, :update]
|
21
|
-
resources :proposal_notes, only: [:
|
25
|
+
resources :proposal_notes, only: [:create]
|
22
26
|
end
|
23
27
|
|
24
28
|
resources :participatory_texts, only: [:index] do
|
@@ -22,6 +22,8 @@ Decidim.register_component(:proposals) do |component|
|
|
22
22
|
component.permissions_class_name = "Decidim::Proposals::Permissions"
|
23
23
|
|
24
24
|
component.settings(:global) do |settings|
|
25
|
+
settings.attribute :scopes_enabled, type: :boolean, default: false
|
26
|
+
settings.attribute :scope_id, type: :scope
|
25
27
|
settings.attribute :vote_limit, type: :integer, default: 0
|
26
28
|
settings.attribute :minimum_votes_per_user, type: :integer, default: 0
|
27
29
|
settings.attribute :proposal_limit, type: :integer, default: 0
|
@@ -32,14 +34,19 @@ Decidim.register_component(:proposals) do |component|
|
|
32
34
|
settings.attribute :proposal_answering_enabled, type: :boolean, default: true
|
33
35
|
settings.attribute :official_proposals_enabled, type: :boolean, default: true
|
34
36
|
settings.attribute :comments_enabled, type: :boolean, default: true
|
37
|
+
settings.attribute :comments_max_length, type: :integer, required: false
|
35
38
|
settings.attribute :geocoding_enabled, type: :boolean, default: false
|
36
39
|
settings.attribute :attachments_allowed, type: :boolean, default: false
|
40
|
+
settings.attribute :allow_card_image, type: :boolean, default: false
|
37
41
|
settings.attribute :resources_permissions_enabled, type: :boolean, default: true
|
38
42
|
settings.attribute :collaborative_drafts_enabled, type: :boolean, default: false
|
39
|
-
settings.attribute :participatory_texts_enabled,
|
43
|
+
settings.attribute :participatory_texts_enabled,
|
44
|
+
type: :boolean, default: false,
|
45
|
+
readonly: ->(context) { Decidim::Proposals::Proposal.where(component: context[:component]).any? }
|
40
46
|
settings.attribute :amendments_enabled, type: :boolean, default: false
|
41
47
|
settings.attribute :amendments_wizard_help_text, type: :text, translated: true, editor: true, required: false
|
42
48
|
settings.attribute :announcement, type: :text, translated: true, editor: true
|
49
|
+
settings.attribute :new_proposal_body_template, type: :text, translated: true, editor: true, required: false
|
43
50
|
settings.attribute :new_proposal_help_text, type: :text, translated: true, editor: true
|
44
51
|
settings.attribute :proposal_wizard_step_1_help_text, type: :text, translated: true, editor: true
|
45
52
|
settings.attribute :proposal_wizard_step_2_help_text, type: :text, translated: true, editor: true
|
@@ -56,10 +63,14 @@ Decidim.register_component(:proposals) do |component|
|
|
56
63
|
settings.attribute :comments_blocked, type: :boolean, default: false
|
57
64
|
settings.attribute :creation_enabled, type: :boolean
|
58
65
|
settings.attribute :proposal_answering_enabled, type: :boolean, default: true
|
66
|
+
settings.attribute :publish_answers_immediately, type: :boolean, default: true
|
67
|
+
settings.attribute :answers_with_costs, type: :boolean, default: false
|
59
68
|
settings.attribute :amendment_creation_enabled, type: :boolean, default: true
|
60
69
|
settings.attribute :amendment_reaction_enabled, type: :boolean, default: true
|
61
70
|
settings.attribute :amendment_promotion_enabled, type: :boolean, default: true
|
62
|
-
settings.attribute :amendments_visibility,
|
71
|
+
settings.attribute :amendments_visibility,
|
72
|
+
type: :enum, default: "all",
|
73
|
+
choices: -> { Decidim.config.amendments_visibility_options }
|
63
74
|
settings.attribute :announcement, type: :text, translated: true, editor: true
|
64
75
|
settings.attribute :automatic_hashtags, type: :text, editor: false, required: false
|
65
76
|
settings.attribute :suggested_hashtags, type: :text, editor: false, required: false
|
@@ -86,27 +97,40 @@ Decidim.register_component(:proposals) do |component|
|
|
86
97
|
Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).accepted.not_hidden.count
|
87
98
|
end
|
88
99
|
|
89
|
-
component.register_stat :
|
100
|
+
component.register_stat :supports_count, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, start_at, end_at|
|
90
101
|
proposals = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).published.not_hidden
|
91
102
|
Decidim::Proposals::ProposalVote.where(proposal: proposals).count
|
92
103
|
end
|
93
104
|
|
94
105
|
component.register_stat :endorsements_count, priority: Decidim::StatsRegistry::MEDIUM_PRIORITY do |components, start_at, end_at|
|
95
106
|
proposals = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).not_hidden
|
96
|
-
Decidim::
|
107
|
+
Decidim::Endorsement.where(resource_id: proposals.pluck(:id), resource_type: Decidim::Proposals::Proposal.name).count
|
97
108
|
end
|
98
109
|
|
99
110
|
component.register_stat :comments_count, tag: :comments do |components, start_at, end_at|
|
100
111
|
proposals = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).published.not_hidden
|
101
|
-
|
112
|
+
proposals.sum(:comments_count)
|
113
|
+
end
|
114
|
+
|
115
|
+
component.register_stat :followers_count, tag: :followers, priority: Decidim::StatsRegistry::LOW_PRIORITY do |components, start_at, end_at|
|
116
|
+
proposals_ids = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).published.not_hidden.pluck(:id)
|
117
|
+
Decidim::Follow.where(decidim_followable_type: "Decidim::Proposals::Proposal", decidim_followable_id: proposals_ids).count
|
102
118
|
end
|
103
119
|
|
104
120
|
component.exports :proposals do |exports|
|
105
|
-
exports.collection do |component_instance|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
121
|
+
exports.collection do |component_instance, user|
|
122
|
+
space = component_instance.participatory_space
|
123
|
+
|
124
|
+
collection = Decidim::Proposals::Proposal
|
125
|
+
.published
|
126
|
+
.where(component: component_instance)
|
127
|
+
.includes(:category, :component)
|
128
|
+
|
129
|
+
if space.user_roles(:valuator).where(user: user).any?
|
130
|
+
collection.with_valuation_assigned_to(user, space)
|
131
|
+
else
|
132
|
+
collection
|
133
|
+
end
|
110
134
|
end
|
111
135
|
|
112
136
|
exports.include_in_open_data = true
|
@@ -166,25 +190,28 @@ Decidim.register_component(:proposals) do |component|
|
|
166
190
|
end
|
167
191
|
|
168
192
|
5.times do |n|
|
169
|
-
state, answer = if n > 3
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
193
|
+
state, answer, state_published_at = if n > 3
|
194
|
+
["accepted", Decidim::Faker::Localized.sentence(10), Time.current]
|
195
|
+
elsif n > 2
|
196
|
+
["rejected", nil, Time.current]
|
197
|
+
elsif n > 1
|
198
|
+
["evaluating", nil, Time.current]
|
199
|
+
elsif n.positive?
|
200
|
+
["accepted", Decidim::Faker::Localized.sentence(10), nil]
|
201
|
+
else
|
202
|
+
[nil, nil, nil]
|
203
|
+
end
|
178
204
|
|
179
205
|
params = {
|
180
206
|
component: component,
|
181
207
|
category: participatory_space.categories.sample,
|
182
208
|
scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
|
183
|
-
title: Faker::Lorem.sentence(2),
|
184
|
-
body: Faker::Lorem.paragraphs(2).join("\n"),
|
209
|
+
title: { en: Faker::Lorem.sentence(2) },
|
210
|
+
body: { en: Faker::Lorem.paragraphs(2).join("\n") },
|
185
211
|
state: state,
|
186
212
|
answer: answer,
|
187
|
-
answered_at: Time.current,
|
213
|
+
answered_at: state.present? ? Time.current : nil,
|
214
|
+
state_published_at: state_published_at,
|
188
215
|
published_at: Time.current
|
189
216
|
}
|
190
217
|
|
@@ -245,9 +272,9 @@ Decidim.register_component(:proposals) do |component|
|
|
245
272
|
component: component,
|
246
273
|
category: participatory_space.categories.sample,
|
247
274
|
scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
|
248
|
-
title: "#{proposal.title} #{Faker::Lorem.sentence(1)}",
|
249
|
-
body: "#{proposal.body} #{Faker::Lorem.sentence(3)}",
|
250
|
-
state:
|
275
|
+
title: { en: "#{proposal.title["en"]} #{Faker::Lorem.sentence(1)}" },
|
276
|
+
body: { en: "#{proposal.body["en"]} #{Faker::Lorem.sentence(3)}" },
|
277
|
+
state: "evaluating",
|
251
278
|
answer: nil,
|
252
279
|
answered_at: Time.current,
|
253
280
|
published_at: Time.current
|
@@ -290,11 +317,11 @@ Decidim.register_component(:proposals) do |component|
|
|
290
317
|
about: Faker::Lorem.paragraph(2)
|
291
318
|
)
|
292
319
|
|
293
|
-
Decidim::Proposals::ProposalVote.create!(proposal: proposal, author: author) unless proposal.
|
320
|
+
Decidim::Proposals::ProposalVote.create!(proposal: proposal, author: author) unless proposal.published_state? && proposal.rejected?
|
294
321
|
Decidim::Proposals::ProposalVote.create!(proposal: emendation, author: author) if emendation
|
295
322
|
end
|
296
323
|
|
297
|
-
unless proposal.
|
324
|
+
unless proposal.published_state? && proposal.rejected?
|
298
325
|
(n * 2).times do |index|
|
299
326
|
email = "endorsement-author-#{participatory_space.underscored_name}-#{participatory_space.id}-#{n}-endr#{index}@example.org"
|
300
327
|
name = "#{Faker::Name.name} #{participatory_space.id} #{n} endr#{index}"
|
@@ -329,7 +356,7 @@ Decidim.register_component(:proposals) do |component|
|
|
329
356
|
user_group: group
|
330
357
|
)
|
331
358
|
end
|
332
|
-
Decidim::
|
359
|
+
Decidim::Endorsement.create!(resource: proposal, author: author, user_group: author.user_groups.first)
|
333
360
|
end
|
334
361
|
end
|
335
362
|
|