decidim-consultations 0.19.1 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/consultations/utils_multiple.js +1 -1
  3. data/app/assets/stylesheets/decidim/consultations/_question_multiple_votes.scss +22 -0
  4. data/app/assets/stylesheets/decidim/consultations/consultations.scss +1 -0
  5. data/app/commands/decidim/consultations/admin/create_response.rb +2 -1
  6. data/app/commands/decidim/consultations/admin/create_response_group.rb +40 -0
  7. data/app/commands/decidim/consultations/admin/destroy_response_group.rb +39 -0
  8. data/app/commands/decidim/consultations/admin/update_response.rb +3 -2
  9. data/app/commands/decidim/consultations/admin/update_response_group.rb +46 -0
  10. data/app/controllers/decidim/consultations/admin/response_groups_controller.rb +88 -0
  11. data/app/controllers/decidim/consultations/admin/responses_controller.rb +1 -0
  12. data/app/forms/decidim/consultations/admin/response_form.rb +5 -0
  13. data/app/forms/decidim/consultations/admin/response_group_form.rb +18 -0
  14. data/app/helpers/decidim/consultations/admin/questions_helper.rb +11 -0
  15. data/app/models/decidim/consultation.rb +11 -0
  16. data/app/models/decidim/consultations/question.rb +22 -0
  17. data/app/models/decidim/consultations/response.rb +7 -0
  18. data/app/models/decidim/consultations/response_group.rb +19 -0
  19. data/app/permissions/decidim/consultations/admin/permissions.rb +16 -0
  20. data/app/views/decidim/consultations/admin/response_groups/_form.html.erb +11 -0
  21. data/app/views/decidim/consultations/admin/response_groups/edit.html.erb +18 -0
  22. data/app/views/decidim/consultations/admin/response_groups/index.html.erb +56 -0
  23. data/app/views/decidim/consultations/admin/response_groups/new.html.erb +13 -0
  24. data/app/views/decidim/consultations/admin/responses/_form.html.erb +3 -0
  25. data/app/views/decidim/consultations/admin/responses/index.html.erb +12 -1
  26. data/app/views/decidim/consultations/question_multiple_votes/_form.html.erb +14 -10
  27. data/app/views/decidim/consultations/question_multiple_votes/show.html.erb +8 -2
  28. data/app/views/layouts/decidim/admin/question.html.erb +1 -1
  29. data/config/locales/ca.yml +13 -0
  30. data/config/locales/cs.yml +25 -0
  31. data/config/locales/en.yml +25 -0
  32. data/config/locales/fi-plain.yml +25 -0
  33. data/config/locales/fi.yml +25 -0
  34. data/config/locales/fr.yml +25 -0
  35. data/config/locales/hu.yml +25 -0
  36. data/config/locales/it.yml +25 -0
  37. data/config/locales/nl.yml +25 -0
  38. data/config/locales/no.yml +2 -0
  39. data/config/locales/sv.yml +15 -0
  40. data/db/migrate/20190708114204_create_decidim_consultations_response_groups.rb +16 -0
  41. data/db/migrate/20190708120345_add_response_groups_count_to_decidim_consultations_questions.rb +7 -0
  42. data/db/migrate/20190708121643_add_response_groups_to_decidim_consultations_responses.rb +10 -0
  43. data/lib/decidim/consultations/admin_engine.rb +1 -0
  44. data/lib/decidim/consultations/participatory_space.rb +4 -0
  45. data/lib/decidim/consultations/test/factories.rb +5 -0
  46. data/lib/decidim/consultations/version.rb +1 -1
  47. metadata +24 -10
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddResponseGroupsCountToDecidimConsultationsQuestions < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_consultations_questions, :response_groups_count, :integer, null: false, default: 0
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddResponseGroupsToDecidimConsultationsResponses < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_reference :decidim_consultations_responses,
6
+ :decidim_consultations_response_group,
7
+ foreign_key: true,
8
+ index: { name: "index_consultations_response_groups_on_consultation_responses" }
9
+ end
10
+ end
@@ -38,6 +38,7 @@ module Decidim
38
38
 
