decidim-sortitions 0.23.2 → 0.24.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: 43f24822ad3374dc9237326eb809dd209fbee00cddf1818f26eef2e3f3bcc2a1
4
- data.tar.gz: 86ca16613d1da13cf13106904626530c7a8c5eba32ee41eccefadabe1c69f677
3
+ metadata.gz: c2f515cd08546e4b2b5cfb5c85282f009d3d63dc6570e662dde2ae01f4db793e
4
+ data.tar.gz: 5d515b77243bb11d4bc8c5bd6ddce166f2eded43c2a967a3070487c7bd6eba71
5
5
  SHA512:
6
- metadata.gz: 60fb04371dc092f49ab2e18501673bfd5bd0d298f6c893de19eb2a7b5314ad3b9fc850e6287f65dadaa1686fb81043d69310e11cb2cfbafd7904768746b15cdc
7
- data.tar.gz: 8d15f88dd6809d99aa3d7ef174e224e009c550f2ef5429c186aeca15bce5eb46bea536df259ae16215435c770c8f5f3d06aa3fefceddcf90cb69d09e1ade61f1
6
+ metadata.gz: b8ced7c706fb25584c5e2c602e281cfc05d1e037394164a3fdadb1c97a94522951355b88ae90b0e3e546e895e131dbf6271c23549ea301b4efd88cbf69018e17
7
+ data.tar.gz: 94d97774b527a29a7d60abc3cf1a661706af2eaffd7bc1c4788810cb55ac236c380bfcbb8a2604c2ee1fb9c5bb8d27ef33290e3db962cb4fd389900945737676
@@ -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>
@@ -13,6 +13,6 @@
13
13
  </button>
14
14
  </div>
15
15
  <div class="filters">
16
- <%= render partial: "filters" %>
16
+ <%= render partial: "filters", locals: { type: :small } %>
17
17
  </div>
18
18
  </div>
@@ -140,8 +140,8 @@ ca:
140
140
  sortition:
141
141
  random_seed: Llavor aleatòria
142
142
  selected_proposals:
143
- one: 1 proposta seleccionada
144
- other: '%{count} propostes seleccionades'
143
+ one: proposta seleccionada
144
+ other: 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: '%{count} propuestas seleccionadas'
144
+ other: 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: Satunnaistamisia
40
+ sortitions_count: Satunnaistamiset
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: Satunnaistamisia
37
+ sortitions_count: Satunnaistamiset
38
38
  participatory_processes:
39
39
  statistics:
40
- sortitions_count: Satunnaistamista
40
+ sortitions_count: Satunnaistamiset
41
41
  sortitions:
42
42
  admin:
43
43
  actions:
@@ -22,6 +22,10 @@ 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
25
29
  participatory_processes:
26
30
  statistics:
27
31
  sortitions_count: Flokkanir
@@ -34,10 +34,10 @@ nl:
34
34
  pages:
35
35
  home:
36
36
  statistics:
37
- sortitions_count: Sortitions
37
+ sortitions_count: Loting
38
38
  participatory_processes:
39
39
  statistics:
40
- sortitions_count: Lotingen
40
+ sortitions_count: Loting
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: Wybór losowy
39
+ sortitions_count: Wybory losowe
40
40
  participatory_processes:
41
41
  statistics:
42
- sortitions_count: Wybór losowy
42
+ sortitions_count: Wybory losowe
43
43
  sortitions:
44
44
  admin:
45
45
  actions:
@@ -114,7 +114,7 @@ pl:
114
114
  search: Szukaj
115
115
  state: Status
116
116
  filters_small_view:
117
- close_modal: Zamknij modalne
117
+ close_modal: Zamknij okno
118
118
  filter: Filtr
119
119
  filter_by: Filtruj według
120
120
  unfold: Rozwiń
@@ -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
@@ -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"
@@ -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.2"
6
+ "0.24.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.23.2
4
+ version: 0.24.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: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2021-03-26 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.2
19
+ version: 0.24.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.23.2
26
+ version: 0.24.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.23.2
33
+ version: 0.24.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.23.2
40
+ version: 0.24.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.23.2
47
+ version: 0.24.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.23.2
54
+ version: 0.24.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.23.2
61
+ version: 0.24.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.23.2
68
+ version: 0.24.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.23.2
75
+ version: 0.24.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.23.2
82
+ version: 0.24.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,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
258
  version: '0'
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