decidim-proposals 0.10.1 → 0.11.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +3 -3
  4. data/app/assets/javascripts/decidim/proposals/admin/proposals.es6 +6 -7
  5. data/app/assets/javascripts/decidim/proposals/identity_selector_dialog.js.es6 +17 -17
  6. data/app/assets/javascripts/decidim/proposals/utils.js.es6 +2 -2
  7. data/app/commands/decidim/proposals/admin/create_proposal.rb +2 -2
  8. data/app/commands/decidim/proposals/admin/import_proposals.rb +16 -8
  9. data/app/commands/decidim/proposals/create_proposal.rb +6 -6
  10. data/app/commands/decidim/proposals/destroy_proposal.rb +33 -0
  11. data/app/commands/decidim/proposals/update_proposal.rb +4 -4
  12. data/app/controllers/decidim/proposals/admin/application_controller.rb +2 -2
  13. data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +1 -1
  14. data/app/controllers/decidim/proposals/admin/proposal_notes_controller.rb +1 -1
  15. data/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -2
  16. data/app/controllers/decidim/proposals/admin/proposals_imports_controller.rb +4 -4
  17. data/app/controllers/decidim/proposals/application_controller.rb +5 -5
  18. data/app/controllers/decidim/proposals/proposal_endorsements_controller.rb +1 -1
  19. data/app/controllers/decidim/proposals/proposal_votes_controller.rb +1 -1
  20. data/app/controllers/decidim/proposals/proposal_widgets_controller.rb +1 -1
  21. data/app/controllers/decidim/proposals/proposals_controller.rb +52 -24
  22. data/app/events/decidim/proposals/proposal_mentioned_event.rb +19 -0
  23. data/app/forms/decidim/proposals/admin/proposal_form.rb +3 -3
  24. data/app/forms/decidim/proposals/admin/proposals_import_form.rb +9 -9
  25. data/app/forms/decidim/proposals/proposal_form.rb +5 -4
  26. data/app/helpers/decidim/proposals/application_helper.rb +38 -3
  27. data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +7 -3
  28. data/app/helpers/decidim/proposals/proposal_votes_helper.rb +9 -9
  29. data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +2 -1
  30. data/app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb +28 -0
  31. data/app/jobs/decidim/proposals/settings_change_job.rb +4 -4
  32. data/app/models/decidim/proposals/abilities/admin_ability.rb +4 -4
  33. data/app/models/decidim/proposals/abilities/current_user_ability.rb +12 -12
  34. data/app/models/decidim/proposals/abilities/participatory_process_admin_ability.rb +8 -8
  35. data/app/models/decidim/proposals/abilities/participatory_process_moderator_ability.rb +1 -1
  36. data/app/models/decidim/proposals/proposal.rb +7 -7
  37. data/app/models/decidim/proposals/proposal_endorsement.rb +6 -2
  38. data/app/presenters/decidim/proposals/proposal_presenter.rb +12 -0
  39. data/app/queries/decidim/proposals/filtered_proposals.rb +9 -9
  40. data/app/queries/decidim/proposals/similar_proposals.rb +9 -9
  41. data/app/services/decidim/proposals/proposal_search.rb +1 -1
  42. data/app/types/decidim/proposals/proposal_type.rb +17 -2
  43. data/app/types/decidim/proposals/proposals_type.rb +6 -6
  44. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_proposals.html.erb +1 -1
  45. data/app/views/decidim/participatory_processes/participatory_process_groups/_proposal.html.erb +1 -1
  46. data/app/views/decidim/participatory_spaces/_highlighted_proposals.html.erb +2 -2
  47. data/app/views/decidim/participatory_spaces/_proposal.html.erb +1 -1
  48. data/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +3 -3
  49. data/app/views/decidim/proposals/admin/proposal_notes/_form.html.erb +2 -2
  50. data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +3 -3
  51. data/app/views/decidim/proposals/admin/proposal_notes/index.html.erb +1 -1
  52. data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +2 -2
  53. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +3 -3
  54. data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +1 -1
  55. data/app/views/decidim/proposals/admin/proposals/index.html.erb +1 -1
  56. data/app/views/decidim/proposals/admin/proposals/new.html.erb +2 -2
  57. data/app/views/decidim/proposals/admin/proposals/update_category.js.erb +3 -3
  58. data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +3 -3
  59. data/app/views/decidim/proposals/admin/shared/_info_proposal.html.erb +1 -1
  60. data/app/views/decidim/proposals/proposal_endorsements/_identity.html.erb +2 -2
  61. data/app/views/decidim/proposals/proposal_endorsements/identities.html.erb +2 -2
  62. data/app/views/decidim/proposals/proposal_endorsements/update_buttons_and_counters.js.erb +19 -8
  63. data/app/views/decidim/proposals/proposals/_endorsement_button.html.erb +2 -2
  64. data/app/views/decidim/proposals/proposals/_endorsement_identities_cabin.html.erb +3 -3
  65. data/app/views/decidim/proposals/proposals/_endorsements_card_row.html.erb +4 -4
  66. data/app/views/decidim/proposals/proposals/_endorsements_count.html.erb +2 -2
  67. data/app/views/decidim/proposals/proposals/_filters.html.erb +10 -10
  68. data/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +1 -1
  69. data/app/views/decidim/proposals/proposals/_identities_listing.html.erb +30 -0
  70. data/app/views/decidim/proposals/proposals/{_endorsement_xxs.html.erb → _identity_xxs.html.erb} +1 -2
  71. data/app/views/decidim/proposals/proposals/_proposal.html.erb +2 -2
  72. data/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +1 -1
  73. data/app/views/decidim/proposals/proposals/_tags.html.erb +25 -0
  74. data/app/views/decidim/proposals/proposals/_vote_button.html.erb +7 -7
  75. data/app/views/decidim/proposals/proposals/_votes_count.html.erb +6 -5
  76. data/app/views/decidim/proposals/proposals/_voting_rules.html.erb +7 -7
  77. data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +5 -5
  78. data/app/views/decidim/proposals/proposals/compare.html.erb +1 -1
  79. data/app/views/decidim/proposals/proposals/complete.html.erb +70 -0
  80. data/app/views/decidim/proposals/proposals/edit.html.erb +3 -3
  81. data/app/views/decidim/proposals/proposals/edit_draft.html.erb +5 -3
  82. data/app/views/decidim/proposals/proposals/index.html.erb +5 -5
  83. data/app/views/decidim/proposals/proposals/new.html.erb +1 -43
  84. data/app/views/decidim/proposals/proposals/preview.html.erb +1 -1
  85. data/app/views/decidim/proposals/proposals/show.html.erb +16 -23
  86. data/config/locales/ca.yml +69 -55
  87. data/config/locales/en.yml +64 -50
  88. data/config/locales/es.yml +73 -59
  89. data/config/locales/eu.yml +64 -50
  90. data/config/locales/fi.yml +64 -50
  91. data/config/locales/fr.yml +75 -61
  92. data/config/locales/gl.yml +64 -50
  93. data/config/locales/it.yml +64 -50
  94. data/config/locales/nl.yml +153 -139
  95. data/config/locales/pl.yml +64 -50
  96. data/config/locales/pt-BR.yml +64 -50
  97. data/config/locales/pt.yml +64 -50
  98. data/config/locales/ru.yml +0 -9
  99. data/config/locales/sv.yml +64 -50
  100. data/config/locales/uk.yml +2 -16
  101. data/db/migrate/20171212102250_enable_pg_extensions.rb +12 -1
  102. data/db/migrate/20180305133811_rename_features_to_components_at_proposals.rb +11 -0
  103. data/db/migrate/20180413135249_fix_nil_threshold_per_proposal.rb +18 -0
  104. data/lib/decidim/content_parsers/proposal_parser.rb +95 -0
  105. data/lib/decidim/content_renderers/proposal_renderer.rb +33 -0
  106. data/lib/decidim/proposals.rb +9 -1
  107. data/lib/decidim/proposals/commentable_proposal.rb +3 -3
  108. data/lib/decidim/proposals/{feature.rb → component.rb} +39 -38
  109. data/lib/decidim/proposals/engine.rb +21 -6
  110. data/lib/decidim/proposals/proposal_serializer.rb +3 -3
  111. data/lib/decidim/proposals/test/factories.rb +5 -8
  112. data/lib/decidim/proposals/version.rb +1 -1
  113. metadata +32 -23
  114. data/app/views/decidim/proposals/proposals/_endorsements_listing.html.erb +0 -34