39
39
  resources :question_attachments
40
40
  resources :responses, except: :show
41
+ resources :response_groups, except: :show
41
42
  end
42
43
 
43
44
  scope "/questions/:question_slug/components/:component_id/manage" do
@@ -24,6 +24,7 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
24
24
  participatory_space.register_resource(:consultation) do |resource|
25
25
  resource.model_class_name = "Decidim::Consultation"
26
26
  resource.card = "decidim/consultations/consultation"
27
+ resource.searchable = true
27
28
  end
28
29
 
29
30
  participatory_space.register_resource(:question) do |resource|
@@ -60,6 +61,7 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
60
61
  ) do
61
62
  Decidim::Consultation.create!(active_consultation_params)
62
63
  end
64
+ active_consultation.add_to_index_as_search_resource
63
65
 
64
66
  finished_consultation_params = {
65
67
  slug: Faker::Internet.unique.slug(nil, "-"),
@@ -86,6 +88,7 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
86
88
  ) do
87
89
  Decidim::Consultation.create!(finished_consultation_params)
88
90
  end
91
+ finished_consultation.add_to_index_as_search_resource
89
92
 
90
93
  upcoming_consultation_params = {
91
94
  slug: Faker::Internet.unique.slug(nil, "-"),
@@ -111,6 +114,7 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
111
114
  ) do
112
115
  Decidim::Consultation.create!(upcoming_consultation_params)
113
116
  end
117
+ upcoming_consultation.add_to_index_as_search_resource
114
118
 
115
119
  [finished_consultation, active_consultation, upcoming_consultation].each do |consultation|
116
120
  4.times do
@@ -101,6 +101,11 @@ FactoryBot.define do
101
101
  title { generate_localized_title }
102
102
  end
103
103
 
104
+ factory :response_group, class: "Decidim::Consultations::ResponseGroup" do
105
+ question { create(:question, :multiple) }
106
+ title { generate_localized_title }
107
+ end
108
+
104
109
  factory :vote, class: "Decidim::Consultations::Vote" do
105
110
  question
106
111
  response
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Consultations
5
5
  def self.version
6
- "0.19.1"
6
+ "0.20.0"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-consultations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.1
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Salvador Perez Garcia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2020-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-admin
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.19.1
19
+ version: 0.20.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.19.1
26
+ version: 0.20.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: decidim-comments
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.19.1
33
+ version: 0.20.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.19.1
40
+ version: 0.20.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: decidim-core
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.19.1
47
+ version: 0.20.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.19.1
54
+ version: 0.20.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: decidim-dev
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.19.1
61
+ version: 0.20.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.19.1
68
+ version: 0.20.0
69
69
  description: Extends Decidim adding a first level public consultation component
70
70
  email:
71
71
  - jsperezg@gmail.com
@@ -84,6 +84,7 @@ files:
84
84
  - app/assets/javascripts/decidim/consultations/utils_multiple.js
85
85
  - app/assets/javascripts/decidim/consultations/vote_dialog.js
86
86
  - app/assets/stylesheets/decidim/consultations/_question.scss
87
+ - app/assets/stylesheets/decidim/consultations/_question_multiple_votes.scss
87
88
  - app/assets/stylesheets/decidim/consultations/_stats.scss
88
89
  - app/assets/stylesheets/decidim/consultations/_video_wrapper.scss
89
90
  - app/assets/stylesheets/decidim/consultations/banners/_block-banner.scss
@@ -111,6 +112,8 @@ files:
111
112
  - app/commands/decidim/consultations/admin/create_consultation.rb
112
113
  - app/commands/decidim/consultations/admin/create_question.rb
113
114
  - app/commands/decidim/consultations/admin/create_response.rb
115
+ - app/commands/decidim/consultations/admin/create_response_group.rb
116
+ - app/commands/decidim/consultations/admin/destroy_response_group.rb
114
117
  - app/commands/decidim/consultations/admin/publish_consultation.rb
115
118
  - app/commands/decidim/consultations/admin/publish_consultation_results.rb
