decidim-participatory_processes 0.9.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/participatory_processes/admin/activate_participatory_process_step.rb +34 -4
  3. data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +25 -0
  4. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_admin.rb +36 -5
  5. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_step.rb +3 -1
  6. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb +53 -0
  7. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb +16 -5
  8. data/app/commands/decidim/participatory_processes/admin/publish_participatory_process.rb +9 -3
  9. data/app/commands/decidim/participatory_processes/admin/unpublish_participatory_process.rb +9 -3
  10. data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +7 -1
  11. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_admin.rb +12 -1
  12. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +23 -7
  13. data/app/controllers/decidim/participatory_processes/admin/participatory_process_attachment_collections_controller.rb +27 -0
  14. data/app/controllers/decidim/participatory_processes/admin/participatory_process_publications_controller.rb +2 -2
  15. data/app/controllers/decidim/participatory_processes/admin/participatory_process_step_activations_controller.rb +1 -1
  16. data/app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb +1 -1
  17. data/app/controllers/decidim/participatory_processes/admin/participatory_process_user_roles_controller.rb +6 -4
  18. data/app/controllers/decidim/participatory_processes/application_controller.rb +11 -0
  19. data/app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb +1 -1
  20. data/app/controllers/decidim/participatory_processes/participatory_process_steps_controller.rb +1 -1
  21. data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +4 -3
  22. data/app/helpers/decidim/participatory_processes/application_helper.rb +23 -0
  23. data/app/models/decidim/participatory_process.rb +8 -0
  24. data/app/models/decidim/participatory_process_step.rb +9 -0
  25. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +56 -0
  26. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_user_role_presenter.rb +53 -0
  27. data/app/presenters/decidim/participatory_processes/admin_log/step_presenter.rb +40 -0
  28. data/app/presenters/decidim/participatory_processes/admin_log/value_types/role_presenter.rb +22 -0
  29. data/app/types/decidim/participatory_processes/participatory_process_step_type.rb +25 -0
  30. data/app/types/decidim/participatory_processes/participatory_process_type.rb +15 -0
  31. data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +1 -0
  32. data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +2 -0
  33. data/app/views/layouts/decidim/admin/participatory_process.html.erb +15 -3
  34. data/config/locales/ca.yml +31 -0
  35. data/config/locales/en.yml +31 -0
  36. data/config/locales/es.yml +32 -1
  37. data/config/locales/eu.yml +31 -0
  38. data/config/locales/fi.yml +31 -0
  39. data/config/locales/fr.yml +47 -16
  40. data/config/locales/gl.yml +31 -0
  41. data/config/locales/it.yml +31 -0
  42. data/config/locales/nl.yml +31 -0
  43. data/config/locales/pl.yml +31 -5
  44. data/config/locales/pt-BR.yml +31 -0
  45. data/config/locales/pt.yml +31 -0
  46. data/config/locales/sv.yml +31 -0
  47. data/config/locales/uk.yml +9 -5
  48. data/db/migrate/20170220110740_remove_steps_short_description.rb +1 -1
  49. data/db/migrate/20171215081244_add_weight_to_attachments.rb +7 -0
  50. data/db/migrate/20171215141722_add_attachment_collection_to_attachments.rb +9 -0
  51. data/db/migrate/20180125102537_add_reference_to_processes.rb +7 -0
  52. data/lib/decidim/participatory_processes.rb +4 -0
  53. data/lib/decidim/participatory_processes/admin_engine.rb +1 -0
  54. data/lib/decidim/participatory_processes/participatory_space.rb +16 -0
  55. data/lib/decidim/participatory_processes/test/factories.rb +6 -0
  56. data/lib/decidim/participatory_processes/version.rb +1 -1
  57. metadata +22 -10
  58. data/app/commands/decidim/participatory_processes/admin/deactivate_participatory_process_step.rb +0 -40
@@ -8,7 +8,7 @@ class RemoveStepsShortDescription < ActiveRecord::Migration[5.0]
8
8
  def change
9
9
  ParticipatoryProcessStep.transaction do
10
10
  ParticipatoryProcessStep.find_each do |step|
