decidim-consultations 0.23.3 → 0.24.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/consultations/consultation_m_cell.rb +2 -0
  3. data/app/cells/decidim/consultations/content_blocks/highlighted_consultations/show.erb +4 -9
  4. data/app/commands/decidim/consultations/admin/update_consultation.rb +3 -0
  5. data/app/commands/decidim/consultations/admin/update_question.rb +13 -5
  6. data/app/helpers/decidim/consultations/admin/consultation_menu_helper.rb +15 -0
  7. data/app/helpers/decidim/consultations/questions_helper.rb +2 -0
  8. data/app/views/decidim/consultations/admin/consultations/index.html.erb +4 -0
  9. data/app/views/decidim/consultations/admin/questions/index.html.erb +4 -0
  10. data/app/views/decidim/consultations/admin/response_groups/index.html.erb +2 -0
  11. data/app/views/decidim/consultations/admin/responses/index.html.erb +2 -0
  12. data/app/views/decidim/consultations/consultations/_filters_small_view.html.erb +1 -1
  13. data/app/views/layouts/decidim/admin/consultation.html.erb +8 -23
  14. data/app/views/layouts/decidim/admin/consultations.html.erb +4 -0
  15. data/config/locales/ar.yml +0 -2
  16. data/config/locales/ca.yml +3 -2
  17. data/config/locales/cs.yml +6 -5
  18. data/config/locales/de.yml +3 -2
  19. data/config/locales/el.yml +0 -2
  20. data/config/locales/en.yml +3 -2
  21. data/config/locales/es-MX.yml +3 -2
  22. data/config/locales/es-PY.yml +3 -2
  23. data/config/locales/es.yml +3 -2
  24. data/config/locales/eu.yml +0 -2
  25. data/config/locales/fi-plain.yml +3 -2
  26. data/config/locales/fi.yml +4 -3
  27. data/config/locales/fr-CA.yml +3 -2
  28. data/config/locales/fr.yml +3 -2
  29. data/config/locales/gl.yml +0 -2
  30. data/config/locales/hu.yml +0 -2
  31. data/config/locales/id-ID.yml +0 -2
  32. data/config/locales/is-IS.yml +4 -0
  33. data/config/locales/it.yml +2 -2
  34. data/config/locales/ja.yml +0 -2
  35. data/config/locales/lv.yml +0 -2
  36. data/config/locales/nl.yml +2 -3
  37. data/config/locales/no.yml +0 -2
  38. data/config/locales/pl.yml +8 -7
  39. data/config/locales/pt-BR.yml +0 -2
  40. data/config/locales/pt.yml +0 -2
  41. data/config/locales/ro-RO.yml +52 -2
  42. data/config/locales/ru.yml +1 -1
  43. data/config/locales/sk.yml +0 -2
  44. data/config/locales/sv.yml +3 -2
  45. data/config/locales/tr-TR.yml +3 -3
  46. data/config/locales/uk.yml +1 -1
  47. data/config/locales/zh-CN.yml +0 -2
  48. data/db/migrate/20210310120626_add_followable_counter_cache_to_consultations.rb +16 -0
  49. data/lib/decidim/api/consultation_question_type.rb +52 -0
  50. data/lib/decidim/api/consultation_type.rb +29 -0
  51. data/lib/decidim/consultations.rb +1 -0
  52. data/lib/decidim/consultations/admin_engine.rb +25 -1
  53. data/lib/decidim/consultations/api.rb +8 -0
  54. data/lib/decidim/consultations/engine.rb +7 -1
  55. data/lib/decidim/consultations/participatory_space.rb +24 -24
  56. data/lib/decidim/consultations/query_extensions.rb +43 -0
  57. data/lib/decidim/consultations/test/factories.rb +2 -2
  58. data/lib/decidim/consultations/version.rb +1 -1
  59. metadata +18 -14
  60. data/app/types/decidim/consultations/consultation_question_type.rb +0 -57
  61. data/app/types/decidim/consultations/consultation_type.rb +0 -32
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Consultations
5
+ # This type represents a consultation.
6
+ class ConsultationType < Decidim::Api::Types::BaseObject
7
+ implements Decidim::Core::ParticipatorySpaceInterface
8
+
9
+ description "A consultation"
10
+
11
+ field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this consultation", null: true
12
+ field :description, Decidim::Core::TranslatedFieldType, "The description of this consultation", null: true
13
+ field :slug, GraphQL::Types::String, "Slug of this consultation", null: false
14
+ field :created_at, Decidim::Core::DateTimeType, "The time this consultation was created", null: false
15
+ field :updated_at, Decidim::Core::DateTimeType, "The time this consultation was updated", null: false
16
+ field :published_at, Decidim::Core::DateTimeType, "The time this consultation was published", null: false
17
+
18
+ field :introductory_video_url, GraphQL::Types::String, "The introductory video url for this consultation", null: true
19
+ field :introductory_image, GraphQL::Types::String, "The introductory image for this consultation", null: true
20
+ field :banner_image, GraphQL::Types::String, "The banner image for this consultation", null: true
21
+ field :highlighted_scope, Decidim::Core::ScopeApiType, "This is the highlighted scope of this consultation", null: true
22
+ field :start_voting_date, Decidim::Core::DateType, "Start date of the voting for this consultation", null: true
23
+ field :end_voting_date, Decidim::Core::DateType, "End date of the voting for this consultation", null: true
24
+ field :results_published_at, Decidim::Core::DateType, "Date when the results have been published", null: true
25
+
26
+ field :questions, [Decidim::Consultations::ConsultationQuestionType, { null: true }], "", null: true
27
+ end
28
+ end
29
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "decidim/consultations/admin"
4
+ require "decidim/consultations/api"
4
5
  require "decidim/consultations/engine"
