decidim-sortitions 0.27.5 → 0.27.6

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: ade1fb25c5b4452362c016ebbb2c9a4e3459034695c6ddb984a1481f3087b984
4
- data.tar.gz: 94732860aa85b4e32bc7ff7072bb194f0a51ed8edf72ffeea019da5ca7bed6b5
3
+ metadata.gz: d3f3f195e687563902d388e9cedbc8430378a6a072b5f998650d3068b76aec3e
4
+ data.tar.gz: 037313434d4200f71a148758e354b5253a4fb9b36b8d8992481c76926efa10b2
5
5
  SHA512:
6
- metadata.gz: fa4b5e75927bce8920a6f555f2c9b15bbccfce814554dad1e1c8d17977671f1b2f15a5fc996d6115835992d56da95c7974bd6d0762b4e0e6032b191675ef8a4a
7
- data.tar.gz: 8c7a121be6755d6c5b51ecdfec12be221fa547171a1610c1fc6a1e3965de7c6975b5d2d47f4ca31933714b6bb65d0059dfc5257f88caec713c1aaf8eb1d40957
6
+ metadata.gz: 86b6179b79eb8dc0d11c93d6b1ae2b9a1e35e522204acaf4963771a4dcb93fe6760e15c54d5c33cef5dbb16d85bb3d644c75341d68b4d37ea30630bdc9e2f673
7
+ data.tar.gz: '0902b6c5048f567ab5753be849b45f909df50ecc28fd7101683c6b81ab8b272911270d1b1f8626e929b7d37fb0f64b203f7c726f6fc7208d55f0762fa032b28f'
@@ -6,15 +6,25 @@ module Decidim
6
6
  helper Decidim::SanitizeHelper
7
7
  helper Sortitions::SortitionsHelper
8
8
 
9
+ def show
10
+ enforce_permission_to :embed, :sortition, sortition: model if model
11
+
12
+ super
13
+ end
14
+
9
15
  private
10
16
 
11
17
  def model
12
- @model ||= Sortition.where(component: params[:component_id]).find(params[:sortition_id])
18
+ @model ||= Sortition.where(component: current_component).find(params[:sortition_id])
13
19
  end
14
20
 
15
21
  def iframe_url
16
22
  @iframe_url ||= sortition_widget_url(model)
17
23
  end
24
+
25
+ def permission_class_chain
26
+ [Decidim::Sortitions::Permissions]
27
+ end
18
28
  end
19
29
  end
20
30
  end
@@ -4,12 +4,26 @@ module Decidim
4
4
  module Sortitions
5
5
  class Permissions < Decidim::DefaultPermissions
6
6
  def permissions
7
+ allow_embed_sortition?
7
8
  return permission_action unless user
8
9
 
9
10
  return Decidim::Sortitions::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
10
11
 
11
12
  permission_action
12
13
  end
14
+
15
+ private
16
+
17
+ def sortition
18
+ @sortition ||= context.fetch(:sortition, nil) || context.fetch(:resource, nil)
19
+ end
20
+
21
+ # As this is a public action, we need to run this before other checks
22
+ def allow_embed_sortition?
23
+ return unless permission_action.action == :embed && permission_action.subject == :sortition && sortition
24
+
25
+ allow!
26
+ end
13
27
  end
14
28
  end
15
29
  end
@@ -6,3 +6,39 @@ bg:
6
6
  additional_info: Сортиране на информация
7
7
  decidim_category_id: Категории от набора от предложения, в които искате да приложите жребий
8
8
  decidim_proposals_component_id: Предложенията са зададени
9
+ decidim:
10
+ sortitions:
11
+ admin:
12
+ sortitions:
13
+ create:
14
+ success: Жребият беше създаден успешно
15
+ destroy:
16
+ error: Жребият не може да се отмени.
17
+ success: Жребият беше отменен успешно
18
+ form:
19
+ title: Нов жребий за предложения
20
+ new:
21
+ confirm: Когато натиснете бутона „Напред“, системата ще запише датата и часа (с точност до секунди) и заедно с хвърлянето на зара тази информация ще се използва за генериране на избор на случаен принцип. Действието няма да може да бъде отменено — когато щракнете върху бутона, резултатът от жребия ще бъде публикуван заедно с въведените в този формуляр данни и няма да подлежи на промяна. Моля, прегледайте съдържанието внимателно
22
+ update:
23
+ success: Жребият беше актуализиран успешно
24
+ sortitions:
25
+ filters:
26
+ category_prompt: Изберете категория
27
+ search: Търсене
28
+ filters_small_view:
29
+ close_modal: Затвори прозореца
30
+ filter: Филтър
31
+ filter_by: Филтрирай по
32
+ unfold: Разгъване
33
+ results_count:
34
+ count:
35
+ one: избрано предложение
36
+ other: избрани предложения
37
+ show:
38
+ back: Назад към списъка
39
+ dice_result: "(1) Резултат от жребия"
40
+ mathematical_result: Резултат (1) x (2)
41
+ sortition_reproducibility_details: Подробности за възпроизвеждане на жребия
42
+ time_seed: "(2) Време за зареждане"
43
+ sortition:
44
+ view: Изглед
@@ -31,7 +31,7 @@ ca:
31
31
  sortitions:
32
32
  sortition_created:
33
33
  email_intro: El sorteig "%{resource_title}" s'ha afegit a "%{participatory_space_title}" que segueixes.
34
- email_outro: Has rebut aquesta notificació perquè estàs seguint "%{participatory_space_title}". Pots deixar de seguir-lo des de l'enllaç anterior.
34
+ email_outro: Has rebut aquesta notificació perquè estàs seguint l'espai "%{participatory_space_title}". Pots deixar de seguir-lo des de l'enllaç anterior.
35
35
  email_subject: Nou sorteig afegit a %{participatory_space_title}
36
36
  notification_title: El sorteig <a href="%{resource_path}">%{resource_title}</a> s'ha afegit a %{participatory_space_title}
37
37
  sortitions:
@@ -102,7 +102,7 @@ de:
102
102
  category: Kategorie
103
103
  category_prompt: Wählen Sie eine Kategorie
104
104
  search: Suche
105
- state: Zustand
105
+ state: Status
106
106
  filters_small_view:
107
107
  close_modal: Modal schließen
108
108
  filter: Filter
@@ -0,0 +1 @@
1
+ he:
@@ -11,7 +11,7 @@ pt-BR:
11
11
  title: Título
12
12
  witnesses: Testemunhas
13
13
  models:
14
- decidim/sortitions/create_sortition_event: Sorteio
14
+ decidim/sortitions/create_sortition_event: Classificação
15
15
  activerecord:
16
16
  models:
17
17
  decidim/sortitions/sortition:
@@ -20,6 +20,8 @@ pt-BR:
20
20
  decidim:
21
21
  components:
22
22
  sortitions:
23
+ actions:
24
+ comment: Comentário
23
25
  name: Sorteios
24
26
  settings:
25
27
  global:
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path("lib", __dir__)
4
+
5
+ require "decidim/sortitions/version"
6
+
7
+ Gem::Specification.new do |s|
8
+ s.version = Decidim::Sortitions.version
9
+ s.authors = ["Juan Salvador Perez Garcia"]
10
+ s.email = ["jsperezg@gmail.com"]
11
+ s.license = "AGPL-3.0"
12
+ s.homepage = "https://github.com/decidim/decidim"
13
+ s.required_ruby_version = "~> 3.0.0"
14
+
15
+ s.name = "decidim-sortitions"
16
+ s.summary = "Decidim sortitions module"
17
+ s.description = "This module makes possible to select amont a set of proposal by sortition"
18
+
19
+ s.files = Dir.chdir(__dir__) do
20
+ `git ls-files -z`.split("\x0").select do |f|
21
+ (File.expand_path(f) == __FILE__) ||
22
+ f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md))
23
+ end
24
+ end
25
+
26
+ s.add_dependency "decidim-admin", Decidim::Sortitions.version
27
+ s.add_dependency "decidim-comments", Decidim::Sortitions.version
28
+ s.add_dependency "decidim-core", Decidim::Sortitions.version
29
+ s.add_dependency "decidim-proposals", Decidim::Sortitions.version
30
+
31
+ s.add_development_dependency "decidim-dev", Decidim::Sortitions.version
32
+ end
@@ -6,16 +6,22 @@ require "decidim/participatory_processes/test/factories"
6
6
 
7
7
  FactoryBot.define do
8
8
  factory :sortition_component, parent: :component do
9
- name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :sortitions).i18n_name }
9
+ transient do
10
+ skip_injection { false }
11
+ end
12
+ name { generate_component_name(participatory_space.organization.available_locales, :sortitions, skip_injection: skip_injection) }
10
13
  manifest_name { :sortitions }
11
- participatory_space { create(:participatory_process, :with_steps, organization: organization) }
14
+ participatory_space { create(:participatory_process, :with_steps, organization: organization, skip_injection: skip_injection) }
12
15
  end
13
16
 
14
17
  factory :sortition, class: "Decidim::Sortitions::Sortition" do
15
- component { create(:sortition_component) }
16
- decidim_proposals_component { create(:proposal_component, organization: component.organization) }
18
+ transient do
19
+ skip_injection { false }
20
+ end
21
+ component { create(:sortition_component, skip_injection: skip_injection) }
22
+ decidim_proposals_component { create(:proposal_component, organization: component.organization, skip_injection: skip_injection) }
17
23
 
18
- title { generate_localized_title }
24
+ title { generate_localized_title(:sortition_title, skip_injection: skip_injection) }
19
25
  author do
20
26
  create(:user, :admin, organization: component.organization) if component
21
27
  end