@@ -3,7 +3,7 @@
3
3
  require "decidim/proposals/admin"
4
4
  require "decidim/proposals/engine"
5
5
  require "decidim/proposals/admin_engine"
6
- require "decidim/proposals/feature"
6
+ require "decidim/proposals/component"
7
7
 
8
8
  module Decidim
9
9
  # This namespace holds the logic of the `Proposals` component. This component
@@ -38,4 +38,12 @@ module Decidim
38
38
  3
39
39
  end
40
40
  end
41
+
42
+ module ContentParsers
43
+ autoload :ProposalParser, "decidim/content_parsers/proposal_parser"
44
+ end
45
+
46
+ module ContentRenderers
47
+ autoload :ProposalRenderer, "decidim/content_renderers/proposal_renderer"
48
+ end
41
49
  end
@@ -10,12 +10,12 @@ module Decidim
10
10
  included do
11
11
  # Public: Overrides the `commentable?` Commentable concern method.
12
12
  def commentable?
13
- feature.settings.comments_enabled?
13
+ component.settings.comments_enabled?
14
14
  end
15
15
 
16
16
  # Public: Overrides the `accepts_new_comments?` Commentable concern method.
17
17
  def accepts_new_comments?
18
- commentable? && !feature.current_settings.comments_blocked
18
+ commentable? && !component.current_settings.comments_blocked
19
19
  end
