decidim-consultations 0.23.6 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) 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 +5 -1
  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/layouts/decidim/admin/consultation.html.erb +8 -23
  13. data/app/views/layouts/decidim/admin/consultations.html.erb +4 -0
  14. data/config/locales/ar.yml +0 -2
  15. data/config/locales/ca.yml +0 -2
  16. data/config/locales/cs.yml +8 -7
  17. data/config/locales/de.yml +3 -2
  18. data/config/locales/el.yml +0 -2
  19. data/config/locales/en.yml +3 -2
  20. data/config/locales/es-MX.yml +2 -2
  21. data/config/locales/es-PY.yml +2 -2
  22. data/config/locales/es.yml +2 -2
  23. data/config/locales/eu.yml +0 -2
  24. data/config/locales/fi-plain.yml +3 -2
  25. data/config/locales/fi.yml +4 -3
  26. data/config/locales/fr-CA.yml +3 -2
  27. data/config/locales/fr.yml +3 -2
  28. data/config/locales/gl.yml +0 -2
  29. data/config/locales/hu.yml +0 -2
  30. data/config/locales/id-ID.yml +0 -2
  31. data/config/locales/is-IS.yml +0 -4
  32. data/config/locales/it.yml +2 -2
  33. data/config/locales/ja.yml +0 -2
  34. data/config/locales/lv.yml +0 -2
  35. data/config/locales/nl.yml +2 -3
  36. data/config/locales/no.yml +0 -2
  37. data/config/locales/pl.yml +3 -2
  38. data/config/locales/pt-BR.yml +0 -2
  39. data/config/locales/pt.yml +0 -2
  40. data/config/locales/ro-RO.yml +0 -51
  41. data/config/locales/ru.yml +1 -1
  42. data/config/locales/sk.yml +0 -2
  43. data/config/locales/sv.yml +0 -2
  44. data/config/locales/tr-TR.yml +3 -3
  45. data/config/locales/uk.yml +1 -1
  46. data/config/locales/zh-CN.yml +0 -2
  47. data/lib/decidim/api/consultation_question_type.rb +52 -0
  48. data/lib/decidim/api/consultation_type.rb +29 -0
  49. data/lib/decidim/consultations/admin_engine.rb +25 -1
  50. data/lib/decidim/consultations/api.rb +8 -0
  51. data/lib/decidim/consultations/engine.rb +7 -1
  52. data/lib/decidim/consultations/participatory_space.rb +24 -24
  53. data/lib/decidim/consultations/query_extensions.rb +43 -0
  54. data/lib/decidim/consultations/test/factories.rb +2 -2
  55. data/lib/decidim/consultations/version.rb +1 -1
  56. data/lib/decidim/consultations.rb +1 -0
  57. metadata +19 -16
  58. data/app/types/decidim/consultations/consultation_question_type.rb +0 -57
  59. data/app/types/decidim/consultations/consultation_type.rb +0 -32
@@ -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.6"
6
+ "0.24.0.rc1"
7
7
  end
8
8
  end
9
9
  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"
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.6
4
+ version: 0.24.0.rc1
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-05-10 00:00:00.000000000 Z
11
+ date: 2021-03-01 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.6
19
+ version: 0.24.0.rc1
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.6
26
+ version: 0.24.0.rc1
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.6
33
+ version: 0.24.0.rc1
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.6
40
+ version: 0.24.0.rc1
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.6
47
+ version: 0.24.0.rc1
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.6
54
+ version: 0.24.0.rc1
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.6
61
+ version: 0.24.0.rc1
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.6
68
+ version: 0.24.0.rc1
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
@@ -353,11 +352,15 @@ files:
353
352
  - db/seeds/city.jpeg
354
353
  - db/seeds/city2.jpeg
355
354
  - db/seeds/homepage_image.jpg
355
+ - lib/decidim/api/consultation_question_type.rb
356
+ - lib/decidim/api/consultation_type.rb
356
357
  - lib/decidim/consultations.rb
357
358
  - lib/decidim/consultations/admin.rb
358
359
  - lib/decidim/consultations/admin_engine.rb
360
+ - lib/decidim/consultations/api.rb
359
361
  - lib/decidim/consultations/engine.rb
360
362
  - lib/decidim/consultations/participatory_space.rb
363
+ - lib/decidim/consultations/query_extensions.rb
361
364
  - lib/decidim/consultations/test/factories.rb
362
365
  - lib/decidim/consultations/version.rb
363
366
  homepage: https://github.com/decidim/decidim
@@ -372,14 +375,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
372
375
  requirements:
373
376
  - - ">="
374
377
  - !ruby/object:Gem::Version
375
- version: '2.6'
378
+ version: '2.7'
376
379
  required_rubygems_version: !ruby/object:Gem::Requirement
377
380
  requirements:
378
- - - ">="
381
+ - - ">"
379
382
  - !ruby/object:Gem::Version
380
- version: '0'
383
+ version: 1.3.1
381
384
  requirements: []
382
- rubygems_version: 3.0.3
385
+ rubygems_version: 3.1.2
383
386
  signing_key:
384
387
  specification_version: 4
385
388
  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
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Consultations
5
- # This type represents a consultation.
6
- ConsultationType = GraphQL::ObjectType.define do
7
- interfaces [
8
- -> { Decidim::Core::ParticipatorySpaceInterface }
9
- ]
10
-
11
- name "Consultation"
12
- description "A consultation"
13
-
14
- field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this consultation"
15
- field :description, Decidim::Core::TranslatedFieldType, "The description of this consultation"
16
- field :slug, !types.String, "Slug of this consultation"
17
- field :createdAt, !Decidim::Core::DateTimeType, "The time this consultation was created", property: :created_at
18
- field :updatedAt, !Decidim::Core::DateTimeType, "The time this consultation was updated", property: :updated_at
19
- field :publishedAt, !Decidim::Core::DateTimeType, "The time this consultation was published", property: :published_at
20
-
21
- field :introductoryVideoUrl, types.String, "The introductory video url for this consultation", property: :introductory_video_url
22
- field :introductoryImage, types.String, "The introductory image for this consultation", property: :introductory_image
23
- field :bannerImage, types.String, "The banner image for this consultation", property: :banner_image
24
- field :highlightedScope, Decidim::Core::ScopeApiType, "This is the highlighted scope of this consultation", property: :highlighted_scope
25
- field :startVotingDate, Decidim::Core::DateType, "Start date of the voting for this consultation", property: :start_voting_date
26
- field :endVotingDate, Decidim::Core::DateType, "End date of the voting for this consultation", property: :end_voting_date
27
- field :resultsPublishedAt, Decidim::Core::DateType, "Date when the results have been published", property: :results_published_at
28
-
29
- field :questions, types[Decidim::Consultations::ConsultationQuestionType], ""
30
- end
31
- end
32
- end