decidim-sortitions 0.27.5 → 0.27.7

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: ade1fb25c5b4452362c016ebbb2c9a4e3459034695c6ddb984a1481f3087b984
4
- data.tar.gz: 94732860aa85b4e32bc7ff7072bb194f0a51ed8edf72ffeea019da5ca7bed6b5
3
+ metadata.gz: f9182cabb7a3cb96a2f9cf3b5cf534720edd44e1d042a7faf402c94ac6f5e614
4
+ data.tar.gz: d72beb48fdcce1dd3efbafcf0682cb8493d33623b4b507da91a0c196d9a07eff
5
5
  SHA512:
6
- metadata.gz: fa4b5e75927bce8920a6f555f2c9b15bbccfce814554dad1e1c8d17977671f1b2f15a5fc996d6115835992d56da95c7974bd6d0762b4e0e6032b191675ef8a4a
7
- data.tar.gz: 8c7a121be6755d6c5b51ecdfec12be221fa547171a1610c1fc6a1e3965de7c6975b5d2d47f4ca31933714b6bb65d0059dfc5257f88caec713c1aaf8eb1d40957
6
+ metadata.gz: 1fc58bdd011d250e810ee54c4722ba99d655f07c0234357aaeaf50b665a9239eae506c50ed7473afe589d6f263b9d4b432df17bc7b156d6510b298f79a2922a9
7
+ data.tar.gz: bd49e97b373cbecfaa2443ba472c51945ca5b6c8c88b4e0a2e30be117233cb65c941c217cc261a93dc9547074b4d924372691dd7fed589ad7cbd4ed48364adf9
@@ -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
@@ -3,6 +3,149 @@ bg:
3
3
  activemodel:
4
4
  attributes:
5
5
  sortition:
6
- additional_info: Сортиране на информация
6
+ additional_info: Информация за сортировката
7
7
  decidim_category_id: Категории от набора от предложения, в които искате да приложите жребий
8
8
  decidim_proposals_component_id: Предложенията са зададени