20
20
 
21
21
  # Public: Overrides the `comments_have_alignment?` Commentable concern method.
@@ -30,7 +30,7 @@ module Decidim
30
30
 
31
31
  # Public: Override Commentable concern method `users_to_notify_on_comment_created`
32
32
  def users_to_notify_on_comment_created
33
- return (followers | feature.participatory_space.admins).uniq if official?
33
+ return (followers | component.participatory_space.admins).uniq if official?
34
34
  followers
35
35
  end
36
36
  end
@@ -1,21 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "decidim/features/namer"
3
+ require "decidim/components/namer"
4
4
 
5
- Decidim.register_feature(:proposals) do |feature|
6
- feature.engine = Decidim::Proposals::Engine
7
- feature.admin_engine = Decidim::Proposals::AdminEngine
8
- feature.icon = "decidim/proposals/icon.svg"
5
+ Decidim.register_component(:proposals) do |component|
6
+ component.engine = Decidim::Proposals::Engine
7
+ component.admin_engine = Decidim::Proposals::AdminEngine
8
+ component.icon = "decidim/proposals/icon.svg"
9
9
 
10
- feature.on(:before_destroy) do |instance|
11
- raise "Can't destroy this feature when there are proposals" if Decidim::Proposals::Proposal.where(feature: instance).any?
10
+ component.on(:before_destroy) do |instance|
11
+ raise "Can't destroy this component when there are proposals" if Decidim::Proposals::Proposal.where(component: instance).any?
12
12
  end
13
13
 
14
- feature.actions = %w(endorse vote create withdraw)
14
+ component.actions = %w(endorse vote create withdraw)
15
15
 
16
- feature.query_type = "Decidim::Proposals::ProposalsType"
16
+ component.query_type = "Decidim::Proposals::ProposalsType"
17
17
 
18
- feature.settings(:global) do |settings|
18
+ component.settings(:global) do |settings|
19
19
  settings.attribute :vote_limit, type: :integer, default: 0
20
20
  settings.attribute :proposal_limit, type: :integer, default: 0
21
21
  settings.attribute :proposal_length, type: :integer, default: 500
@@ -32,9 +32,10 @@ Decidim.register_feature(:proposals) do |feature|
32
32
  settings.attribute :proposal_wizard_step_1_help_text, type: :text, translated: true, editor: true
33
33
  settings.attribute :proposal_wizard_step_2_help_text, type: :text, translated: true, editor: true
34
34
  settings.attribute :proposal_wizard_step_3_help_text, type: :text, translated: true, editor: true
35
+ settings.attribute :proposal_wizard_step_4_help_text, type: :text, translated: true, editor: true
35
36
  end
36
37
 
37
- feature.settings(:step) do |settings|
38
+ component.settings(:step) do |settings|
38
39
  settings.attribute :endorsements_enabled, type: :boolean, default: true