5
6
  require "decidim/consultations/admin_engine"
6
7
  require "decidim/consultations/participatory_space"
@@ -53,16 +53,40 @@ module Decidim
53
53
  end
54
54
  end
55
55
 
56
+ initializer "decidim_consultations.admin_consultation_menu" do
57
+ Decidim.menu :admin_consultation_menu do |menu|
58
+ menu.item I18n.t("info", scope: "decidim.admin.menu.consultations_submenu"),
59
+ decidim_admin_consultations.edit_consultation_path(current_consultation),
60
+ position: 1.0,
61
+ active: is_active_link?(decidim_admin_consultations.edit_consultation_path(current_consultation)),
62
+ if: allowed_to?(:update, :consultation, consultation: current_consultation)
63
+ menu.item I18n.t("questions", scope: "decidim.admin.menu.consultations_submenu"),
64
+ decidim_admin_consultations.consultation_questions_path(current_consultation),
65
+ position: 1.1,
66
+ active: is_active_link?(decidim_admin_consultations.consultation_questions_path(current_consultation)),
67
+ if: allowed_to?(:read, :question)
68
+ menu.item I18n.t("results", scope: "decidim.admin.menu.consultations_submenu"),
69
+ decidim_admin_consultations.results_consultation_path(current_consultation),
70
+ position: 1.0,
71
+ active: is_active_link?(decidim_admin_consultations.results_consultation_path(current_consultation)),
72
+ if: allowed_to?(:read, :question)
73
+ end
74
+ end
56
75
  initializer "decidim_consultations.admin_menu" do
57
76
  Decidim.menu :admin_menu do |menu|
58
77
  menu.item I18n.t("menu.consultations", scope: "decidim.admin"),
59
78
  decidim_admin_consultations.consultations_path,
60
79
  icon_name: "comment-square",
61
- position: 3.8,
80
+ position: 2.65,
62
81
  active: :inclusive,
63
82
  if: allowed_to?(:enter, :space_area, space_name: :consultations)
64
83
  end
65
84
  end
85
+ initializer "decidim_consultations.action_controller" do |_app|
86
+ ActiveSupport.on_load :action_controller do
87
+ helper Decidim::Consultations::Admin::ConsultationMenuHelper if respond_to?(:helper)
88
+ end
89
+ end
66
90
  end