9
+ dice: Резултат от хвърлянето на зара. Хвърлете 6-странен зар или потърсете друг произволен начин за генериране на число от 1 до 6 и въведете тук полученото число пред няколко свидетели. Това допринася за качеството и гаранции за случайността на резултата
10
+ target_items: Брой на предложенията, които да бъдат избрани (указва броя на предложенията, които искате да бъдат избрани чрез хвърляне на жребий от групата предложения, които сте избрали по-рано)
11
+ title: Заглавие
12
+ witnesses: Свидетели
13
+ models:
14
+ decidim/sortitions/create_sortition_event: Сортиране
15
+ activerecord:
16
+ models:
17
+ decidim/sortitions/sortition:
18
+ one: Сортиране
19
+ other: Сортирания
20
+ decidim:
21
+ components:
22
+ sortitions:
23
+ actions:
24
+ comment: Коментар
25
+ name: Сортирания
26
+ settings:
27
+ global:
28
+ comments_enabled: Коментарите са разрешени
29
+ comments_max_length: Максимална дължина на коментарите (Оставете 0 за стойност по подразбиране)
30
+ events:
31
+ sortitions:
32
+ sortition_created:
33
+ email_intro: Сортировката „%{resource_title}“ беше добавена към пространството за участие „%{participatory_space_title}“, което следвате.
34
+ email_outro: Получавате това известие, защото следвате "%{participatory_space_title}". Може да премахнете следването чрез предходния линк.
35
+ email_subject: Беше добавена нова сортировка в(ъв) %{participatory_space_title}
36
+ notification_title: Сортировката <a href="%{resource_path}">%{resource_title}</a> беше добавена в(ъв) %{participatory_space_title}
37
+ sortitions:
38
+ admin:
39
+ actions:
40
+ destroy: Отмяна на сортировката
41
+ edit: Редактирай
42
+ new: Нова сортировка
43
+ show: Детайли за сортировката
44
+ models:
45
+ sortition:
46
+ fields:
47
+ category: Категория
48
+ created_at: Дата на създаване
49
+ decidim_proposals_component: Компонент Предложения
50
+ dice: Зар
51
+ reference: Препоръка
52
+ request_timestamp: Време за теглене на жребий
53
+ seed: Seed
54
+ target_items: Елементи за селектиране
55
+ title: Заглавие
56
+ name:
57
+ one: Сортиране
58
+ other: Сортирания
59
+ sortitions:
60
+ confirm_destroy:
61
+ confirm_destroy: Наистина ли искате да отмените тази сортировка?
62
+ destroy: Отмяна на сортировка
63
+ title: Отменяне на сортировката
64
+ create:
65
+ error: Възникна проблем при създаването на нова сортировка.
66
+ success: Жребият беше създаден успешно
67
+ destroy:
68
+ error: Жребият не може да се отмени.
69
+ success: Жребият беше отменен успешно
70
+ edit:
71
+ title: Актуализирайте информацията за сортировката
72
+ update: Актуализация
73
+ form:
74
+ all_categories: Всички категории
75
+ select_proposal_component: Изберете набора от предложения
76
+ title: Нов жребий за предложения
77
+ index:
78
+ title: Сортировки
79
+ new:
80
+ confirm: Когато натиснете бутона „Напред“, системата ще запише датата и часа (с точност до секунди) и заедно с хвърлянето на зара тази информация ще се използва за генериране на избор на случаен принцип. Действието няма да може да бъде отменено — когато щракнете върху бутона, резултатът от жребия ще бъде публикуван заедно с въведените в този формуляр данни и няма да подлежи на промяна. Моля, прегледайте съдържанието внимателно
81
+ create: Създаване
82
+ title: Нова сортировка
83
+ show:
84
+ selected_proposals: Избрани предложения за жребия
85
+ update:
86
+ error: Възникна проблем при актуализирането на сортировката.
87
+ success: Жребият беше актуализиран успешно
88
+ admin_log:
89
+ sortition:
90
+ create: "%{user_name} създаде сортировка %{resource_name} в пространството %{space_name}"
91
+ delete: "%{user_name} отмени сортировката %{resource_name} в пространството %{space_name}"
92
+ update: "%{user_name} актуализира сортировката %{resource_name} в пространството %{space_name}"
93
+ sortitions:
94
+ count:
95
+ proposals_count:
96
+ one: 1 предложение
97
+ other: "%{count} предложения"
98
+ filters:
99
+ active: Активно
100
+ all: Всички
101
+ cancelled: Отменено
102
+ category: Категория
103
+ category_prompt: Изберете категория
104
+ search: Търсене
105
+ state: Статус
106
+ filters_small_view:
107
+ close_modal: Затвори прозореца
108
+ filter: Филтър
109
+ filter_by: Филтрирай по
110
+ unfold: Разгъване
111
+ linked_sortitions:
112
+ selected_proposals: Избрани предложения
113
+ orders:
114
+ label: 'Подреждане на сортировките по:'
115
+ random: Случаен
116
+ recent: Скорошни
117
+ results_count:
118
+ count:
119
+ one: избрано предложение
120
+ other: избрани предложения
121
+ show:
122
+ algorithm: Код на алгоритъма за жребия в сортировката
123
+ any_category: от всички категории
124
+ back: Назад към списъка
125
+ cancelled: Отменена сортировка
126
+ candidate_proposal_ids: Ред и ID номерата на предложенията в сортировката
127
+ candidate_proposals_info: 'Сортирането беше извършено сред следните предложения (%{category_label}), със следните идентификатори (с удебелен шрифт избраните предложения) '
128
+ category: от категорията %{category}
129
+ dice_result: "(1) Резултат от жребия"
130
+ introduction: 'Тази страница съдържа резултатите от сортирането %{reference}. Чрез това сортиране, %{target_items} брой резултати са избрани на случаен принцип и с равно вероятностно разпределение от набора от предложения, показани по-долу. Заедно с резултатите, информацията, показана на тази страница, предоставя цялата информация, необходима за максимизиране на гаранциите и за възпроизвеждане на резултатите. Ключът към качеството на това сортиране е двойната случайност, осигурена от хвърлянето на зарове (потвърдено от свидетели) и точното време на сортирането, което осигурява вход за алгоритъм, който генерира случаен избор. Времето за начало за сортирането е толкова точно (секунди), че е невъзможно да се контролира от хора, като по този начин се осигурява двоен „неконтролируем“ вход, за да се гарантира справедлив резултат. '
131
+ mathematical_result: Резултат (1) x (2)
132
+ proposals_selected_by_sortition: Избрани чрез (жребий) сортировка предложения
133
+ sortition_reproducibility_details: Подробности за възпроизвеждане на жребия
134
+ time_seed: "(2) Време за зареждане"
135
+ witnesses: Свидетели
136
+ sortition:
137
+ random_seed: Случаен подбор
138
+ selected_proposals:
139
+ one: избрано предложение
140
+ other: избрани предложения
141
+ view: Изглед
142
+ sortition_author:
143
+ deleted: Изтрит участник
144
+ sortition_cancel_author:
145
+ deleted: Изтрит участник
146
+ sortitions_count:
147
+ count:
148
+ one: 1 сортировка
149
+ other: "%{count} сортировки"
150
+ statistics:
151
+ sortitions_count: Сортировки
@@ -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:
@@ -22,6 +22,8 @@ pl:
22
22
  decidim:
23
23
  components:
24
24
  sortitions:
25
+ actions:
26
+ comment: Skomentuj
25
27
  name: Wybory losowe
26
28
  settings:
27
29
  global:
@@ -157,3 +159,5 @@ pl:
157
159
  few: "%{count} wyborów losowych"
158
160
  many: "%{count} wybory losowe"
159
161
  other: "%{count} wybory losowe"
162
+ statistics:
163
+ sortitions_count: Wybory przez losowanie
@@ -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.7"
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.7
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: 2023-12-20 00:00:00.000000000 Z
11
+ date: 2024-07-16 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.7
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.7
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.7
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.7
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.7
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.7
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.7
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.7
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.7
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.7
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,6 +251,7 @@ 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
@@ -260,16 +262,16 @@ 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
274
+ rubygems_version: 3.5.14
273
275
  signing_key:
274
276
  specification_version: 4
275
277
  summary: Decidim sortitions module
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Empty line for playing nice with tpope/vim-rails