39
40
  settings.attribute :endorsements_blocked, type: :boolean
40
41
  settings.attribute :votes_enabled, type: :boolean
@@ -46,63 +47,63 @@ Decidim.register_feature(:proposals) do |feature|
46
47
  settings.attribute :announcement, type: :text, translated: true, editor: true
47
48
  end
48
49
 
49
- feature.register_resource do |resource|
50
+ component.register_resource do |resource|
50
51
  resource.model_class_name = "Decidim::Proposals::Proposal"
51
52
  resource.template = "decidim/proposals/proposals/linked_proposals"
52
53
  end
53
54
 
54
- feature.register_stat :proposals_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |features, start_at, end_at|
55
- Decidim::Proposals::FilteredProposals.for(features, start_at, end_at).published.not_hidden.count
55
+ component.register_stat :proposals_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, start_at, end_at|
56
+ Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).published.except_withdrawn.not_hidden.count
56
57
  end
57
58
 
58
- feature.register_stat :proposals_accepted, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |features, start_at, end_at|
59
- Decidim::Proposals::FilteredProposals.for(features, start_at, end_at).accepted.count
59
+ component.register_stat :proposals_accepted, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, start_at, end_at|
60
+ Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).accepted.count
60
61
  end
61
62
 
62
- feature.register_stat :votes_count, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |features, start_at, end_at|
63
- proposals = Decidim::Proposals::FilteredProposals.for(features, start_at, end_at).published.not_hidden
63
+ component.register_stat :votes_count, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, start_at, end_at|
64
+ proposals = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).published.not_hidden
64
65
  Decidim::Proposals::ProposalVote.where(proposal: proposals).count
65
66
  end
66
67
 
67
- feature.register_stat :endorsements_count, priority: Decidim::StatsRegistry::MEDIUM_PRIORITY do |features, start_at, end_at|
68
- proposals = Decidim::Proposals::FilteredProposals.for(features, start_at, end_at).not_hidden
68
+ component.register_stat :endorsements_count, priority: Decidim::StatsRegistry::MEDIUM_PRIORITY do |components, start_at, end_at|
69
+ proposals = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).not_hidden
69
70
  Decidim::Proposals::ProposalEndorsement.where(proposal: proposals).count
70
71
  end
71
72
 
72
- feature.register_stat :comments_count, tag: :comments do |features, start_at, end_at|
73
- proposals = Decidim::Proposals::FilteredProposals.for(features, start_at, end_at).published.not_hidden
73
+ component.register_stat :comments_count, tag: :comments do |components, start_at, end_at|
74
+ proposals = Decidim::Proposals::FilteredProposals.for(components, start_at, end_at).published.not_hidden
74
75
  Decidim::Comments::Comment.where(root_commentable: proposals).count
75
76
  end
76
77
 
77
- feature.exports :proposals do |exports|
78
- exports.collection do |feature_instance|
78
+ component.exports :proposals do |exports|
79
+ exports.collection do |component_instance|
79
80
  Decidim::Proposals::Proposal
80
- .where(feature: feature_instance)
81
- .includes(:category, feature: { participatory_space: :organization })
81
+ .where(component: component_instance)
82
+ .includes(:category, component: { participatory_space: :organization })
82
83
  end
83
84
 
84
85
  exports.serializer Decidim::Proposals::ProposalSerializer
85
86
  end
86
87
 
87
- feature.exports :comments do |exports|
88
- exports.collection do |feature_instance|
88
+ component.exports :comments do |exports|
89
+ exports.collection do |component_instance|
89
90
  Decidim::Comments::Export.comments_for_resource(
90
- Decidim::Proposals::Proposal, feature_instance
91
+ Decidim::Proposals::Proposal, component_instance
91
92
  )
92
93
  end
93
94
 
94
95
  exports.serializer Decidim::Comments::CommentSerializer
95
96
  end
96
97
 
97
- feature.seeds do |participatory_space|
98
+ component.seeds do |participatory_space|
98
99
  step_settings = if participatory_space.allows_steps?
99
100
  { participatory_space.active_step.id => { votes_enabled: true, votes_blocked: false, creation_enabled: true } }
100
101
  else
101
102
  {}
102
103
  end
103
104
 