116
119
  - app/commands/decidim/consultations/admin/publish_question.rb
@@ -121,6 +124,7 @@ files:
121
124
  - app/commands/decidim/consultations/admin/update_question.rb
122
125
  - app/commands/decidim/consultations/admin/update_question_configuration.rb
123
126
  - app/commands/decidim/consultations/admin/update_response.rb
127
+ - app/commands/decidim/consultations/admin/update_response_group.rb
124
128
  - app/commands/decidim/consultations/multiple_vote_question.rb
125
129
  - app/commands/decidim/consultations/unvote_question.rb
126
130
  - app/commands/decidim/consultations/vote_question.rb
@@ -143,6 +147,7 @@ files:
143
147
  - app/controllers/decidim/consultations/admin/question_permissions_controller.rb
144
148
  - app/controllers/decidim/consultations/admin/question_publications_controller.rb
145
149
  - app/controllers/decidim/consultations/admin/questions_controller.rb
150
+ - app/controllers/decidim/consultations/admin/response_groups_controller.rb
146
151
  - app/controllers/decidim/consultations/admin/responses_controller.rb
147
152
  - app/controllers/decidim/consultations/application_controller.rb
148
153
  - app/controllers/decidim/consultations/authorization_vote_modals_controller.rb
@@ -156,6 +161,7 @@ files:
156
161
  - app/forms/decidim/consultations/admin/question_configuration_form.rb
157
162
  - app/forms/decidim/consultations/admin/question_form.rb
158
163
  - app/forms/decidim/consultations/admin/response_form.rb
164
+ - app/forms/decidim/consultations/admin/response_group_form.rb
159
165
  - app/forms/decidim/consultations/multi_vote_form.rb
160
166
  - app/forms/decidim/consultations/vote_form.rb
161
167
  - app/helpers/decidim/consultations/admin/consultations_helper.rb
@@ -168,6 +174,7 @@ files:
168
174
  - app/models/decidim/consultations/application_record.rb
169
175
  - app/models/decidim/consultations/question.rb
170
176
  - app/models/decidim/consultations/response.rb
177
+ - app/models/decidim/consultations/response_group.rb
171
178
  - app/models/decidim/consultations/vote.rb
172
179
  - app/permissions/decidim/consultations/admin/permissions.rb
173
180
  - app/permissions/decidim/consultations/permissions.rb
@@ -189,6 +196,10 @@ files:
189
196
  - app/views/decidim/consultations/admin/questions/edit.html.erb
190
197
  - app/views/decidim/consultations/admin/questions/index.html.erb
191
198
  - app/views/decidim/consultations/admin/questions/new.html.erb
199
+ - app/views/decidim/consultations/admin/response_groups/_form.html.erb
200
+ - app/views/decidim/consultations/admin/response_groups/edit.html.erb
201
+ - app/views/decidim/consultations/admin/response_groups/index.html.erb
202
+ - app/views/decidim/consultations/admin/response_groups/new.html.erb
192
203
  - app/views/decidim/consultations/admin/responses/_form.html.erb
193
204
  - app/views/decidim/consultations/admin/responses/edit.html.erb
194
205
  - app/views/decidim/consultations/admin/responses/index.html.erb
@@ -290,6 +301,9 @@ files:
290
301
  - db/migrate/20180712111146_remove_unused_search_indexs.rb
291
302
  - db/migrate/20181003082318_fix_user_groups_ids_on_consultations.rb
292
303
  - db/migrate/20190702162755_add_options_to_decidim_consultations_questions.rb
304
+ - db/migrate/20190708114204_create_decidim_consultations_response_groups.rb
305
+ - db/migrate/20190708120345_add_response_groups_count_to_decidim_consultations_questions.rb
306
+ - db/migrate/20190708121643_add_response_groups_to_decidim_consultations_responses.rb
293
307
  - db/migrate/20190710121122_add_free_instructions_field_to_consultations_questions.rb
294
308
  - db/seeds/Exampledocument.pdf
295
309
  - db/seeds/city.jpeg