decidim-sortitions 0.23.6 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58f70f3c5a38eb41682275c0cf0355ca2cc7da4bee496576bfbc5c4f3b6b7184
4
- data.tar.gz: 17be53af4a57f48f493964cff89095f806df5b280cc04be2a0bfebec4ed5eb41
3
+ metadata.gz: '095adb49e1dfae6f8e713f3769d97c4118f7ccadc98c420bb2d4571daa74c133'
4
+ data.tar.gz: c09f5f0eeb89f08e43f7812b2528d1363e8ba853eeb124fc32730d78b8b67fbd
5
5
  SHA512:
6
- metadata.gz: ab4b3c7b80b97ec4ec6e194fb41b8dca779da8e09ec9627d2fdc460de4da043a6e397f0171a200bdcf89b8050e406b358840d2e4f1c520b64145194a15dbd537
7
- data.tar.gz: 175ce47cabbcfa49dc4dc7b27424aa5991f07ec4b108516cb9093b11d6d6c6d909168a9290d966ada39040f8a38c49c1988aefa3f6c02fe012fc83f1a5b10d63
6
+ metadata.gz: 69da4c44caeb9c76ffdfcd74cd4ca77e3b231c818a7e2b4f06ec03e0844730f43878aefe175fb465eb2e233cdebcd3b013b54c61947b70162192a46718523b8a
7
+ data.tar.gz: c6371b962f6395ee9aeca3368a5d6ad0f02a1307b0e4787a3e02e382ffb502edd39b3d1d9b075c59088f95dd5b263ce931ecd77e9738471bbba3e9f933d60ba3
@@ -20,11 +20,9 @@ module Decidim
20
20
  translatable_fields :title, :witnesses, :additional_info, :cancel_reason
21
21
 
22
22
  belongs_to :decidim_proposals_component,
23
- foreign_key: "decidim_proposals_component_id",
24
23
  class_name: "Decidim::Component"
25
24
 
26
25
  belongs_to :cancelled_by_user,
27
- foreign_key: "cancelled_by_user_id",
28
26
  class_name: "Decidim::User",
29
27
  optional: true
30
28
 
@@ -42,7 +42,7 @@ module Decidim
42
42
  .not_hidden
43
43
  .where(component: sortition.decidim_proposals_component)
44
44
  .where("decidim_proposals_proposals.created_at < ?", request_timestamp)
45
- .where("decidim_categorizations.decidim_category_id = ?", category.id)
45
+ .where(decidim_categorizations: { decidim_category_id: category.id })
46
46
  .order(id: :asc)
47
47
  end
48
48
 
@@ -38,13 +38,17 @@
38
38
  edit_sortition_path(sortition),
39
39
  t("actions.edit", scope: "decidim.sortitions.admin"),
40
40
  class: "action-icon--edit" %>
41
- <% end %>
41
+ <% else %>
42
+ <span class="action-space icon"></span>
43
+ <% end %>
42
44
 
43
45
  <% if allowed_to? :destroy, :sortition, sortition: sortition %>
44
46
  <%= icon_link_to "circle-x",
45
47
  confirm_destroy_sortition_path(sortition),
46
48
  t("actions.destroy", scope: "decidim.sortitions.admin"),
47
49
  class: "action-icon--remove" %>
50
+ <% else %>
51
+ <span class="action-space icon"></span>
48
52
  <% end %>
49
53
  </td>
50
54
  </tr>
@@ -140,8 +140,8 @@ ca:
140
140
  sortition:
141
141
  random_seed: Llavor aleatòria
142
142
  selected_proposals:
143
- one: proposta seleccionada
144
- other: propostes seleccionades
143
+ one: 1 proposta seleccionada
144
+ other: '%{count} propostes seleccionades'
145
145
  view: Veure
146
146
  sortition_author:
147
147
  deleted: Participant eliminada
@@ -141,7 +141,7 @@ es:
141
141
  random_seed: Semilla aleatoria
142
142
  selected_proposals:
143
143
  one: 1 propuesta seleccionada
144
- other: propuestas seleccionadas
144
+ other: '%{count} propuestas seleccionadas'
145
145
  view: Ver
146
146
  sortition_author:
147
147
  deleted: Participante eliminada
@@ -37,7 +37,7 @@ fi-pl:
37
37
  sortitions_count: Satunnaistamiset
38
38
  participatory_processes:
39
39
  statistics:
40
- sortitions_count: Satunnaistamiset
40
+ sortitions_count: Satunnaistamisia
41
41
  sortitions:
42
42
  admin:
43
43
  actions:
@@ -34,10 +34,10 @@ fi:
34
34
  pages:
35
35
  home:
36
36
  statistics:
37
- sortitions_count: Satunnaistamiset
37
+ sortitions_count: Satunnaistamisia
38
38
  participatory_processes:
39
39
  statistics:
40
- sortitions_count: Satunnaistamiset
40
+ sortitions_count: Satunnaistamista
41
41
  sortitions:
42
42
  admin:
43
43
  actions:
@@ -22,10 +22,6 @@ is-IS:
22
22
  email_outro: Þú hefur fengið þessa tilkynningu vegna þess að þú fylgist með "%{participatory_space_title}". Þú getur sleppt því frá fyrri tengilinn.
23
23
  email_subject: Ný flokkun bætt við %{participatory_space_title}
24
24
  notification_title: Flokkunin <a href="%{resource_path}">%{resource_title}</a> hefur verið bætt við %{participatory_space_title}
25
- pages:
26
- home:
27
- statistics:
28
- sortitions_count: Flokkanir
29
25
  participatory_processes:
30
26
  statistics:
31
27
  sortitions_count: Flokkanir
@@ -34,10 +34,10 @@ nl:
34
34
  pages:
35
35
  home:
36
36
  statistics:
37
- sortitions_count: Loting
37
+ sortitions_count: Sortitions
38
38
  participatory_processes:
39
39
  statistics:
40
- sortitions_count: Loting
40
+ sortitions_count: Lotingen
41
41
  sortitions:
42
42
  admin:
43
43
  actions:
@@ -36,10 +36,10 @@ pl:
36
36
  pages:
37
37
  home:
38
38
  statistics:
39
- sortitions_count: Wybory losowe
39
+ sortitions_count: Wybór losowy
40
40
  participatory_processes:
41
41
  statistics:
42
- sortitions_count: Wybory losowe
42
+ sortitions_count: Wybór losowy
43
43
  sortitions:
44
44
  admin:
45
45
  actions:
@@ -35,10 +35,10 @@ ru:
35
35
  pages:
36
36
  home:
37
37
  statistics:
38
- sortitions_count: Жеребьевки
38
+ sortitions_count: Жеребьевок
39
39
  participatory_processes:
40
40
  statistics:
41
- sortitions_count: Жеребьевки
41
+ sortitions_count: Жеребьевок
42
42
  sortitions:
43
43
  admin:
44
44
  actions:
@@ -35,10 +35,10 @@ uk:
35
35
  pages:
36
36
  home:
37
37
  statistics:
38
- sortitions_count: Жеребкування
38
+ sortitions_count: Жеребкувань
39
39
  participatory_processes:
40
40
  statistics:
41
- sortitions_count: Жеребкування
41
+ sortitions_count: Жеребкувань
42
42
  sortitions:
43
43
  admin:
44
44
  actions:
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Sortitions
5
+ class SortitionType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::AuthorableInterface
7
+ implements Decidim::Comments::CommentableInterface
8
+ implements Decidim::Core::CategorizableInterface
9
+
10
+ description "A sortition"
11
+
12
+ field :id, GraphQL::Types::ID, "The internal ID for this sortition", null: false
13
+ field :dice, GraphQL::Types::Int, "The dice for this sortition", null: true
14
+ field :target_items, GraphQL::Types::Int, "The target items for this sortition", null: true
15
+ field :request_timestamp, Decidim::Core::DateType, "The request time stamp for this request", null: true
16
+ field :selected_proposals, [GraphQL::Types::Int, { null: true }], "The selected proposals for this sortition", null: true
17
+ field :created_at, Decidim::Core::DateTimeType, "When this sortition was created", null: true
18
+ field :updated_at, Decidim::Core::DateTimeType, "When this sortition was updated", null: true
19
+ field :witnesses, Decidim::Core::TranslatedFieldType, "The witnesses for this sortition", null: true
20
+ field :additional_info, Decidim::Core::TranslatedFieldType, "The additional info for this sortition", null: true
21
+ field :reference, GraphQL::Types::String, "The reference for this sortition", null: true
22
+ field :title, Decidim::Core::TranslatedFieldType, "The title for this sortition", null: true
23
+ field :cancel_reason, Decidim::Core::TranslatedFieldType, "The cancel reason for this sortition", null: true
24
+ field :cancelled_on, Decidim::Core::DateType, "When this sortition was cancelled", null: true
25
+ field :cancelled_by_user, Decidim::Core::UserType, "Who cancelled this sortition", null: true
26
+ field :candidate_proposals, [GraphQL::Types::Int, { null: true }], "The candidate proposal for this sortition", null: true
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Sortitions
5
+ class SortitionsType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::ComponentInterface
7
+
8
+ graphql_name "Sortitions"
9
+ description "A sortition component of a participatory space."
10
+
11
+ field :sortitions, Decidim::Sortitions::SortitionType.connection_type, null: true, connection: true
12
+
13
+ def sortitions
14
+ Sortition.where(component: object).includes(:component)
15
+ end
16
+
17
+ field :sortition, Decidim::Sortitions::SortitionType, null: true do
18
+ argument :id, GraphQL::Types::ID, required: true
19
+ end
20
+
21
+ def sortition(**args)
22
+ Sortition.where(component: object).find_by(id: args[:id])
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Sortitions
5
+ autoload :SortitionType, "decidim/api/sortition_type"
6
+ autoload :SortitionsType, "decidim/api/sortitions_type"
7
+ end
8
+ end
@@ -20,8 +20,8 @@ FactoryBot.define do
20
20
  create(:user, :admin, organization: component.organization) if component
21
21
  end
22
22
 
23
- dice { Faker::Number.between(1, 6).to_i }
24
- target_items { Faker::Number.between(1, 5).to_i }
23
+ dice { Faker::Number.between(from: 1, to: 6).to_i }
24
+ target_items { Faker::Number.between(from: 1, to: 5).to_i }
25
25
  request_timestamp { Time.now.utc }
26
26
  witnesses { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
27
27
  additional_info { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Sortitions
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/sortitions/admin"
4
+ require "decidim/sortitions/api"
4
5
  require "decidim/sortitions/engine"
5
6
  require "decidim/sortitions/admin_engine"
6
7
  require "decidim/sortitions/component"
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.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,70 +16,70 @@ 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-proposals
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: :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.23.6
68
+ version: 0.24.0.rc1
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.23.6
75
+ version: 0.24.0.rc1
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.23.6
82
+ version: 0.24.0.rc1
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,8 +121,6 @@ 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
126
124
  - app/views/decidim/sortitions/admin/sortitions/_form.html.erb
127
125
  - app/views/decidim/sortitions/admin/sortitions/confirm_destroy.html.erb
128
126
  - app/views/decidim/sortitions/admin/sortitions/edit.html.erb
@@ -230,9 +228,12 @@ files:
230
228
  - db/migrate/20181017110803_make_sortitions_authors_polymorphic.rb
231
229
  - db/migrate/20200320105926_index_foreign_keys_in_decidim_sortitions_sortitions.rb
232
230
  - db/migrate/20200827154036_add_commentable_counter_cache_to_sortitions.rb
231
+ - lib/decidim/api/sortition_type.rb
232
+ - lib/decidim/api/sortitions_type.rb
233
233
  - lib/decidim/sortitions.rb
234
234
  - lib/decidim/sortitions/admin.rb
235
235
  - lib/decidim/sortitions/admin_engine.rb
236
+ - lib/decidim/sortitions/api.rb
236
237
  - lib/decidim/sortitions/component.rb
237
238
  - lib/decidim/sortitions/engine.rb
238
239
  - lib/decidim/sortitions/test/factories.rb
@@ -249,14 +250,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
249
250
  requirements:
250
251
  - - ">="
251
252
  - !ruby/object:Gem::Version
252
- version: '2.6'
253
+ version: '2.7'
253
254
  required_rubygems_version: !ruby/object:Gem::Requirement
254
255
  requirements:
255
- - - ">="
256
+ - - ">"
256
257
  - !ruby/object:Gem::Version
257
- version: '0'
258
+ version: 1.3.1
258
259
  requirements: []
259
- rubygems_version: 3.0.3
260
+ rubygems_version: 3.1.2
260
261
  signing_key:
261
262
  specification_version: 4
262
263
  summary: Decidim sortitions module
@@ -1,32 +0,0 @@
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
@@ -1,32 +0,0 @@
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