104
- feature = Decidim::Feature.create!(
105
- name: Decidim::Features::Namer.new(participatory_space.organization.available_locales, :proposals).i18n_name,
105
+ component = Decidim::Component.create!(
106
+ name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :proposals).i18n_name,
106
107
  manifest_name: :proposals,
107
108
  published_at: Time.current,
108
109
  participatory_space: participatory_space,
@@ -121,7 +122,7 @@ Decidim.register_feature(:proposals) do |feature|
121
122
  end
122
123
 
123
124
  5.times do |n|
124
- author = Decidim::User.where(organization: feature.organization).all.sample
125
+ author = Decidim::User.where(organization: component.organization).all.sample
125
126
  user_group = [true, false].sample ? author.user_groups.verified.sample : nil
126
127
  state, answer = if n > 3
127
128
  ["accepted", Decidim::Faker::Localized.sentence(10)]
@@ -134,7 +135,7 @@ Decidim.register_feature(:proposals) do |feature|
134
135
  end
135
136
 
136
137
  proposal = Decidim::Proposals::Proposal.create!(
137
- feature: feature,
138
+ component: component,
138
139
  category: participatory_space.categories.sample,
139
140
  scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
140
141
  title: Faker::Lorem.sentence(2),
@@ -157,7 +158,7 @@ Decidim.register_feature(:proposals) do |feature|
157
158
  password_confirmation: "password1234",
158
159
  name: name,
159
160
  nickname: Faker::Twitter.unique.screen_name,
160
- organization: feature.organization,
161
+ organization: component.organization,
161
162
  tos_agreement: "1",
162
163
  confirmed_at: Time.current,
163
164
  personal_url: Faker::Internet.url,
@@ -178,7 +179,7 @@ Decidim.register_feature(:proposals) do |feature|
178
179
  password_confirmation: "password1234",
179
180
  name: name,
180
181
  nickname: Faker::Twitter.unique.screen_name,
181
- organization: feature.organization,
182
+ organization: component.organization,
182
183
  tos_agreement: "1",
183
184
  confirmed_at: Time.current
184
185
  )
@@ -187,7 +188,7 @@ Decidim.register_feature(:proposals) do |feature|
187
188
  name: Faker::Name.name,
188
189
  document_number: Faker::Code.isbn,
189
190
  phone: Faker::PhoneNumber.phone_number,
190
- decidim_organization_id: feature.organization.id,
191
+ decidim_organization_id: component.organization.id,
191
192
  verified_at: Time.current
192
193
  )
193
194
  author.user_groups << group
@@ -198,7 +199,7 @@ Decidim.register_feature(:proposals) do |feature|
198
199
  end
199
200
 
200
201
  (n % 3).times do
201
- author_admin = Decidim::User.where(organization: feature.organization, admin: true).all.sample
202
+ author_admin = Decidim::User.where(organization: component.organization, admin: true).all.sample
202
203
 