67
91
  end
68
92
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Consultations
5
+ autoload :ConsultationType, "decidim/api/consultation_type"
6
+ autoload :ConsultationQuestionType, "decidim/api/consultation_question_type"
7
+ end
8
+ end
@@ -4,6 +4,8 @@ require "rails"
4
4
  require "active_support/all"
5
5
  require "decidim/core"
6
6
 
7
+ require "decidim/consultations/query_extensions"
8
+
7
9
  module Decidim
8
10
  module Consultations
9
11
  # Decidim"s Consultations Rails Engine.
@@ -72,7 +74,7 @@ module Decidim
72
74
  Decidim.menu :menu do |menu|
73
75
  menu.item I18n.t("menu.consultations", scope: "decidim"),
74
76
  decidim_consultations.consultations_path,
75
- position: 2.7,
77
+ position: 2.65,
76
78
  if: Decidim::Consultation.where(organization: current_organization).published.any?,
77
79
  active: :inclusive
78
80
  end
@@ -89,6 +91,10 @@ module Decidim
89
91
  end
90
92
  end
91
93
  end
94
+
95
+ initializer "decidim_consultations.query_extensions" do
96
+ Decidim::Api::QueryType.include Decidim::Consultations::QueryExtensions
97
+ end
92
98
  end
93
99
  end
94
100
  end
@@ -40,11 +40,11 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
40
40
 
41
41
  # Active consultation
