decidim-proposals 0.26.8 → 0.27.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -1
- data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +9 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +6 -8
- 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 +1 -1
- data/app/commands/decidim/proposals/admin/create_proposal.rb +10 -7
- data/app/commands/decidim/proposals/admin/create_proposal_note.rb +2 -2
- 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 -5
- data/app/commands/decidim/proposals/admin/merge_proposals.rb +1 -1
- data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +1 -3
- data/app/commands/decidim/proposals/admin/publish_answers.rb +1 -1
- data/app/commands/decidim/proposals/admin/split_proposals.rb +1 -1
- data/app/commands/decidim/proposals/admin/unassign_proposals_from_valuator.rb +1 -1
- data/app/commands/decidim/proposals/admin/update_participatory_text.rb +1 -1
- data/app/commands/decidim/proposals/admin/update_proposal.rb +8 -2
- data/app/commands/decidim/proposals/admin/update_proposal_category.rb +5 -3
- data/app/commands/decidim/proposals/admin/update_proposal_scope.rb +3 -3
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +5 -5
- data/app/commands/decidim/proposals/create_proposal.rb +1 -1
- data/app/commands/decidim/proposals/destroy_proposal.rb +1 -1
- data/app/commands/decidim/proposals/publish_collaborative_draft.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 +1 -1
- data/app/commands/decidim/proposals/update_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/update_proposal.rb +8 -2
- data/app/commands/decidim/proposals/vote_proposal.rb +1 -1
- data/app/commands/decidim/proposals/withdraw_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/withdraw_proposal.rb +1 -1
- data/app/controllers/concerns/decidim/proposals/orderable.rb +7 -5
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +7 -7
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +10 -10
- data/app/controllers/decidim/proposals/proposal_votes_controller.rb +1 -1
- data/app/controllers/decidim/proposals/proposals_controller.rb +25 -18
- data/app/events/decidim/proposals/publish_proposal_event.rb +0 -8
- data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +4 -4
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +4 -4
- data/app/forms/decidim/proposals/admin/proposal_form.rb +2 -0
- data/app/forms/decidim/proposals/admin/proposals_fork_form.rb +2 -2
- data/app/forms/decidim/proposals/admin/proposals_import_form.rb +1 -1
- data/app/forms/decidim/proposals/proposal_form.rb +11 -4
- data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +3 -0
- data/app/helpers/decidim/proposals/admin/proposal_bulk_actions_helper.rb +4 -0
- data/app/helpers/decidim/proposals/application_helper.rb +4 -17
- data/app/helpers/decidim/proposals/proposal_cells_helper.rb +1 -3
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +7 -7
- data/app/helpers/decidim/proposals/proposals_helper.rb +1 -1
- data/app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb +1 -1
- data/app/models/decidim/proposals/collaborative_draft.rb +10 -0
- data/app/models/decidim/proposals/collaborative_draft_collaborator_request.rb +0 -2
- data/app/models/decidim/proposals/proposal.rb +47 -8
- data/app/queries/decidim/proposals/filtered_proposals.rb +1 -1
- data/app/queries/decidim/proposals/similar_proposals.rb +1 -1
- data/app/services/decidim/proposals/proposal_search.rb +16 -71
- data/app/validators/proposal_length_validator.rb +2 -5
- data/app/views/decidim/proposals/admin/participatory_texts/_article-preview.html.erb +2 -2
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +2 -2
- data/app/views/decidim/proposals/admin/proposals/edit.html.erb +0 -1
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +0 -1
- data/app/views/decidim/proposals/admin/proposals/new.html.erb +0 -1
- data/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/show.html.erb +0 -1
- data/app/views/decidim/proposals/admin/proposals/update_attribute.js.erb +26 -0
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +9 -17
- data/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +4 -4
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +3 -1
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +3 -1
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +13 -36
- data/app/views/decidim/proposals/proposals/_filters.html.erb +5 -5
- data/app/views/decidim/proposals/proposals/_linked_proposals.html.erb +1 -2
- data/app/views/decidim/proposals/proposals/_proposals.html.erb +5 -5
- data/app/views/decidim/proposals/proposals/complete.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/edit.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/edit_draft.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/new.html.erb +3 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +4 -262
- data/config/locales/bg.yml +1 -9
- data/config/locales/ca.yml +19 -31
- data/config/locales/cs.yml +32 -44
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +7 -104
- data/config/locales/el.yml +5 -146
- data/config/locales/en.yml +12 -25
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +18 -30
- data/config/locales/es-PY.yml +18 -30
- data/config/locales/es.yml +15 -27
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +203 -261
- data/config/locales/fi-plain.yml +17 -28
- data/config/locales/fi.yml +21 -32
- data/config/locales/fr-CA.yml +20 -31
- data/config/locales/fr.yml +20 -31
- data/config/locales/ga-IE.yml +1 -2
- data/config/locales/gl.yml +14 -11
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +13 -60
- data/config/locales/id-ID.yml +5 -15
- data/config/locales/is-IS.yml +8 -17
- data/config/locales/it.yml +11 -14
- data/config/locales/ja.yml +67 -79
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +1 -0
- data/config/locales/lt.yml +1 -986
- data/config/locales/lv.yml +5 -13
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +14 -18
- data/config/locales/no.yml +6 -10
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +5 -26
- data/config/locales/pt-BR.yml +6 -12
- data/config/locales/pt.yml +6 -10
- data/config/locales/ro-RO.yml +9 -9
- data/config/locales/ru.yml +8 -16
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +6 -14
- data/config/locales/sl.yml +4 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +1 -2
- data/config/locales/sv.yml +14 -12
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +7 -11
- data/config/locales/uk.yml +8 -16
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +5 -12
- data/config/locales/zh-TW.yml +1 -964
- data/db/migrate/20180529110230_move_authorships_to_coauthorships.rb +1 -0
- data/db/migrate/20181003074440_fix_user_groups_ids_in_proposals_endorsements.rb +2 -9
- data/db/migrate/20200708091228_move_proposals_fields_to_i18n.rb +18 -28
- data/db/migrate/20201002085508_fix_proposals_data.rb +13 -25
- data/lib/decidim/proposals/component.rb +25 -21
- data/lib/decidim/proposals/engine.rb +0 -6
- data/lib/decidim/proposals/import/proposal_answer_creator.rb +4 -10
- data/lib/decidim/proposals/proposal_serializer.rb +1 -9
- data/lib/decidim/proposals/test/factories.rb +1 -1
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +25 -50
- data/app/services/decidim/proposals/collaborative_draft_search.rb +0 -59
- data/app/views/decidim/proposals/admin/proposals/_js-callout.html.erb +0 -6
- data/app/views/decidim/proposals/admin/proposals/update_category.js.erb +0 -26
- data/app/views/decidim/proposals/admin/proposals/update_scope.js.erb +0 -27
- data/config/environment.rb +0 -0
- data/config/locales/fa-IR.yml +0 -1
- data/config/locales/gn-PY.yml +0 -1
- data/config/locales/ka-GE.yml +0 -1
- data/config/locales/kaa.yml +0 -1
- data/config/locales/lo-LA.yml +0 -1
- data/config/locales/oc-FR.yml +0 -1
- data/lib/tasks/proposals/upgrade/decdim_proposal_upgrade_tasks.rake +0 -34
@@ -5,20 +5,13 @@ class FixUserGroupsIdsInProposalsEndorsements < ActiveRecord::Migration[5.2]
|
|
5
5
|
self.table_name = :decidim_proposals_proposal_endorsements
|
6
6
|
end
|
7
7
|
|
8
|
-
class UserGroup < ApplicationRecord
|
9
|
-
self.table_name = :decidim_users
|
10
|
-
self.inheritance_column = nil # disable the default inheritance
|
11
|
-
|
12
|
-
default_scope { where(type: "Decidim::UserGroup") }
|
13
|
-
end
|
14
|
-
|
15
8
|
# rubocop:disable Rails/SkipsModelValidations
|
16
9
|
def change
|
17
|
-
UserGroup.find_each do |group|
|
10
|
+
Decidim::UserGroup.find_each do |group|
|
18
11
|
old_id = group.extended_data["old_user_group_id"]
|
19
12
|
next unless old_id
|
20
13
|
|
21
|
-
ProposalEndorsement
|
14
|
+
Decidim::Proposals::ProposalEndorsement
|
22
15
|
.where(decidim_user_group_id: old_id)
|
23
16
|
.update_all(decidim_user_group_id: group.id)
|
24
17
|
end
|
@@ -1,38 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class MoveProposalsFieldsToI18n < ActiveRecord::Migration[5.2]
|
4
|
-
class Proposal < ApplicationRecord
|
5
|
-
include Decidim::HasComponent
|
6
|
-
|
7
|
-
self.table_name = :decidim_proposals_proposals
|
8
|
-
end
|
9
|
-
|
10
|
-
class Coauthorship < ApplicationRecord
|
11
|
-
self.table_name = :decidim_coauthorships
|
12
|
-
end
|
13
|
-
|
14
|
-
class UserBaseEntity < ApplicationRecord
|
15
|
-
self.table_name = :decidim_users
|
16
|
-
self.inheritance_column = nil # disable the default inheritance
|
17
|
-
end
|
18
|
-
|
19
|
-
class Organization < ApplicationRecord
|
20
|
-
self.table_name = :decidim_organizations
|
21
|
-
end
|
22
|
-
|
23
4
|
def up
|
24
5
|
add_column :decidim_proposals_proposals, :new_title, :jsonb
|
25
6
|
add_column :decidim_proposals_proposals, :new_body, :jsonb
|
26
7
|
|
8
|
+
reset_column_information
|
9
|
+
|
27
10
|
PaperTrail.request(enabled: false) do
|
28
|
-
Proposal.find_each do |proposal|
|
29
|
-
|
30
|
-
author =
|
31
|
-
if coauthorship.decidim_author_type == "Decidim::Organization"
|
32
|
-
Organization.find_by(id: coauthorship.decidim_author_id)
|
33
|
-
else
|
34
|
-
UserBaseEntity.find_by(id: coauthorship.decidim_author_id)
|
35
|
-
end
|
11
|
+
Decidim::Proposals::Proposal.find_each do |proposal|
|
12
|
+
author = proposal.coauthorships.first.author
|
36
13
|
|
37
14
|
locale = if author
|
38
15
|
author.try(:locale).presence || author.try(:default_locale).presence || author.try(:organization).try(:default_locale).presence
|
@@ -61,13 +38,17 @@ class MoveProposalsFieldsToI18n < ActiveRecord::Migration[5.2]
|
|
61
38
|
rename_column :decidim_proposals_proposals, :new_body, :body
|
62
39
|
|
63
40
|
create_indexs
|
41
|
+
|
42
|
+
reset_column_information
|
64
43
|
end
|
65
44
|
|
66
45
|
def down
|
67
46
|
add_column :decidim_proposals_proposals, :new_title, :string
|
68
47
|
add_column :decidim_proposals_proposals, :new_body, :string
|
69
48
|
|
70
|
-
|
49
|
+
reset_column_information
|
50
|
+
|
51
|
+
Decidim::Proposals::Proposal.find_each do |proposal|
|
71
52
|
proposal.new_title = proposal.title.values.first
|
72
53
|
proposal.new_body = proposal.body.values.first
|
73
54
|
|
@@ -82,6 +63,15 @@ class MoveProposalsFieldsToI18n < ActiveRecord::Migration[5.2]
|
|
82
63
|
rename_column :decidim_proposals_proposals, :new_body, :body
|
83
64
|
|
84
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
|
85
75
|
end
|
86
76
|
|
87
77
|
def remove_indexs
|
@@ -1,35 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class FixProposalsData < ActiveRecord::Migration[5.2]
|
4
|
-
class Proposal < ApplicationRecord
|
5
|
-
self.table_name = :decidim_proposals_proposals
|
6
|
-
end
|
7
|
-
|
8
|
-
class Coauthorship < ApplicationRecord
|
9
|
-
self.table_name = :decidim_coauthorships
|
10
|
-
end
|
11
|
-
|
12
|
-
class UserBaseEntity < ApplicationRecord
|
13
|
-
self.table_name = :decidim_users
|
14
|
-
self.inheritance_column = nil # disable the default inheritance
|
15
|
-
end
|
16
|
-
|
17
|
-
class Organization < ApplicationRecord
|
18
|
-
self.table_name = :decidim_organizations
|
19
|
-
end
|
20
|
-
|
21
4
|
def up
|
5
|
+
reset_column_information
|
6
|
+
|
22
7
|
PaperTrail.request(enabled: false) do
|
23
|
-
Proposal.find_each do |proposal|
|
8
|
+
Decidim::Proposals::Proposal.find_each do |proposal|
|
24
9
|
next if proposal.title.is_a?(Hash) && proposal.body.is_a?(Hash)
|
25
10
|
|
26
|
-
|
27
|
-
author =
|
28
|
-
if coauthorship.decidim_author_type == "Decidim::Organization"
|
29
|
-
Organization.find_by(id: coauthorship.decidim_author_id)
|
30
|
-
else
|
31
|
-
UserBaseEntity.find_by(id: coauthorship.decidim_author_id)
|
32
|
-
end
|
11
|
+
author = proposal.coauthorships.first.author
|
33
12
|
|
34
13
|
locale = author.try(:locale).presence || author.try(:default_locale).presence || author.try(:organization).try(:default_locale).presence
|
35
14
|
|
@@ -42,7 +21,16 @@ class FixProposalsData < ActiveRecord::Migration[5.2]
|
|
42
21
|
# rubocop:enable Rails/SkipsModelValidations
|
43
22
|
end
|
44
23
|
end
|
24
|
+
|
25
|
+
reset_column_information
|
45
26
|
end
|
46
27
|
|
47
28
|
def down; end
|
29
|
+
|
30
|
+
def reset_column_information
|
31
|
+
Decidim::User.reset_column_information
|
32
|
+
Decidim::Coauthorship.reset_column_information
|
33
|
+
Decidim::Proposals::Proposal.reset_column_information
|
34
|
+
Decidim::Organization.reset_column_information
|
35
|
+
end
|
48
36
|
end
|
@@ -28,19 +28,19 @@ Decidim.register_component(:proposals) do |component|
|
|
28
28
|
component.settings(:global) do |settings|
|
29
29
|
settings.attribute :scopes_enabled, type: :boolean, default: false
|
30
30
|
settings.attribute :scope_id, type: :scope
|
31
|
-
settings.attribute :vote_limit, type: :integer, default: 0
|
32
|
-
settings.attribute :minimum_votes_per_user, type: :integer, default: 0
|
33
|
-
settings.attribute :proposal_limit, type: :integer, default: 0
|
31
|
+
settings.attribute :vote_limit, type: :integer, default: 0
|
32
|
+
settings.attribute :minimum_votes_per_user, type: :integer, default: 0
|
33
|
+
settings.attribute :proposal_limit, type: :integer, default: 0
|
34
34
|
settings.attribute :proposal_length, type: :integer, default: 500
|
35
35
|
settings.attribute :proposal_edit_time, type: :enum, default: "limited", choices: -> { %w(limited infinite) }
|
36
|
-
settings.attribute :proposal_edit_before_minutes, type: :integer, default: 5
|
37
|
-
settings.attribute :threshold_per_proposal, type: :integer, default: 0
|
36
|
+
settings.attribute :proposal_edit_before_minutes, type: :integer, default: 5
|
37
|
+
settings.attribute :threshold_per_proposal, type: :integer, default: 0
|
38
38
|
settings.attribute :can_accumulate_supports_beyond_threshold, type: :boolean, default: false
|
39
39
|
settings.attribute :proposal_answering_enabled, type: :boolean, default: true
|
40
40
|
settings.attribute :default_sort_order, type: :select, default: "default", choices: -> { POSSIBLE_SORT_ORDERS }
|
41
41
|
settings.attribute :official_proposals_enabled, type: :boolean, default: true
|
42
42
|
settings.attribute :comments_enabled, type: :boolean, default: true
|
43
|
-
settings.attribute :comments_max_length, type: :integer, required:
|
43
|
+
settings.attribute :comments_max_length, type: :integer, required: false
|
44
44
|
settings.attribute :geocoding_enabled, type: :boolean, default: false
|
45
45
|
settings.attribute :attachments_allowed, type: :boolean, default: false
|
46
46
|
settings.attribute :resources_permissions_enabled, type: :boolean, default: true
|
@@ -131,7 +131,6 @@ Decidim.register_component(:proposals) do |component|
|
|
131
131
|
|
132
132
|
collection = Decidim::Proposals::Proposal
|
133
133
|
.published
|
134
|
-
.not_hidden
|
135
134
|
.where(component: component_instance)
|
136
135
|
.includes(:scope, :category, :component)
|
137
136
|
|
@@ -267,26 +266,31 @@ Decidim.register_component(:proposals) do |component|
|
|
267
266
|
visibility: "all"
|
268
267
|
) do
|
269
268
|
proposal = Decidim::Proposals::Proposal.new(params)
|
270
|
-
|
269
|
+
meeting_component = participatory_space.components.find_by(manifest_name: "meetings")
|
270
|
+
|
271
|
+
coauthor = case n
|
272
|
+
when 0
|
273
|
+
Decidim::User.where(decidim_organization_id: participatory_space.decidim_organization_id).order(Arel.sql("RANDOM()")).first
|
274
|
+
when 1
|
275
|
+
Decidim::UserGroup.where(decidim_organization_id: participatory_space.decidim_organization_id).order(Arel.sql("RANDOM()")).first
|
276
|
+
when 2
|
277
|
+
Decidim::Meetings::Meeting.where(component: meeting_component).order(Arel.sql("RANDOM()")).first
|
278
|
+
else
|
279
|
+
participatory_space.organization
|
280
|
+
end
|
281
|
+
proposal.add_coauthor(coauthor)
|
271
282
|
proposal.save!
|
272
283
|
proposal
|
273
284
|
end
|
274
285
|
|
275
|
-
if n.positive?
|
276
|
-
Decidim::User.where(decidim_organization_id: participatory_space.decidim_organization_id).all.sample(n).each do |author|
|
277
|
-
user_group = [true, false].sample ? Decidim::UserGroups::ManageableUserGroups.for(author).verified.sample : nil
|
278
|
-
proposal.add_coauthor(author, user_group: user_group)
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
286
|
if proposal.state.nil?
|
283
287
|
email = "amendment-author-#{participatory_space.underscored_name}-#{participatory_space.id}-#{n}-amend#{n}@example.org"
|
284
288
|
name = "#{Faker::Name.name} #{participatory_space.id} #{n} amend#{n}"
|
285
289
|
|
286
290
|
author = Decidim::User.find_or_initialize_by(email: email)
|
287
291
|
author.update!(
|
288
|
-
password: "
|
289
|
-
password_confirmation: "
|
292
|
+
password: "decidim123456789",
|
293
|
+
password_confirmation: "decidim123456789",
|
290
294
|
name: name,
|
291
295
|
nickname: Faker::Twitter.unique.screen_name,
|
292
296
|
organization: component.organization,
|
@@ -351,8 +355,8 @@ Decidim.register_component(:proposals) do |component|
|
|
351
355
|
|
352
356
|
author = Decidim::User.find_or_initialize_by(email: email)
|
353
357
|
author.update!(
|
354
|
-
password: "
|
355
|
-
password_confirmation: "
|
358
|
+
password: "decidim123456789",
|
359
|
+
password_confirmation: "decidim123456789",
|
356
360
|
name: name,
|
357
361
|
nickname: Faker::Twitter.unique.screen_name,
|
358
362
|
organization: component.organization,
|
@@ -373,8 +377,8 @@ Decidim.register_component(:proposals) do |component|
|
|
373
377
|
|
374
378
|
author = Decidim::User.find_or_initialize_by(email: email)
|
375
379
|
author.update!(
|
376
|
-
password: "
|
377
|
-
password_confirmation: "
|
380
|
+
password: "decidim123456789",
|
381
|
+
password_confirmation: "decidim123456789",
|
378
382
|
name: name,
|
379
383
|
nickname: Faker::Twitter.unique.screen_name,
|
380
384
|
organization: component.organization,
|
@@ -90,12 +90,6 @@ module Decidim
|
|
90
90
|
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Proposals::Engine.root}/app/views") # for proposal partials
|
91
91
|
end
|
92
92
|
|
93
|
-
initializer "decidim_proposals.remove_space_admins" do
|
94
|
-
ActiveSupport::Notifications.subscribe("decidim.system.participatory_space.admin.destroyed") do |_event_name, klass, id|
|
95
|
-
Decidim::Proposals::ValuationAssignment.where(valuator_role_type: klass, valuator_role_id: id).destroy_all
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
93
|
initializer "decidim_proposals.add_badges" do
|
100
94
|
Decidim::Gamification.register_badge(:proposals) do |badge|
|
101
95
|
badge.levels = [1, 5, 10, 30, 60]
|
@@ -32,16 +32,13 @@ module Decidim
|
|
32
32
|
resource,
|
33
33
|
current_user
|
34
34
|
) do
|
35
|
-
resource.
|
35
|
+
resource.save!
|
36
36
|
end
|
37
|
-
|
38
|
-
notify
|
37
|
+
notify(resource)
|
39
38
|
end
|
40
39
|
|
41
40
|
private
|
42
41
|
|
43
|
-
attr_reader :initial_state
|
44
|
-
|
45
42
|
def resource
|
46
43
|
@resource ||= fetch_resource
|
47
44
|
end
|
@@ -58,8 +55,6 @@ module Decidim
|
|
58
55
|
|
59
56
|
proposal.answer = answer
|
60
57
|
proposal.answered_at = Time.current
|
61
|
-
@initial_state = proposal.state
|
62
|
-
|
63
58
|
if POSSIBLE_ANSWER_STATES.include?(state)
|
64
59
|
proposal.state = state
|
65
60
|
proposal.state_published_at = Time.current if component.current_settings.publish_answers_immediately?
|
@@ -93,9 +88,8 @@ module Decidim
|
|
93
88
|
context[:current_user]
|
94
89
|
end
|
95
90
|
|
96
|
-
def notify
|
97
|
-
|
98
|
-
::Decidim::Proposals::Admin::NotifyProposalAnswer.call(resource, state)
|
91
|
+
def notify(proposal)
|
92
|
+
::Decidim::Proposals::Admin::NotifyProposalAnswer.call(proposal, proposal.state)
|
99
93
|
end
|
100
94
|
end
|
101
95
|
end
|
@@ -8,7 +8,6 @@ module Decidim
|
|
8
8
|
include Decidim::ApplicationHelper
|
9
9
|
include Decidim::ResourceHelper
|
10
10
|
include Decidim::TranslationsHelper
|
11
|
-
include HtmlToPlainText
|
12
11
|
|
13
12
|
# Public: Initializes the serializer with a proposal.
|
14
13
|
def initialize(proposal)
|
@@ -33,7 +32,7 @@ module Decidim
|
|
33
32
|
},
|
34
33
|
component: { id: component.id },
|
35
34
|
title: proposal.title,
|
36
|
-
body:
|
35
|
+
body: proposal.body,
|
37
36
|
address: proposal.address,
|
38
37
|
latitude: proposal.latitude,
|
39
38
|
longitude: proposal.longitude,
|
@@ -94,13 +93,6 @@ module Decidim
|
|
94
93
|
|
95
94
|
Decidim::ResourceLocatorPresenter.new(proposal.amendable).url
|
96
95
|
end
|
97
|
-
|
98
|
-
# Recursively strips HTML tags from given Hash strings using convert_to_text from Premailer
|
99
|
-
def convert_to_plain_text(value)
|
100
|
-
return value.transform_values { |v| convert_to_plain_text(v) } if value.is_a?(Hash)
|
101
|
-
|
102
|
-
convert_to_text(value)
|
103
|
-
end
|
104
96
|
end
|
105
97
|
end
|
106
98
|
end
|
@@ -305,7 +305,7 @@ FactoryBot.define do
|
|
305
305
|
published_at { nil }
|
306
306
|
end
|
307
307
|
|
308
|
-
trait :
|
308
|
+
trait :participant_author do
|
309
309
|
after :build do |proposal|
|
310
310
|
proposal.coauthorships.clear
|
311
311
|
user = build(:user, organization: proposal.component.participatory_space.organization)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-proposals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.27.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-comments
|
@@ -18,42 +18,42 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.27.0.rc1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.27.0.rc1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: decidim-core
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.27.0.rc1
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.27.0.rc1
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: doc2text
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.4.
|
49
|
+
version: 0.4.5
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.4.
|
56
|
+
version: 0.4.5
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: redcarpet
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,98 +80,84 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
83
|
+
version: 0.27.0.rc1
|
84
84
|
type: :development
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.
|
90
|
+
version: 0.27.0.rc1
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: decidim-assemblies
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.
|
97
|
+
version: 0.27.0.rc1
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - '='
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 0.
|
104
|
+
version: 0.27.0.rc1
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: decidim-budgets
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - '='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 0.
|
111
|
+
version: 0.27.0.rc1
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - '='
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 0.
|
119
|
-
- !ruby/object:Gem::Dependency
|
120
|
-
name: decidim-conference
|
121
|
-
requirement: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - '='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 0.26.8
|
126
|
-
type: :development
|
127
|
-
prerelease: false
|
128
|
-
version_requirements: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - '='
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: 0.26.8
|
118
|
+
version: 0.27.0.rc1
|
133
119
|
- !ruby/object:Gem::Dependency
|
134
120
|
name: decidim-dev
|
135
121
|
requirement: !ruby/object:Gem::Requirement
|
136
122
|
requirements:
|
137
123
|
- - '='
|
138
124
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.
|
125
|
+
version: 0.27.0.rc1
|
140
126
|
type: :development
|
141
127
|
prerelease: false
|
142
128
|
version_requirements: !ruby/object:Gem::Requirement
|
143
129
|
requirements:
|
144
130
|
- - '='
|
145
131
|
- !ruby/object:Gem::Version
|
146
|
-
version: 0.
|
132
|
+
version: 0.27.0.rc1
|
147
133
|
- !ruby/object:Gem::Dependency
|
148
134
|
name: decidim-meetings
|
149
135
|
requirement: !ruby/object:Gem::Requirement
|
150
136
|
requirements:
|
151
137
|
- - '='
|
152
138
|
- !ruby/object:Gem::Version
|
153
|
-
version: 0.
|
139
|
+
version: 0.27.0.rc1
|
154
140
|
type: :development
|
155
141
|
prerelease: false
|
156
142
|
version_requirements: !ruby/object:Gem::Requirement
|
157
143
|
requirements:
|
158
144
|
- - '='
|
159
145
|
- !ruby/object:Gem::Version
|
160
|
-
version: 0.
|
146
|
+
version: 0.27.0.rc1
|
161
147
|
- !ruby/object:Gem::Dependency
|
162
148
|
name: decidim-participatory_processes
|
163
149
|
requirement: !ruby/object:Gem::Requirement
|
164
150
|
requirements:
|
165
151
|
- - '='
|
166
152
|
- !ruby/object:Gem::Version
|
167
|
-
version: 0.
|
153
|
+
version: 0.27.0.rc1
|
168
154
|
type: :development
|
169
155
|
prerelease: false
|
170
156
|
version_requirements: !ruby/object:Gem::Requirement
|
171
157
|
requirements:
|
172
158
|
- - '='
|
173
159
|
- !ruby/object:Gem::Version
|
174
|
-
version: 0.
|
160
|
+
version: 0.27.0.rc1
|
175
161
|
description: A proposals component for decidim's participatory spaces.
|
176
162
|
email:
|
177
163
|
- josepjaume@gmail.com
|
@@ -375,7 +361,6 @@ files:
|
|
375
361
|
- app/queries/decidim/proposals/metrics/proposals_metric_manage.rb
|
376
362
|
- app/queries/decidim/proposals/metrics/votes_metric_manage.rb
|
377
363
|
- app/queries/decidim/proposals/similar_proposals.rb
|
378
|
-
- app/services/decidim/proposals/collaborative_draft_search.rb
|
379
364
|
- app/services/decidim/proposals/diff_renderer.rb
|
380
365
|
- app/services/decidim/proposals/proposal_builder.rb
|
381
366
|
- app/services/decidim/proposals/proposal_search.rb
|
@@ -390,7 +375,6 @@ files:
|
|
390
375
|
- app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb
|
391
376
|
- app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb
|
392
377
|
- app/views/decidim/proposals/admin/proposals/_form.html.erb
|
393
|
-
- app/views/decidim/proposals/admin/proposals/_js-callout.html.erb
|
394
378
|
- app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb
|
395
379
|
- app/views/decidim/proposals/admin/proposals/bulk_actions/_assign_to_valuator.html.erb
|
396
380
|
- app/views/decidim/proposals/admin/proposals/bulk_actions/_dropdown.html.erb
|
@@ -405,8 +389,7 @@ files:
|
|
405
389
|
- app/views/decidim/proposals/admin/proposals/new.html.erb
|
406
390
|
- app/views/decidim/proposals/admin/proposals/publish_answers.js.erb
|
407
391
|
- app/views/decidim/proposals/admin/proposals/show.html.erb
|
408
|
-
- app/views/decidim/proposals/admin/proposals/
|
409
|
-
- app/views/decidim/proposals/admin/proposals/update_scope.js.erb
|
392
|
+
- app/views/decidim/proposals/admin/proposals/update_attribute.js.erb
|
410
393
|
- app/views/decidim/proposals/admin/proposals_imports/new.html.erb
|
411
394
|
- app/views/decidim/proposals/collaborative_drafts/_accept_request_access_form.html.erb
|
412
395
|
- app/views/decidim/proposals/collaborative_drafts/_collaborative_drafts.html.erb
|
@@ -461,7 +444,6 @@ files:
|
|
461
444
|
- app/views/decidim/proposals/versions/show.html.erb
|
462
445
|
- config/assets.rb
|
463
446
|
- config/brakeman.ignore
|
464
|
-
- config/environment.rb
|
465
447
|
- config/locales/am-ET.yml
|
466
448
|
- config/locales/ar-SA.yml
|
467
449
|
- config/locales/ar.yml
|
@@ -484,7 +466,6 @@ files:
|
|
484
466
|
- config/locales/et-EE.yml
|
485
467
|
- config/locales/et.yml
|
486
468
|
- config/locales/eu.yml
|
487
|
-
- config/locales/fa-IR.yml
|
488
469
|
- config/locales/fi-pl.yml
|
489
470
|
- config/locales/fi-plain.yml
|
490
471
|
- config/locales/fi.yml
|
@@ -493,7 +474,6 @@ files:
|
|
493
474
|
- config/locales/fr.yml
|
494
475
|
- config/locales/ga-IE.yml
|
495
476
|
- config/locales/gl.yml
|
496
|
-
- config/locales/gn-PY.yml
|
497
477
|
- config/locales/hr-HR.yml
|
498
478
|
- config/locales/hr.yml
|
499
479
|
- config/locales/hu.yml
|
@@ -502,13 +482,10 @@ files:
|
|
502
482
|
- config/locales/is.yml
|
503
483
|
- config/locales/it.yml
|
504
484
|
- config/locales/ja.yml
|
505
|
-
- config/locales/ka-GE.yml
|
506
|
-
- config/locales/kaa.yml
|
507
485
|
- config/locales/ko-KR.yml
|
508
486
|
- config/locales/ko.yml
|
509
487
|
- config/locales/lb-LU.yml
|
510
488
|
- config/locales/lb.yml
|
511
|
-
- config/locales/lo-LA.yml
|
512
489
|
- config/locales/lt-LT.yml
|
513
490
|
- config/locales/lt.yml
|
514
491
|
- config/locales/lv.yml
|
@@ -516,7 +493,6 @@ files:
|
|
516
493
|
- config/locales/mt.yml
|
517
494
|
- config/locales/nl.yml
|
518
495
|
- config/locales/no.yml
|
519
|
-
- config/locales/oc-FR.yml
|
520
496
|
- config/locales/om-ET.yml
|
521
497
|
- config/locales/pl.yml
|
522
498
|
- config/locales/pt-BR.yml
|
@@ -622,7 +598,6 @@ files:
|
|
622
598
|
- lib/decidim/proposals/test/factories.rb
|
623
599
|
- lib/decidim/proposals/valuatable.rb
|
624
600
|
- lib/decidim/proposals/version.rb
|
625
|
-
- lib/tasks/proposals/upgrade/decdim_proposal_upgrade_tasks.rake
|
626
601
|
homepage: https://github.com/decidim/decidim
|
627
602
|
licenses:
|
628
603
|
- AGPL-3.0
|
@@ -635,14 +610,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
635
610
|
requirements:
|
636
611
|
- - ">="
|
637
612
|
- !ruby/object:Gem::Version
|
638
|
-
version: '
|
613
|
+
version: '3.0'
|
639
614
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
640
615
|
requirements:
|
641
|
-
- - "
|
616
|
+
- - ">"
|
642
617
|
- !ruby/object:Gem::Version
|
643
|
-
version:
|
618
|
+
version: 1.3.1
|
644
619
|
requirements: []
|
645
|
-
rubygems_version: 3.
|
620
|
+
rubygems_version: 3.2.22
|
646
621
|
signing_key:
|
647
622
|
specification_version: 4
|
648
623
|
summary: Decidim proposals module
|