203
204
  Decidim::Proposals::ProposalNote.create!(
204
205
  proposal: proposal,
@@ -17,12 +17,14 @@ module Decidim
17
17
  resource :proposal_endorsement, only: [:create, :destroy] do
18
18
  get :identities, on: :collection
19
19
  end
20
+ get :compare, on: :collection
21
+ get :complete, on: :collection
20
22
  member do
21
- get :compare
22
23
  get :edit_draft
23
24
  patch :update_draft
24
25
  get :preview
25
26
  post :publish
27
+ delete :destroy_draft
26
28
  put :withdraw
27
29
  end
28
30
  resource :proposal_vote, only: [:create, :destroy]
@@ -43,11 +45,17 @@ module Decidim
43
45
  end
44
46
  end
45
47
 
48
+ initializer "decidim.content_processors" do |_app|
49
+ Decidim.configure do |config|
50
+ config.content_processors += [:proposal]
51
+ end
52
+ end
53
+
46
54
  initializer "decidim_proposals.view_hooks" do
47
55
  Decidim.view_hooks.register(:participatory_space_highlighted_elements, priority: Decidim::ViewHooks::MEDIUM_PRIORITY) do |view_context|
48
- published_features = Decidim::Feature.where(participatory_space: view_context.current_participatory_space).published
56
+ published_components = Decidim::Component.where(participatory_space: view_context.current_participatory_space).published
49
57
  proposals = Decidim::Proposals::Proposal.published.not_hidden.except_withdrawn
50
- .where(feature: published_features)
58
+ .where(component: published_components)
51
59
  .order_randomly(rand * 2 - 1)
52
60
  .limit(Decidim::Proposals.config.participatory_space_highlighted_proposals_limit)
53
61
 
@@ -64,9 +72,9 @@ module Decidim
64
72
 
65
73
  if defined? Decidim::ParticipatoryProcesses
66
74
  Decidim::ParticipatoryProcesses.view_hooks.register(:process_group_highlighted_elements, priority: Decidim::ViewHooks::MEDIUM_PRIORITY) do |view_context|
67
- published_features = Decidim::Feature.where(participatory_space: view_context.participatory_processes).published
75
+ published_components = Decidim::Component.where(participatory_space: view_context.participatory_processes).published
68
76
  proposals = Decidim::Proposals::Proposal.published.not_hidden.except_withdrawn
69
- .where(feature: published_features)
77
+ .where(component: published_components)
70
78
  .order_randomly(rand * 2 - 1)
71
79
  .limit(Decidim::Proposals.config.process_group_highlighted_proposals_limit)
72
80
 
@@ -87,13 +95,20 @@ module Decidim
87
95
  initializer "decidim_changes" do
88
96
  Decidim::SettingsChange.subscribe "surveys" do |changes|
89
97
  Decidim::Proposals::SettingsChangeJob.perform_later(
90
- changes[:feature_id],
98
+ changes[:component_id],
91
99
  changes[:previous_settings],
92
100
  changes[:current_settings]
93
101
  )
94
102
  end
95
103
  end
96
104
 
105
+ initializer "decidim_proposals.mentions_listener" do
106
+ Decidim::Comments::CommentCreation.subscribe do |data|
107
+ metadata = data[:metadatas][:proposals]
108
+ Decidim::Proposals::NotifyProposalsMentionedJob.perform_later(data[:comment_id], metadata)
109
+ end
110
+ end
111
+
97
112
  # Subscribes to ActiveSupport::Notifications that may affect a Proposal.
98
113
  initializer "decidim_proposals.subscribe_to_events" do
99
114
  # when a proposal is linked from a result
@@ -30,7 +30,7 @@ module Decidim
30
30
  comments: @proposal.comments.count,
31
31
  created_at: @proposal.created_at,
32
32
  url: url,
33
- feature: { id: feature.id },
33
+ component: { id: component.id },
34
34
  meeting_urls: meetings
35
35
  }
36
36
  end
@@ -39,8 +39,8 @@ module Decidim
39
39
 
40
40
  attr_reader :proposal
41
41
 
42
- def feature
43
- proposal.feature
42
+ def component
43
+ proposal.component
44
44
  end
45
45
 
46
46
  def meetings
@@ -4,8 +4,8 @@ require "decidim/core/test/factories"
4
4
  require "decidim/participatory_processes/test/factories"
5
5
 
6
6
  FactoryBot.define do
7
- factory :proposal_feature, parent: :feature do
8
- name { Decidim::Features::Namer.new(participatory_space.organization.available_locales, :proposals).i18n_name }
7
+ factory :proposal_component, parent: :component do
8
+ name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :proposals).i18n_name }
9
9
  manifest_name :proposals
10
10
  participatory_space { create(:participatory_process, :with_steps, organization: organization) }
11
11
 
@@ -139,12 +139,12 @@ FactoryBot.define do
139
139
  factory :proposal, class: "Decidim::Proposals::Proposal" do
140
140
  title { Faker::Lorem.sentence }
141
141
  body { Faker::Lorem.sentences(3).join("\n") }
142
- feature { create(:proposal_feature) }
142
+ component { create(:proposal_component) }
143
143
  published_at { Time.current }
144
144
  address { "#{Faker::Address.street_name}, #{Faker::Address.city}" }
145
145
 
146
146
  author do
147
- create(:user, organization: feature.organization) if feature
147
+ create(:user, organization: component.organization) if component
148
148
  end
149
149
 
150
150
  trait :official do
@@ -211,10 +211,7 @@ FactoryBot.define do
211
211
  factory :user_group_proposal_endorsement, class: "Decidim::Proposals::ProposalEndorsement" do
212
212
  proposal { build(:proposal) }
