decidim-sortitions 0.20.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '088095c56f894936030019556566c32fccea654c22a0114906fa26e7814d16f5'
4
- data.tar.gz: 75368276992b14909d5bdd230cc6351a5910cf7364bab4d8c31f1af0e78ec6e5
3
+ metadata.gz: 54b457e02057cea8023ed759f75f3e7fa1eee9fc9968a3cc36dd6a5f42fa14cf
4
+ data.tar.gz: 7e285eeb5c64a787789ccea0f4d869062bf3c2bf615a2fc43a9292ffc5bae728
5
5
  SHA512:
6
- metadata.gz: 56d8ec3716ab2335bdc6f5f3af3864ded53916c46560d50a626a289f7647ca05166d5d28ce8c67b57a9f57d41b828901261a802a6fb3679bd8ab1795c59efd18
7
- data.tar.gz: fd1c356c69c0b07f3670e69f04b8c14b9a2585699fbd3d89b8c691c6d293f3d5b994f618254bedfb711c9eed0edd222cbd9154263c618885f8c37bf3329d6455
6
+ metadata.gz: 13589b2f0b5884276fae6b9acd8be841a755328f235f4e48654f7ed8ef0f4e8c1d5903dedbd4de34ef0051128273bc85ce308f7b0d977ab26215b1652d5a01eb
7
+ data.tar.gz: ab175f6fb42781b5b92047d4f1e21f9c851ec9110089cda7f269e891fa722c5af9f9b4ea0bf9c61a2da2d89b686b8bf12dd572dd6f87a4b5bc08037b39303d12
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Sortitions
5
+ SortitionType = GraphQL::ObjectType.define do
6
+ interfaces [
7
+ -> { Decidim::Core::AuthorableInterface },
8
+ -> { Decidim::Comments::CommentableInterface },
9
+ -> { Decidim::Core::CategorizableInterface }
10
+ ]
11
+
12
+ name "Sortition"
13
+ description "A sortition"
14
+
15
+ field :id, !types.ID, "The internal ID for this sortition"
16
+ field :dice, types.Int, "The dice for this sortition"
17
+ field :targetItems, types.Int, "The target items for this sortition", property: :target_items
18
+ field :requestTimestamp, Decidim::Core::DateType, "The request time stamp for this request", property: :request_timestamp
19
+ field :selectedProposals, types[types.Int], "The selected proposals for this sortition", property: :selected_proposals
20
+ field :createdAt, Decidim::Core::DateTimeType, "When this sortition was created", property: :created_at
21
+ field :updatedAt, Decidim::Core::DateTimeType, "When this sortition was updated", property: :updated_at
22
+ field :witnesses, Decidim::Core::TranslatedFieldType, "The witnesses for this sortition"
23
+ field :additionalInfo, Decidim::Core::TranslatedFieldType, "The additional info for this sortition", property: :additional_info
24
+ field :reference, types.String, "The reference for this sortition"
25
+ field :title, Decidim::Core::TranslatedFieldType, "The title for this sortition"
26
+ field :cancelReason, Decidim::Core::TranslatedFieldType, "The cancel reason for this sortition", property: :cancel_reason
27
+ field :cancelledOn, Decidim::Core::DateType, "When this sortition was cancelled", property: :cancelled_on
28
+ field :cancelledByUser, Decidim::Core::UserType, "Who cancelled this sortition", property: :cancelled_by_user
29
+ field :candidateProposals, Decidim::Core::TranslatedFieldType, "The candidate proposal for this sortition", property: :candidate_proposals
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Sortitions
5
+ SortitionsType = GraphQL::ObjectType.define do
6
+ interfaces [-> { Decidim::Core::ComponentInterface }]
7
+
8
+ name "Sortitions"
9
+ description "A sortition component of a participatory space."
10
+
11
+ connection :sortitions, SortitionType.connection_type do
12
+ resolve ->(component, _args, _ctx) {
13
+ SortitionTypeHelper.base_scope(component).includes(:component)
14
+ }
15
+ end
16
+
17
+ field(:sortition, SortitionType) do
18
+ argument :id, !types.ID
19
+
20
+ resolve ->(component, args, _ctx) {
21
+ SortitionTypeHelper.base_scope(component).find_by(id: args[:id])
22
+ }
23
+ end
24
+ end
25
+
26
+ module SortitionTypeHelper
27
+ def self.base_scope(component)
28
+ Sortition.where(component: component)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1 @@
1
+ el:
@@ -6,6 +6,7 @@ Decidim.register_component(:sortitions) do |component|
6
6
  component.icon = "decidim/sortitions/icon.svg"
7
7
  # component.stylesheet = "decidim/sortitions/sortitions"
8
8
  component.permissions_class_name = "Decidim::Sortitions::Permissions"
9
+ component.query_type = "Decidim::Sortitions::SortitionsType"
9
10
 
10
11
  component.on(:before_destroy) do |instance|
11
12
  raise StandardError, "Can't remove this component" if Decidim::Sortitions::Sortition.where(component: instance).any?
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Sortitions
5
5
  def self.version
6
- "0.20.1"
6
+ "0.21.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-sortitions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.21.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: 2020-03-27 00:00:00.000000000 Z
11
+ date: 2020-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-admin
@@ -16,70 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.20.1
19
+ version: 0.21.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.20.1
26
+ version: 0.21.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.20.1
33
+ version: 0.21.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.20.1
40
+ version: 0.21.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.20.1
47
+ version: 0.21.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.20.1
54
+ version: 0.21.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: decidim-proposals
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.20.1
61
+ version: 0.21.0
62
62
  type: :runtime
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.20.1
68
+ version: 0.21.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: decidim-dev
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.20.1
75
+ version: 0.21.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.20.1
82
+ version: 0.21.0
83
83
  description: This module makes possible to select amont a set of proposal by sortition
84
84
  email:
85
85
  - jsperezg@gmail.com
@@ -121,6 +121,8 @@ files:
121
121
  - app/queries/decidim/sortitions/filtered_sortitions.rb
122
122
  - app/services/decidim/sortitions/admin/draw.rb
123
123
  - app/services/decidim/sortitions/sortition_search.rb
124
+ - app/types/decidim/sortitions/sortition_type.rb
125
+ - app/types/decidim/sortitions/sortitions_type.rb
124
126
  - app/views/decidim/sortitions/admin/sortitions/_form.html.erb
125
127
  - app/views/decidim/sortitions/admin/sortitions/confirm_destroy.html.erb
126
128
  - app/views/decidim/sortitions/admin/sortitions/edit.html.erb
@@ -151,6 +153,7 @@ files:
151
153
  - config/locales/cs.yml
152
154
  - config/locales/de.yml
153
155
  - config/locales/el-GR.yml
156
+ - config/locales/el.yml
154
157
  - config/locales/en.yml
155
158
  - config/locales/eo-UY.yml
156
159
  - config/locales/es-MX.yml