11
- step.update_attributes!(
11
+ step.update!(
12
12
  description: new_description_for(step)
13
13
  )
14
14
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddWeightToAttachments < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_attachments, :weight, :integer, null: false, default: 0
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddAttachmentCollectionToAttachments < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_attachments, :attachment_collection_id, :integer, null: true, index: { name: "index_decidim_attachments_attachment_collection_id" }
6
+ add_foreign_key :decidim_attachments, :decidim_attachment_collections, column: :attachment_collection_id, on_delete: :nullify,
7
+ name: "fk_decidim_attachments_attachment_collection_id"
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddReferenceToProcesses < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_participatory_processes, :reference, :string
6
+ end
7
+ end
@@ -8,5 +8,9 @@ require "decidim/participatory_processes/participatory_space"
8
8
  module Decidim
9
9
  # Base module for the participatory processes engine.
10
10
  module ParticipatoryProcesses
11
+ # Public: Stores an instance of ViewHooks
12
+ def self.view_hooks
13
+ @view_hooks ||= ViewHooks.new
14
+ end
11
15
  end
12
16
  end
@@ -30,6 +30,7 @@ module Decidim
30
30
  post :resend_invitation, to: "participatory_process_user_roles#resend_invitation"
31
31
  end
32
32
  end
33
+ resources :attachment_collections, controller: "participatory_process_attachment_collections"
33
34
  resources :attachments, controller: "participatory_process_attachments"
34
35
  end
35
36
 
@@ -8,6 +8,8 @@ Decidim.register_participatory_space(:participatory_processes) do |participatory
8
8
  Decidim::ParticipatoryProcesses::OrganizationParticipatoryProcesses.new(organization).query
9
9
  end
10
10
 
11
+ participatory_space.query_type = "Decidim::ParticipatoryProcesses::ParticipatoryProcessType"
12
+
11
13
  participatory_space.context(:public) do |context|
12
14
  context.engine = Decidim::ParticipatoryProcesses::Engine
13
15
  context.layout = "layouts/decidim/participatory_process"
@@ -99,6 +101,20 @@ Decidim.register_participatory_space(:participatory_processes) do |participatory
99
101
  )
100
102
  end
101
103
 