213
213
  author { build(:user, organization: proposal.organization) }
214
- user_group { create(:user_group) }
215
- after(:create) do |support|
216
- create(:user_group_membership, user: support.author, user_group: Decidim::UserGroup.find(support.decidim_user_group_id))
217
- end
214
+ user_group { create(:user_group, verified_at: Time.zone.now, organization: proposal.organization, users: [author]) }
218
215
  end
219
216
 
220
217
  factory :proposal_note, class: "Decidim::Proposals::ProposalNote" do
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds decidim-proposals version.
5
5
  module Proposals
6
6
  def self.version
7
- "0.10.1"
7
+ "0.11.0.pre1"
8
8
  end
9
9
  end
10
10
  end
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.10.1
4
+ version: 0.11.0.pre1
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: 2018-04-17 00:00:00.000000000 Z
13
+ date: 2018-04-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-comments
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.10.1
21
+ version: 0.11.0.pre1
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.10.1
28
+ version: 0.11.0.pre1
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.10.1
35
+ version: 0.11.0.pre1
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.10.1
42
+ version: 0.11.0.pre1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: kaminari
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -88,84 +88,84 @@ dependencies:
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.10.1
91
+ version: 0.11.0.pre1
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 0.10.1
98
+ version: 0.11.0.pre1
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: decidim-assemblies
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - '='
104
104
  - !ruby/object:Gem::Version
105
- version: 0.10.1
105
+ version: 0.11.0.pre1
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - '='
111
111
  - !ruby/object:Gem::Version
112
- version: 0.10.1
112
+ version: 0.11.0.pre1
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: decidim-budgets
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 0.10.1
119
+ version: 0.11.0.pre1
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - '='
125
125
  - !ruby/object:Gem::Version
126
- version: 0.10.1
126
+ version: 0.11.0.pre1
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: decidim-dev
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: 0.10.1
133
+ version: 0.11.0.pre1
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - '='
139
139
  - !ruby/object:Gem::Version
140
- version: 0.10.1
140
+ version: 0.11.0.pre1
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: decidim-meetings
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - '='
146
146
  - !ruby/object:Gem::Version
147
- version: 0.10.1
147
+ version: 0.11.0.pre1
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - '='
153
153
  - !ruby/object:Gem::Version
154
- version: 0.10.1
154
+ version: 0.11.0.pre1
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: decidim-participatory_processes
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - '='
160
160
  - !ruby/object:Gem::Version
161
- version: 0.10.1
161
+ version: 0.11.0.pre1
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - '='
167
167
  - !ruby/object:Gem::Version
168
- version: 0.10.1
168
+ version: 0.11.0.pre1
169
169
  description: A proposals component for decidim's participatory spaces.
170
170
  email:
171
171
  - josepjaume@gmail.com
@@ -194,6 +194,7 @@ files:
194
194
  - app/commands/decidim/proposals/admin/update_proposal_category.rb
195
195
  - app/commands/decidim/proposals/create_proposal.rb
196
196
  - app/commands/decidim/proposals/create_proposal_export.rb
197
+ - app/commands/decidim/proposals/destroy_proposal.rb
197
198
  - app/commands/decidim/proposals/endorse_proposal.rb
198
199
  - app/commands/decidim/proposals/publish_proposal.rb
199
200
  - app/commands/decidim/proposals/unendorse_proposal.rb
@@ -218,6 +219,7 @@ files:
218
219
  - app/events/decidim/proposals/endorsing_enabled_event.rb
219
220
  - app/events/decidim/proposals/evaluating_proposal_event.rb
220
221
  - app/events/decidim/proposals/proposal_endorsed_event.rb
222
+ - app/events/decidim/proposals/proposal_mentioned_event.rb
221
223
  - app/events/decidim/proposals/publish_proposal_event.rb
222
224
  - app/events/decidim/proposals/rejected_proposal_event.rb
223
225
  - app/events/decidim/proposals/voting_enabled_event.rb
@@ -231,6 +233,7 @@ files:
231
233
  - app/helpers/decidim/proposals/proposal_endorsements_helper.rb
232
234
  - app/helpers/decidim/proposals/proposal_votes_helper.rb
233
235
  - app/helpers/decidim/proposals/proposal_wizard_helper.rb