@@ -23,15 +29,15 @@ FactoryBot.define do
23
29
  dice { Faker::Number.between(from: 1, to: 6).to_i }
24
30
  target_items { Faker::Number.between(from: 1, to: 5).to_i }
25
31
  request_timestamp { Time.now.utc }
26
- witnesses { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
27
- additional_info { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
28
- selected_proposals { create_list(:proposal, target_items, component: decidim_proposals_component).pluck(:id) }
32
+ witnesses { generate_localized_description(:sortition_witnesses, skip_injection: skip_injection) }
33
+ additional_info { generate_localized_description(:sortition_additional_info, skip_injection: skip_injection) }
34
+ selected_proposals { create_list(:proposal, target_items, component: decidim_proposals_component, skip_injection: skip_injection).pluck(:id) }
29
35
  candidate_proposals { selected_proposals }
30
36
 
31
37
  trait :cancelled do
32
38
  cancelled_on { Time.now.utc }
33
- cancel_reason { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
34
- cancelled_by_user { create(:user, :admin, organization: component.organization) if component }
39
+ cancel_reason { generate_localized_description(:sortition_cancel_reason, skip_injection: skip_injection) }
40
+ cancelled_by_user { create(:user, :admin, organization: component.organization, skip_injection: skip_injection) if component }
35
41
  end
36
42
  end
37
43
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Sortitions
5
5
  def self.version
6
- "0.27.5"
6
+ "0.27.6"
7
7
  end
8
8
  end
9
9
  end
File without changes
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.27.5
4
+ version: 0.27.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Salvador Perez Garcia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-20 00:00:00.000000000 Z
11
+ date: 2024-04-30 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.27.5
19
+ version: 0.27.6
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.27.5
26
+ version: 0.27.6
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.27.5
33
+ version: 0.27.6
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.27.5
40
+ version: 0.27.6
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.27.5
47
+ version: 0.27.6
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.27.5
54
+ version: 0.27.6
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.27.5
61
+ version: 0.27.6
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.27.5
68
+ version: 0.27.6
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.27.5
75
+ version: 0.27.6
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.27.5
82
+ version: 0.27.6
83
83
  description: This module makes possible to select amont a set of proposal by sortition
84
84
  email:
85
85
  - jsperezg@gmail.com
@@ -144,7 +144,6 @@ files:
144
144
  - app/views/decidim/sortitions/sortitions/index.js.erb
145
145
  - app/views/decidim/sortitions/sortitions/show.html.erb
146
146
  - config/assets.rb
147
- - config/environment.rb
148
147
  - config/locales/am-ET.yml
149
148
  - config/locales/ar-SA.yml
150
149
  - config/locales/ar.yml
@@ -177,6 +176,7 @@ files:
177
176
  - config/locales/ga-IE.yml
178
177
  - config/locales/gl.yml
179
178
  - config/locales/gn-PY.yml
179
+ - config/locales/he-IL.yml
180
180
  - config/locales/hr-HR.yml
181
181
  - config/locales/hr.yml
182
182
  - config/locales/hu.yml
@@ -240,6 +240,7 @@ files:
240
240
  - db/migrate/20181017110803_make_sortitions_authors_polymorphic.rb
241
241
  - db/migrate/20200320105926_index_foreign_keys_in_decidim_sortitions_sortitions.rb
242
242
  - db/migrate/20200827154036_add_commentable_counter_cache_to_sortitions.rb
243
+ - decidim-sortitions.gemspec
243
244
  - lib/decidim/api/sortition_type.rb
244
245
  - lib/decidim/api/sortitions_type.rb
245
246
  - lib/decidim/sortitions.rb
@@ -250,27 +251,28 @@ files:
250
251
  - lib/decidim/sortitions/engine.rb
251
252
  - lib/decidim/sortitions/test/factories.rb
252
253
  - lib/decidim/sortitions/version.rb
254
+ - lib/tasks/decidim/.keep
253
255
  homepage: https://github.com/decidim/decidim
254
256
  licenses:
255
257
  - AGPL-3.0
256
258
  metadata: {}
257
- post_install_message:
259
+ post_install_message:
258
260
  rdoc_options: []
259
261
  require_paths:
260
262
  - lib
261
263
  required_ruby_version: !ruby/object:Gem::Requirement
262
264
  requirements:
263
- - - ">="
265
+ - - "~>"
264
266
  - !ruby/object:Gem::Version
265
- version: '3.0'
267
+ version: 3.0.0
266
268
  required_rubygems_version: !ruby/object:Gem::Requirement
267
269
  requirements:
268
270
  - - ">="
269
271
  - !ruby/object:Gem::Version
270
272
  version: '0'
271
273
  requirements: []
272
- rubygems_version: 3.4.22
273
- signing_key:
274
+ rubygems_version: 3.2.22
275
+ signing_key:
274
276
  specification_version: 4
275
277
  summary: Decidim sortitions module
276
278
  test_files: []
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Empty line for playing nice with tpope/vim-rails