42
42
  active_consultation_params = {
43
- slug: Faker::Internet.unique.slug(nil, "-"),
44
- title: Decidim::Faker::Localized.sentence(3),
45
- subtitle: Decidim::Faker::Localized.sentence(3),
43
+ slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
44
+ title: Decidim::Faker::Localized.sentence(word_count: 3),
45
+ subtitle: Decidim::Faker::Localized.sentence(word_count: 3),
46
46
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
47
- Decidim::Faker::Localized.paragraph(3)
47
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
48
48
  end,
49
49
  published_at: Time.now.utc,
50
50
  start_voting_date: Time.zone.today,
@@ -66,11 +66,11 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
66
66
  active_consultation.add_to_index_as_search_resource
67
67
 
68
68
  finished_consultation_params = {
69
- slug: Faker::Internet.unique.slug(nil, "-"),
70
- title: Decidim::Faker::Localized.sentence(3),
71
- subtitle: Decidim::Faker::Localized.sentence(3),
69
+ slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
70
+ title: Decidim::Faker::Localized.sentence(word_count: 3),
71
+ subtitle: Decidim::Faker::Localized.sentence(word_count: 3),
72
72
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
73
- Decidim::Faker::Localized.paragraph(3)
73
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
74
74
  end,
75
75
  published_at: Time.zone.today - 2.months,
76
76
  results_published_at: Time.zone.today - 1.month,
@@ -93,11 +93,11 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
93
93
  finished_consultation.add_to_index_as_search_resource
94
94
 
95
95
  upcoming_consultation_params = {
96
- slug: Faker::Internet.unique.slug(nil, "-"),
97
- title: Decidim::Faker::Localized.sentence(3),
98
- subtitle: Decidim::Faker::Localized.sentence(3),
96
+ slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
97
+ title: Decidim::Faker::Localized.sentence(word_count: 3),
98
+ subtitle: Decidim::Faker::Localized.sentence(word_count: 3),
99
99
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
100
- Decidim::Faker::Localized.paragraph(3)
100
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
101
101
  end,
102
102
  published_at: Time.zone.today + 1.month,
103
103
  start_voting_date: Time.zone.today + 1.month + 1.day,
@@ -122,21 +122,21 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
122
122
  4.times do
123
123
  params = {
124
124
  consultation: consultation,
125
- slug: Faker::Internet.unique.slug(nil, "-"),
125
+ slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
126
126
  decidim_scope_id: Decidim::Scope.reorder(Arel.sql("RANDOM()")).first.id,
127
- title: Decidim::Faker::Localized.sentence(3),
128
- subtitle: Decidim::Faker::Localized.sentence(3),
127
+ title: Decidim::Faker::Localized.sentence(word_count: 3),
128
+ subtitle: Decidim::Faker::Localized.sentence(word_count: 3),
129
129
  what_is_decided: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
130
- Decidim::Faker::Localized.paragraph(3)
130
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
131
131
  end,
132
132
  question_context: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
133
- Decidim::Faker::Localized.paragraph(3)
133
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
134
134
  end,
135
135
  organization: organization,
136
136
  hero_image: File.new(File.join(seeds_root, "city.jpeg")), # Keep after organization
137
137
  banner_image: File.new(File.join(seeds_root, "city2.jpeg")), # Keep after organization
138
- promoter_group: Decidim::Faker::Localized.sentence(3),
139
- participatory_scope: Decidim::Faker::Localized.sentence(3),
138
+ promoter_group: Decidim::Faker::Localized.sentence(word_count: 3),
139
+ participatory_scope: Decidim::Faker::Localized.sentence(word_count: 3),
140
140
  published_at: Time.now.utc
141
141
  }
142
142
 
@@ -152,22 +152,22 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
152
152
  2.times do
153
153
  Decidim::Consultations::Response.create(
154
154
  question: question,
155
- title: Decidim::Faker::Localized.sentence(3)
155
+ title: Decidim::Faker::Localized.sentence(word_count: 3)
156
156
  )
157
157
  end
158
158
 
159
159
  Decidim::Comments::Seed.comments_for(question)
160
160
 
161
161
  Decidim::Attachment.create!(
162
- title: Decidim::Faker::Localized.sentence(2),
163
- description: Decidim::Faker::Localized.sentence(5),
162
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
163
+ description: Decidim::Faker::Localized.sentence(word_count: 5),
164
164
  attached_to: question,
165
165
  file: File.new(File.join(seeds_root, "city.jpeg")) # Keep after attached_to
166
166
  )
167
167
 
168
168
  Decidim::Attachment.create!(
169
- title: Decidim::Faker::Localized.sentence(2),
170
- description: Decidim::Faker::Localized.sentence(5),
169
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
170
+ description: Decidim::Faker::Localized.sentence(word_count: 5),
171
171
  attached_to: question,
172
172
  file: File.new(File.join(seeds_root, "Exampledocument.pdf")) # Keep after attached_to
173
173
  )
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Consultations
5
+ # This module's job is to extend the API with custom fields related to
6
+ # decidim-assemblies.
7
+ module QueryExtensions
8
+ # Public: Extends a type with `decidim-assemblies`'s fields.
9
+ #
10
+ # type - A GraphQL::BaseType to extend.
11
+ #
12
+ # Returns nothing.
13
+ def self.included(type)
14
+ type.field :consultations,
15
+ [Decidim::Consultations::ConsultationType],
16
+ null: true,
17
+ description: "Lists all consultations" do
18
+ argument :filter, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputFilter, "This argument let's you filter the results", required: false
19
+ argument :order, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputSort, "This argument let's you order the results", required: false
20
+ end
21
+
22
+ type.field :consultation,
23
+ Decidim::Consultations::ConsultationType,
24
+ null: true,
25
+ description: "Finds a consultation" do
26
+ argument :id, GraphQL::Types::ID, "The ID of the participatory space", required: false
27
+ end
28
+ end
29
+
30
+ def consultations(filter: {}, order: {})
31
+ manifest = Decidim.participatory_space_manifests.select { |m| m.name == :consultations }.first
32
+
33
+ Decidim::Core::ParticipatorySpaceListBase.new(manifest: manifest).call(object, { filter: filter, order: order }, context)
34
+ end
35
+
36
+ def consultation(id: nil)
37
+ manifest = Decidim.participatory_space_manifests.select { |m| m.name == :consultations }.first
38
+
39
+ Decidim::Core::ParticipatorySpaceFinderBase.new(manifest: manifest).call(object, { id: id }, context)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -5,11 +5,11 @@ require "decidim/dev"
5
5
 
6
6
  FactoryBot.define do
7
7
  sequence(:consultation_slug) do |n|
8
- "#{Faker::Internet.slug(nil, "-")}-#{n}"
8
+ "#{Decidim::Faker::Internet.slug(words: nil, glue: "-")}-#{n}"
9
9
  end
10
10
 
11
11
  sequence(:question_slug) do |n|
12
- "#{Faker::Internet.slug(nil, "-")}-#{n}"
12
+ "#{Decidim::Faker::Internet.slug(words: nil, glue: "-")}-#{n}"
13
13
  end
14
14
 
15
15
  factory :consultation, class: "Decidim::Consultation" do
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Consultations
5
5
  def self.version
6
- "0.23.3"
6
+ "0.24.1"
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.23.3
4
+ version: 0.24.1
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: 2021-02-23 00:00:00.000000000 Z
11
+ date: 2021-04-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.23.3
19
+ version: 0.24.1
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.23.3
26
+ version: 0.24.1
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.23.3
33
+ version: 0.24.1
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.23.3
40
+ version: 0.24.1
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.23.3
47
+ version: 0.24.1
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.23.3
54
+ version: 0.24.1
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.23.3
61
+ version: 0.24.1
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.23.3
68
+ version: 0.24.1
69
69
  description: Extends Decidim adding a first level public consultation component
70
70
  email:
71
71
  - jsperezg@gmail.com
@@ -165,6 +165,7 @@ files:
165
165
  - app/forms/decidim/consultations/admin/response_group_form.rb
166
166
  - app/forms/decidim/consultations/multi_vote_form.rb
167
167
  - app/forms/decidim/consultations/vote_form.rb
168
+ - app/helpers/decidim/consultations/admin/consultation_menu_helper.rb
168
169
  - app/helpers/decidim/consultations/admin/consultations_helper.rb
169
170
  - app/helpers/decidim/consultations/admin/questions_helper.rb
170
171
  - app/helpers/decidim/consultations/consultations_helper.rb
@@ -185,8 +186,6 @@ files:
185
186
  - app/queries/decidim/consultations/organization_consultations.rb
186
187
  - app/queries/decidim/consultations/organization_questions.rb
187
188
  - app/services/decidim/consultations/consultation_search.rb
188
- - app/types/decidim/consultations/consultation_question_type.rb
189
- - app/types/decidim/consultations/consultation_type.rb
190
189
  - app/views/decidim/consultations/_consultation.html.erb
191
190
  - app/views/decidim/consultations/admin/consultations/_form.html.erb
192
191
  - app/views/decidim/consultations/admin/consultations/edit.html.erb
@@ -349,15 +348,20 @@ files:
349
348
  - db/migrate/20190710121122_add_free_instructions_field_to_consultations_questions.rb
350
349
  - db/migrate/20200320105916_index_foreign_keys_in_decidim_consultations_votes.rb
351
350
  - db/migrate/20200827154143_add_commentable_counter_cache_to_consultations.rb
351
+ - db/migrate/20210310120626_add_followable_counter_cache_to_consultations.rb
352
352
  - db/seeds/Exampledocument.pdf
353
353
  - db/seeds/city.jpeg
354
354
  - db/seeds/city2.jpeg
355
355
  - db/seeds/homepage_image.jpg
356
+ - lib/decidim/api/consultation_question_type.rb
357
+ - lib/decidim/api/consultation_type.rb
356
358
  - lib/decidim/consultations.rb
357
359
  - lib/decidim/consultations/admin.rb
358
360
  - lib/decidim/consultations/admin_engine.rb
361
+ - lib/decidim/consultations/api.rb
359
362
  - lib/decidim/consultations/engine.rb
360
363
  - lib/decidim/consultations/participatory_space.rb
364
+ - lib/decidim/consultations/query_extensions.rb
361
365
  - lib/decidim/consultations/test/factories.rb
362
366
  - lib/decidim/consultations/version.rb
363
367
  homepage: https://github.com/decidim/decidim
@@ -372,14 +376,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
372
376
  requirements:
373
377
  - - ">="
374
378
  - !ruby/object:Gem::Version
375
- version: '2.6'
379
+ version: '2.7'
376
380
  required_rubygems_version: !ruby/object:Gem::Requirement
377
381
  requirements:
378
382
  - - ">="
379
383
  - !ruby/object:Gem::Version
380
384
  version: '0'
381
385
  requirements: []
382
- rubygems_version: 3.0.3
386
+ rubygems_version: 3.1.2
383
387
  signing_key:
384
388
  specification_version: 4
385
389
  summary: Decidim consultations module
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Consultations
5
- # This type represents a consultation.
6
- ConsultationQuestionType = GraphQL::ObjectType.define do
7
- interfaces [
8
- -> { Decidim::Core::ScopableInterface },
9
- -> { Decidim::Core::AttachableInterface },
10
- -> { Decidim::Comments::CommentableInterface }
11
- ]
12
-
13
- name "ConsultationQuestion"
14
- description "A consultation question"
15
-
16
- field :id, !types.ID, "Internal ID of the question"
17
- field :title, Decidim::Core::TranslatedFieldType, "Title of the question"
18
- field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this question"
19
- field :slug, !types.String, "Slug of the question"
20
- field :createdAt, !Decidim::Core::DateTimeType, "The time this question was created", property: :created_at
21
- field :updatedAt, !Decidim::Core::DateTimeType, "The time this question was updated", property: :updated_at
22
- field :publishedAt, !Decidim::Core::DateTimeType, "The time this question was published", property: :published_at
23
-
24
- field :components, types[Decidim::Core::ComponentInterface] do
25
- description "Lists the components this space contains."
26
-
27
- resolve ->(participatory_space, _args, _ctx) {
28
- Decidim::Component.where(
29
- participatory_space: participatory_space
30
- ).published
31
- }
32
- end
33
-
34
- field :bannerImage, types.String, "The banner image for this question", property: :banner_image
35
- field :heroImage, types.String, "The hero image for this question", property: :hero_image
36
-
37
- field :whatIsDecided, Decidim::Core::TranslatedFieldType, "What is decided in this question", property: :what_is_decided
38
- field :promoterGroup, Decidim::Core::TranslatedFieldType, "The promoter group of this question", property: :promoter_group
39
- field :participatoryScope, Decidim::Core::TranslatedFieldType, "The participatory scope of this question", property: :participatory_scope
40
- field :questionContext, Decidim::Core::TranslatedFieldType, "The context for this question", property: :question_context
41
- field :reference, types.String, "The reference for this question", property: :reference
42
- field :hashtag, types.String, "The hashtag of this question", property: :hashtag
43
- field :votesCount, types.Int, "The number of votes in this question", property: :votes_count
44
- field :originScope, Decidim::Core::TranslatedFieldType, "The origin scope of this question", property: :origin_scope
45
- field :originTitle, Decidim::Core::TranslatedFieldType, "The origin title of this question", property: :origin_title
46
- field :originUrl, types.String, "The origin URL for this question", property: :origin_url
47
- field :iFrameUrl, types.String, "The iframe URL for this question", property: :i_frame_url
48
- field :externalVoting, types.Boolean, "If the question has external voting", property: :external_voting
49
- field :responsesCount, types.Int, "The number of responses for this question", property: :responses_count
50
- field :order, types.Int, "The order in which the question should be represented", property: :order
51
- field :maxVotes, types.Int, "The maximum number of votes in this question", property: :max_votes
52
- field :minVotes, types.Int, "The minimum number of votes in this question", property: :min_votes
53
- field :responseGroupsCount, types.Int, "The number of group responses for this question", property: :response_groups_count
54
- field :instructions, Decidim::Core::TranslatedFieldType, "Instructions for this question", property: :instructions
55
- end
56
- end
57
- end