104
+ attachment_collection = Decidim::AttachmentCollection.create!(
105
+ name: Decidim::Faker::Localized.word,
106
+ description: Decidim::Faker::Localized.sentence(5),
107
+ collection_for: process
108
+ )
109
+
110
+ Decidim::Attachment.create!(
111
+ title: Decidim::Faker::Localized.sentence(2),
112
+ description: Decidim::Faker::Localized.sentence(5),
113
+ file: File.new(File.join(seeds_root, "Exampledocument.pdf")),
114
+ attachment_collection: attachment_collection,
115
+ attached_to: process
116
+ )
117
+
102
118
  Decidim::Attachment.create!(
103
119
  title: Decidim::Faker::Localized.sentence(2),
104
120
  description: Decidim::Faker::Localized.sentence(5),
@@ -141,4 +141,10 @@ FactoryBot.define do
141
141
  role: :moderator
142
142
  end
143
143
  end
144
+
145
+ factory :participatory_process_user_role, class: "Decidim::ParticipatoryProcessUserRole" do
146
+ user
147
+ participatory_process { create :participatory_process, organization: user.organization }
148
+ role "admin"
149
+ end
144
150
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-participatory_processes version.
5
5
  module ParticipatoryProcesses
6
6
  def self.version
7
- "0.9.3"
7
+ "0.10.0"
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-participatory_processes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
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-02-27 00:00:00.000000000 Z
13
+ date: 2018-03-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.9.3
21
+ version: 0.10.0
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.9.3
28
+ version: 0.10.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-admin
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.9.3
35
+ version: 0.10.0
36
36
  type: :development
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.9.3
42
+ version: 0.10.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: decidim-dev
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.9.3
49
+ version: 0.10.0
50
50
  type: :development
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.9.3
56
+ version: 0.10.0
57
57
  description: Participatory processes component for decidim.
58
58
  email:
59
59
  - josepjaume@gmail.com
@@ -76,7 +76,7 @@ files:
76
76
  - app/commands/decidim/participatory_processes/admin/create_participatory_process_admin.rb
77
77
  - app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb
78
78
  - app/commands/decidim/participatory_processes/admin/create_participatory_process_step.rb
79
- - app/commands/decidim/participatory_processes/admin/deactivate_participatory_process_step.rb
79
+ - app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb
80
80
  - app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb
81
81
  - app/commands/decidim/participatory_processes/admin/publish_participatory_process.rb
82
82
  - app/commands/decidim/participatory_processes/admin/reorder_participatory_process_steps.rb
@@ -94,6 +94,7 @@ files:
94
94
  - app/controllers/decidim/participatory_processes/admin/feature_permissions_controller.rb
95
95
  - app/controllers/decidim/participatory_processes/admin/features_controller.rb
96
96
  - app/controllers/decidim/participatory_processes/admin/moderations_controller.rb
97
+ - app/controllers/decidim/participatory_processes/admin/participatory_process_attachment_collections_controller.rb
97
98
  - app/controllers/decidim/participatory_processes/admin/participatory_process_attachments_controller.rb
98
99
  - app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
99
100
  - app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb
@@ -103,6 +104,7 @@ files:
103
104
  - app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb
104
105
  - app/controllers/decidim/participatory_processes/admin/participatory_process_user_roles_controller.rb
105
106
  - app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb
107
+ - app/controllers/decidim/participatory_processes/application_controller.rb
106
108
  - app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
107
109
  - app/controllers/decidim/participatory_processes/participatory_process_steps_controller.rb
108
110
  - app/controllers/decidim/participatory_processes/participatory_process_widgets_controller.rb
@@ -114,6 +116,7 @@ files:
114
116
  - app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
115
117
  - app/helpers/decidim/participatory_processes/admin/process_groups_for_select_helper.rb
116
118
  - app/helpers/decidim/participatory_processes/admin/processes_for_select_helper.rb
119
+ - app/helpers/decidim/participatory_processes/application_helper.rb
117
120
  - app/helpers/decidim/participatory_processes/participatory_process_helper.rb
118
121
  - app/helpers/decidim/participatory_processes/participatory_process_steps_helper.rb
119
122
  - app/models/decidim/participatory_process.rb
@@ -122,6 +125,10 @@ files:
122
125
  - app/models/decidim/participatory_processes/abilities/admin/admin_ability.rb
123
126
  - app/models/decidim/participatory_processes/abilities/admin_ability.rb
124
127
  - app/models/decidim/participatory_processes/abilities/everyone_ability.rb
128
+ - app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
129
+ - app/presenters/decidim/participatory_processes/admin_log/participatory_process_user_role_presenter.rb
130
+ - app/presenters/decidim/participatory_processes/admin_log/step_presenter.rb
131
+ - app/presenters/decidim/participatory_processes/admin_log/value_types/role_presenter.rb
125
132
  - app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb
126
133
  - app/queries/decidim/participatory_processes/admin/admin_users.rb
127
134
  - app/queries/decidim/participatory_processes/filtered_participatory_process_groups.rb
@@ -135,6 +142,8 @@ files:
135
142
  - app/queries/decidim/participatory_processes/prioritized_participatory_processes.rb
136
143
  - app/queries/decidim/participatory_processes/promoted_participatory_processes.rb
137
144
  - app/queries/decidim/participatory_processes/published_participatory_processes.rb
145
+ - app/types/decidim/participatory_processes/participatory_process_step_type.rb
146
+ - app/types/decidim/participatory_processes/participatory_process_type.rb
138
147
  - app/views/decidim/participatory_process_groups/_participatory_process_group.html.erb
139
148
  - app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb
140
149
  - app/views/decidim/participatory_processes/_order_by_processes.html.erb
@@ -217,6 +226,9 @@ files:
217
226
  - db/migrate/20170808080905_add_announcement_to_participatory_processes.rb
218
227
  - db/migrate/20170809084005_add_scopes_enabled_to_participatory_processes.rb
219
228
  - db/migrate/20170830081725_add_start_date_to_processes.rb
229
+ - db/migrate/20171215081244_add_weight_to_attachments.rb
230
+ - db/migrate/20171215141722_add_attachment_collection_to_attachments.rb
231
+ - db/migrate/20180125102537_add_reference_to_processes.rb
220
232
  - db/seeds/Exampledocument.pdf
221
233
  - db/seeds/city.jpeg
222
234
  - db/seeds/city2.jpeg
@@ -248,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
260
  version: '0'
249
261
  requirements: []
250
262
  rubyforge_project:
251
- rubygems_version: 2.7.3
263
+ rubygems_version: 2.7.6
252
264
  signing_key:
253
265
  specification_version: 4
254
266
  summary: Decidim participatory processes module
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module ParticipatoryProcesses
5
- module Admin
6
- # A command that sets all steps in a participatory process as inactive
7
- class DeactivateParticipatoryProcessStep < Rectify::Command
8
- # Public: Initializes the command.
9
- #
10
- # step - A ParticipatoryProcessStep that will be deactivated
11
- def initialize(step)
12
- @step = step
13
- end
14
-
15
- # Executes the command. Broadcasts these events:
16
- #
17
- # - :ok when everything is valid.
18
- # - :invalid if the data wasn't valid and we couldn't proceed.
19
- #
20
- # Returns nothing.
21
- def call
22
- return broadcast(:invalid) if step.nil? || !step.active?
23
-
24
- deactivate_active_steps
25
- broadcast(:ok)
26
- end
27
-
28
- private
29
-
30
- attr_reader :step
31
-
32
- def deactivate_active_steps
33
- step.participatory_process.steps.where(active: true).each do |step|
34
- step.update_attributes!(active: false)
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end