236
+ - app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
234
237
  - app/jobs/decidim/proposals/settings_change_job.rb
235
238
  - app/models/decidim/proposals/abilities/admin_ability.rb
236
239
  - app/models/decidim/proposals/abilities/current_user_ability.rb
@@ -276,12 +279,12 @@ files:
276
279
  - app/views/decidim/proposals/proposals/_count.html.erb
277
280
  - app/views/decidim/proposals/proposals/_endorsement_button.html.erb
278
281
  - app/views/decidim/proposals/proposals/_endorsement_identities_cabin.html.erb
279
- - app/views/decidim/proposals/proposals/_endorsement_xxs.html.erb
280
282
  - app/views/decidim/proposals/proposals/_endorsements_card_row.html.erb
281
283
  - app/views/decidim/proposals/proposals/_endorsements_count.html.erb
282
- - app/views/decidim/proposals/proposals/_endorsements_listing.html.erb
283
284
  - app/views/decidim/proposals/proposals/_filters.html.erb
284
285
  - app/views/decidim/proposals/proposals/_filters_small_view.html.erb
286
+ - app/views/decidim/proposals/proposals/_identities_listing.html.erb
287
+ - app/views/decidim/proposals/proposals/_identity_xxs.html.erb
285
288
  - app/views/decidim/proposals/proposals/_linked_proposals.html.erb
286
289
  - app/views/decidim/proposals/proposals/_proposal.html.erb
287
290
  - app/views/decidim/proposals/proposals/_proposal_badge.html.erb
@@ -289,12 +292,14 @@ files:
289
292
  - app/views/decidim/proposals/proposals/_proposal_similar.html.erb
290
293
  - app/views/decidim/proposals/proposals/_proposals.html.erb
291
294
  - app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb
295
+ - app/views/decidim/proposals/proposals/_tags.html.erb
292
296
  - app/views/decidim/proposals/proposals/_vote_button.html.erb
293
297
  - app/views/decidim/proposals/proposals/_votes_count.html.erb
294
298
  - app/views/decidim/proposals/proposals/_voting_rules.html.erb
295
299
  - app/views/decidim/proposals/proposals/_wizard_aside.html.erb
296
300
  - app/views/decidim/proposals/proposals/_wizard_header.html.erb
297
301
  - app/views/decidim/proposals/proposals/compare.html.erb
302
+ - app/views/decidim/proposals/proposals/complete.html.erb
298
303
  - app/views/decidim/proposals/proposals/edit.html.erb
299
304
  - app/views/decidim/proposals/proposals/edit_draft.html.erb
300
305
  - app/views/decidim/proposals/proposals/index.html.erb
@@ -339,12 +344,16 @@ files:
339
344
  - db/migrate/20171220084719_add_published_at_to_proposals.rb
340
345
  - db/migrate/20180111110204_create_decidim_proposal_notes.rb
341
346
  - db/migrate/20180115155220_add_index_created_at_proposal_notes.rb
347
+ - db/migrate/20180305133811_rename_features_to_components_at_proposals.rb
348
+ - db/migrate/20180413135249_fix_nil_threshold_per_proposal.rb
349
+ - lib/decidim/content_parsers/proposal_parser.rb
350
+ - lib/decidim/content_renderers/proposal_renderer.rb
342
351
  - lib/decidim/proposals.rb
343
352
  - lib/decidim/proposals/admin.rb
344
353
  - lib/decidim/proposals/admin_engine.rb
345
354
  - lib/decidim/proposals/commentable_proposal.rb
355
+ - lib/decidim/proposals/component.rb
346
356
  - lib/decidim/proposals/engine.rb
347
- - lib/decidim/proposals/feature.rb
348
357
  - lib/decidim/proposals/proposal_serializer.rb
349
358
  - lib/decidim/proposals/test/factories.rb
350
359
  - lib/decidim/proposals/version.rb
@@ -363,9 +372,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
363
372
  version: '2.3'
364
373
  required_rubygems_version: !ruby/object:Gem::Requirement
365
374
  requirements:
366
- - - ">="
375
+ - - ">"
367
376
  - !ruby/object:Gem::Version
368
- version: '0'
377
+ version: 1.3.1
369
378
  requirements: []
370
379
  rubyforge_project:
371
380
  rubygems_version: 2.7.3