decidim-initiatives 0.28.6 → 0.29.0.rc1
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 +4 -4
- data/README.md +2 -2
- data/app/cells/decidim/initiatives/initiative_g_cell.rb +6 -4
- data/app/cells/decidim/initiatives_votes/vote_cell.rb +1 -3
- data/app/commands/decidim/initiatives/admin/create_initiative_type.rb +9 -58
- data/app/commands/decidim/initiatives/admin/create_initiative_type_scope.rb +5 -43
- data/app/commands/decidim/initiatives/admin/update_initiative.rb +25 -42
- data/app/commands/decidim/initiatives/admin/update_initiative_answer.rb +3 -4
- data/app/commands/decidim/initiatives/admin/update_initiative_type.rb +11 -61
- data/app/commands/decidim/initiatives/admin/update_initiative_type_scope.rb +2 -33
- data/app/commands/decidim/initiatives/admin/update_initiatives_settings.rb +2 -35
- data/app/commands/decidim/initiatives/approve_membership_request.rb +1 -1
- data/app/commands/decidim/initiatives/create_initiative.rb +6 -7
- data/app/commands/decidim/initiatives/revoke_membership_request.rb +1 -1
- data/app/commands/decidim/initiatives/spawn_committee_request.rb +4 -5
- data/app/commands/decidim/initiatives/update_initiative.rb +3 -3
- data/app/commands/decidim/initiatives/validate_sms_code.rb +3 -3
- data/app/controllers/concerns/decidim/initiatives/needs_initiative.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/answers_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +7 -6
- data/app/controllers/decidim/initiatives/admin/initiatives_settings_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_type_scopes_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/admin/initiatives_types_controller.rb +2 -2
- data/app/controllers/decidim/initiatives/application_controller.rb +5 -2
- data/app/controllers/decidim/initiatives/committee_requests_controller.rb +1 -2
- data/app/controllers/decidim/initiatives/create_initiative_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +2 -2
- data/app/events/decidim/initiatives/approve_membership_request_event.rb +9 -29
- data/app/events/decidim/initiatives/create_initiative_event.rb +17 -36
- data/app/events/decidim/initiatives/revoke_membership_request_event.rb +10 -33
- data/app/events/decidim/initiatives/spawn_committee_request_event.rb +10 -33
- data/app/forms/decidim/initiatives/admin/initiative_answer_form.rb +1 -1
- data/app/forms/decidim/initiatives/admin/initiative_form.rb +3 -3
- data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +2 -2
- data/app/forms/decidim/initiatives/initiative_form.rb +11 -1
- data/app/forms/decidim/initiatives/vote_form.rb +2 -2
- data/app/helpers/decidim/initiatives/initiative_helper.rb +0 -74
- data/app/helpers/decidim/initiatives/initiatives_helper.rb +0 -7
- data/app/models/decidim/initiative.rb +1 -7
- data/app/packs/entrypoints/decidim_initiatives_admin.js +0 -2
- data/app/packs/src/decidim/initiatives/admin/invite_users.js +1 -1
- data/app/permissions/decidim/initiatives/admin/permissions.rb +2 -2
- data/app/permissions/decidim/initiatives/permissions.rb +0 -14
- data/app/serializers/decidim/initiatives/initiative_serializer.rb +1 -1
- data/app/views/decidim/initiatives/admin/answers/_info_initiative.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/committee_requests/index.html.erb +1 -2
- data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +6 -6
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +65 -59
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/_form.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/_initiative_type_scopes.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +1 -1
- data/app/views/decidim/initiatives/committee_requests/new.html.erb +3 -4
- data/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_interactions.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_new_initiative_button.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_vote_button.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/print.html.erb +2 -2
- data/app/views/decidim/initiatives/initiatives/show.html.erb +2 -3
- data/app/views/layouts/decidim/_initiative_header.html.erb +6 -6
- data/app/views/layouts/decidim/initiative.html.erb +2 -2
- data/app/views/layouts/decidim/initiative_head.html.erb +1 -1
- data/config/initializers/wicked_pdf.rb +6 -4
- data/config/locales/ar.yml +0 -7
- data/config/locales/bg.yml +2 -3
- data/config/locales/ca.yml +10 -17
- data/config/locales/cs.yml +5 -13
- data/config/locales/de.yml +8 -15
- data/config/locales/el.yml +0 -4
- data/config/locales/en.yml +6 -13
- data/config/locales/es-MX.yml +12 -19
- data/config/locales/es-PY.yml +12 -19
- data/config/locales/es.yml +11 -18
- data/config/locales/eu.yml +75 -82
- data/config/locales/fi-plain.yml +8 -15
- data/config/locales/fi.yml +21 -28
- data/config/locales/fr-CA.yml +6 -7
- data/config/locales/fr.yml +5 -6
- data/config/locales/ga-IE.yml +0 -1
- data/config/locales/gl.yml +2 -6
- data/config/locales/he-IL.yml +0 -6
- data/config/locales/hu.yml +3 -5
- data/config/locales/id-ID.yml +1 -5
- data/config/locales/is-IS.yml +1 -12
- data/config/locales/it.yml +3 -9
- data/config/locales/ja.yml +9 -16
- data/config/locales/lb.yml +5 -2
- data/config/locales/lt.yml +1 -3
- data/config/locales/lv.yml +0 -4
- data/config/locales/nl.yml +1 -5
- data/config/locales/no.yml +1 -2
- data/config/locales/pl.yml +7 -3
- data/config/locales/pt-BR.yml +4 -19
- data/config/locales/pt.yml +1 -2
- data/config/locales/ro-RO.yml +1 -13
- data/config/locales/ru.yml +1 -13
- data/config/locales/sk.yml +1 -5
- data/config/locales/sl.yml +4 -0
- data/config/locales/sv.yml +73 -197
- data/config/locales/tr-TR.yml +3 -4
- data/config/locales/uk.yml +1 -13
- data/config/locales/zh-CN.yml +0 -3
- data/config/locales/zh-TW.yml +1 -3
- data/decidim-initiatives.gemspec +3 -2
- data/lib/decidim/api/initiative_api_type.rb +2 -2
- data/lib/decidim/initiatives/engine.rb +1 -0
- data/lib/decidim/initiatives/menu.rb +12 -1
- data/lib/decidim/initiatives/seeds.rb +89 -64
- data/lib/decidim/initiatives/version.rb +1 -1
- data/lib/decidim/initiatives.rb +0 -12
- data/lib/tasks/decidim_initiatives.rake +3 -3
- data/lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake +9 -11
- metadata +33 -26
- data/app/forms/decidim/initiatives/previous_form.rb +0 -24
- data/app/packs/entrypoints/decidim_initiatives_admin.scss +0 -1
- data/app/packs/stylesheets/decidim/initiatives/admin/initiatives.scss +0 -13
- data/app/queries/decidim/initiatives/similar_initiatives.rb +0 -54
- data/config/locales/bn-BD.yml +0 -1
- data/config/locales/bs-BA.yml +0 -1
- data/config/locales/ca-IT.yml +0 -625
data/config/locales/uk.yml
CHANGED
@@ -62,9 +62,6 @@ uk:
|
|
62
62
|
created_at: 'Створено:'
|
63
63
|
title: Різновиди починів
|
64
64
|
name: Різновид почину
|
65
|
-
initiatives_votes:
|
66
|
-
fields:
|
67
|
-
scope: Обсяг
|
68
65
|
titles:
|
69
66
|
initiatives: Почини
|
70
67
|
initiatives_types: Різновиди починів
|
@@ -178,9 +175,6 @@ uk:
|
|
178
175
|
email_outro: Ви отримали це сповіщення, тому що ви стежите за %{author_nickname}. Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
|
179
176
|
email_subject: '%{author_nickname} підтримав почин'
|
180
177
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> підтримав почин <a href="%{resource_path}">%{resource_title}</a>.
|
181
|
-
initiative_signatures:
|
182
|
-
fill_personal_data:
|
183
|
-
continue: Продовжити
|
184
178
|
initiative_votes:
|
185
179
|
create:
|
186
180
|
error: При підписанні цього почину сталися помилки.
|
@@ -213,7 +207,6 @@ uk:
|
|
213
207
|
recent: Найновіші
|
214
208
|
print:
|
215
209
|
city: Місто
|
216
|
-
print: Друк
|
217
210
|
result:
|
218
211
|
initiative_rejected_reason: Цей почин був відхилений через недостатню підтримку.
|
219
212
|
signatures_count:
|
@@ -223,7 +216,6 @@ uk:
|
|
223
216
|
other: " підписів"
|
224
217
|
vote_cabin:
|
225
218
|
already_voted: Вже підписалися
|
226
|
-
supports_required: "Необхідно %{total_supports} підписів"
|
227
219
|
vote: Підписати
|
228
220
|
votes_blocked: Підписування вимкнене
|
229
221
|
votes_count:
|
@@ -248,15 +240,11 @@ uk:
|
|
248
240
|
expired: Строк дії яких закінчився
|
249
241
|
menu:
|
250
242
|
initiatives: Почини
|
251
|
-
resources:
|
252
|
-
initiatives_type:
|
253
|
-
actions:
|
254
|
-
create: Створити
|
255
|
-
vote: Підписати
|
256
243
|
layouts:
|
257
244
|
decidim:
|
258
245
|
initiative_creation_header:
|
259
246
|
fill_data: Внести
|
247
|
+
finish: Завершити
|
260
248
|
promotal_committee: Робочий гурт з просування
|
261
249
|
select_initiative_type: Обрати
|
262
250
|
initiatives:
|
data/config/locales/zh-CN.yml
CHANGED
@@ -344,14 +344,12 @@ zh-CN:
|
|
344
344
|
recently_published: 最近发布的
|
345
345
|
print:
|
346
346
|
city: 城市
|
347
|
-
print: 打印
|
348
347
|
result:
|
349
348
|
initiative_rejected_reason: 这项倡议由于没有签字而被拒绝。
|
350
349
|
signatures_count:
|
351
350
|
other: " 签名"
|
352
351
|
vote_cabin:
|
353
352
|
already_voted: 已签名
|
354
|
-
supports_required: "需要 %{total_supports} 签名"
|
355
353
|
verification_required: 验证您的帐户以签署倡议
|
356
354
|
vote: 签名
|
357
355
|
votes_blocked: 签名已禁用
|
@@ -391,7 +389,6 @@ zh-CN:
|
|
391
389
|
resources:
|
392
390
|
initiatives_type:
|
393
391
|
actions:
|
394
|
-
create: 创建
|
395
392
|
title: 行动
|
396
393
|
vote: 签名
|
397
394
|
layouts:
|
data/config/locales/zh-TW.yml
CHANGED
@@ -97,7 +97,6 @@ zh-TW:
|
|
97
97
|
title_or_description_or_id_string_or_author_name_or_author_nickname_cont: 透過標題、描述、ID 或作者姓名搜尋 %{collection}
|
98
98
|
initiatives_settings:
|
99
99
|
update:
|
100
|
-
error: 發生一個錯誤.
|
101
100
|
success: 倡議設定已成功更新.
|
102
101
|
menu:
|
103
102
|
attachments: 附件
|
@@ -283,7 +282,6 @@ zh-TW:
|
|
283
282
|
initiatives_types:
|
284
283
|
create:
|
285
284
|
error: 出現了一個錯誤.
|
286
|
-
success: 一個新的倡議類型已成功更新.
|
287
285
|
destroy:
|
288
286
|
success: 該倡議類型已成功刪除.
|
289
287
|
edit:
|
@@ -352,6 +350,7 @@ zh-TW:
|
|
352
350
|
finish:
|
353
351
|
back: 返回
|
354
352
|
back_to_initiatives: 回到倡議
|
353
|
+
callout_text: 恭喜您!您的倡議已成功建立。
|
355
354
|
confirm: 您即將發送倡議給管理員進行審核和發佈。一旦發佈,您將無法編輯它。您確定要繼續嗎?"
|
356
355
|
edit_my_initiative: 編輯我的倡議
|
357
356
|
go_to_my_initiatives: 前往我的倡議
|
@@ -507,7 +506,6 @@ zh-TW:
|
|
507
506
|
other: " 簽名"
|
508
507
|
vote_cabin:
|
509
508
|
already_voted: 已簽署
|
510
|
-
supports_required: "需要 %{total_supports} 個簽署支持"
|
511
509
|
verification_required: 驗證您的帳戶以簽署該倡議
|
512
510
|
vote: 簽署
|
513
511
|
votes_blocked: 簽署已禁用
|
data/decidim-initiatives.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = Decidim::Initiatives.version
|
9
9
|
s.authors = ["Juan Salvador Perez Garcia"]
|
10
10
|
s.email = ["jsperezg@gmail.com"]
|
11
|
-
s.license = "AGPL-3.0
|
11
|
+
s.license = "AGPL-3.0"
|
12
12
|
s.homepage = "https://decidim.org"
|
13
13
|
s.metadata = {
|
14
14
|
"bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
"homepage_uri" => "https://decidim.org",
|
18
18
|
"source_code_uri" => "https://github.com/decidim/decidim"
|
19
19
|
}
|
20
|
-
s.required_ruby_version = "~> 3.
|
20
|
+
s.required_ruby_version = "~> 3.2.0"
|
21
21
|
|
22
22
|
s.name = "decidim-initiatives"
|
23
23
|
s.summary = "Decidim initiatives module"
|
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_dependency "decidim-verifications", Decidim::Initiatives.version
|
37
37
|
s.add_dependency "hexapdf", "~> 0.32.0"
|
38
38
|
s.add_dependency "wicked_pdf", "~> 2.1"
|
39
|
+
s.add_dependency "wkhtmltopdf-binary", "~> 0.12"
|
39
40
|
|
40
41
|
s.add_development_dependency "decidim-dev", Decidim::Initiatives.version
|
41
42
|
s.add_development_dependency "decidim-meetings", Decidim::Initiatives.version
|
@@ -17,13 +17,13 @@ module Decidim
|
|
17
17
|
field :minimum_committee_members, GraphQL::Types::Int, "Minimum of committee members", null: true
|
18
18
|
field :validate_sms_code_on_votes, GraphQL::Types::Boolean, "Add SMS code validation step to signature process", null: true
|
19
19
|
field :undo_online_signatures_enabled, GraphQL::Types::Boolean, "Enable participants to undo their online signatures", null: true
|
20
|
-
field :
|
20
|
+
field :promoting_committee_enabled, GraphQL::Types::Boolean, "If promoting committee is enabled", method: :promoting_committee_enabled, null: true
|
21
21
|
field :signature_type, GraphQL::Types::String, "Signature type of the initiative", null: true
|
22
22
|
|
23
23
|
field :initiatives, [Decidim::Initiatives::InitiativeType, { null: true }], "The initiatives that have this type", null: false
|
24
24
|
|
25
25
|
def banner_image
|
26
|
-
object.attached_uploader(:banner_image).
|
26
|
+
object.attached_uploader(:banner_image).path
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -5,6 +5,17 @@ module Decidim
|
|
5
5
|
class Menu
|
6
6
|
def self.register_menu!
|
7
7
|
Decidim.menu :menu do |menu|
|
8
|
+
menu.add_item :initiatives,
|
9
|
+
I18n.t("menu.initiatives", scope: "decidim"),
|
10
|
+
decidim_initiatives.initiatives_path,
|
11
|
+
position: 2.4,
|
12
|
+
active: %r{^/(initiatives|create_initiative)},
|
13
|
+
if: Decidim::InitiativesType.joins(:scopes).where(organization: current_organization).any?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.register_mobile_menu!
|
18
|
+
Decidim.menu :mobile_menu do |menu|
|
8
19
|
menu.add_item :initiatives,
|
9
20
|
I18n.t("menu.initiatives", scope: "decidim"),
|
10
21
|
decidim_initiatives.initiatives_path,
|
@@ -21,7 +32,7 @@ module Decidim
|
|
21
32
|
decidim_initiatives.initiatives_path,
|
22
33
|
position: 30,
|
23
34
|
active: :inclusive,
|
24
|
-
if:
|
35
|
+
if: Decidim::InitiativesType.joins(:scopes).where(organization: current_organization).any?
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
@@ -7,30 +7,13 @@ module Decidim
|
|
7
7
|
module Initiatives
|
8
8
|
class Seeds < Decidim::Seeds
|
9
9
|
def call
|
10
|
-
|
10
|
+
create_content_block!
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
weight: 33,
|
15
|
-
scope_name: :homepage,
|
16
|
-
manifest_name: :highlighted_initiatives,
|
17
|
-
published_at: Time.current
|
18
|
-
)
|
19
|
-
|
20
|
-
3.times do |n|
|
21
|
-
type = Decidim::InitiativesType.create!(
|
22
|
-
title: Decidim::Faker::Localized.sentence(word_count: 5),
|
23
|
-
description: Decidim::Faker::Localized.sentence(word_count: 25),
|
24
|
-
organization:,
|
25
|
-
banner_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? banner_image : nil # Keep after organization
|
26
|
-
)
|
12
|
+
3.times do |_n|
|
13
|
+
type = create_initiative_type!
|
27
14
|
|
28
15
|
organization.top_scopes.each do |scope|
|
29
|
-
|
30
|
-
type:,
|
31
|
-
scope:,
|
32
|
-
supports_required: (n + 1) * 1000
|
33
|
-
)
|
16
|
+
create_initiative_type_scope!(scope:, type:)
|
34
17
|
end
|
35
18
|
end
|
36
19
|
|
@@ -38,58 +21,100 @@ module Decidim
|
|
38
21
|
Decidim::Initiative.skip_callback(:save, :after, :notify_state_change, raise: false)
|
39
22
|
Decidim::Initiative.skip_callback(:create, :after, :notify_creation, raise: false)
|
40
23
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
scoped_type: Decidim::InitiativesTypeScope.all.sample,
|
45
|
-
state:,
|
46
|
-
signature_type: "online",
|
47
|
-
signature_start_date: Date.current - 7.days,
|
48
|
-
signature_end_date: Date.current + 7.days,
|
49
|
-
published_at: 7.days.ago,
|
50
|
-
author: Decidim::User.all.sample,
|
51
|
-
organization:
|
52
|
-
}
|
53
|
-
|
54
|
-
initiative = Decidim.traceability.perform_action!(
|
55
|
-
"publish",
|
56
|
-
Decidim::Initiative,
|
57
|
-
organization.users.first,
|
58
|
-
visibility: "all"
|
59
|
-
) do
|
60
|
-
Decidim::Initiative.create!(params)
|
61
|
-
end
|
62
|
-
initiative.add_to_index_as_search_resource
|
63
|
-
|
64
|
-
if %w(published rejected accepted).include? state
|
65
|
-
users = []
|
66
|
-
rand(50).times do
|
67
|
-
author = (Decidim::User.all - users).sample
|
68
|
-
initiative.votes.create!(author:, scope: initiative.scope, hash_id: SecureRandom.hex)
|
69
|
-
users << author
|
70
|
-
end
|
71
|
-
end
|
24
|
+
initiative = create_initiative!(state:)
|
25
|
+
|
26
|
+
create_initiative_votes!(initiative:) if %w(published rejected accepted).include? state
|
72
27
|
|
73
28
|
Decidim::Comments::Seed.comments_for(initiative)
|
74
29
|
|
75
30
|
create_attachment(attached_to: initiative, filename: "city.jpeg")
|
76
31
|
|
77
32
|
Decidim::Initiatives.default_components.each do |component_name|
|
78
|
-
|
79
|
-
name: Decidim::Components::Namer.new(initiative.organization.available_locales, component_name).i18n_name,
|
80
|
-
manifest_name: component_name,
|
81
|
-
published_at: Time.current,
|
82
|
-
participatory_space: initiative
|
83
|
-
)
|
84
|
-
|
85
|
-
next unless component_name.in? ["pages", :pages]
|
86
|
-
|
87
|
-
Decidim::Pages::CreatePage.call(component) do
|
88
|
-
on(:invalid) { raise "Cannot create page" }
|
89
|
-
end
|
33
|
+
create_component!(initiative:, component_name:)
|
90
34
|
end
|
91
35
|
end
|
92
36
|
end
|
37
|
+
|
38
|
+
def create_content_block!
|
39
|
+
Decidim::ContentBlock.create(
|
40
|
+
organization:,
|
41
|
+
weight: 33,
|
42
|
+
scope_name: :homepage,
|
43
|
+
manifest_name: :highlighted_initiatives,
|
44
|
+
published_at: Time.current
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_initiative_type!
|
49
|
+
Decidim::InitiativesType.create!(
|
50
|
+
title: Decidim::Faker::Localized.sentence(word_count: 5),
|
51
|
+
description: Decidim::Faker::Localized.sentence(word_count: 25),
|
52
|
+
organization:,
|
53
|
+
banner_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? banner_image : nil # Keep after organization
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_initiative_type_scope!(scope:, type:)
|
58
|
+
n = rand(3)
|
59
|
+
Decidim::InitiativesTypeScope.create(
|
60
|
+
type:,
|
61
|
+
scope:,
|
62
|
+
supports_required: (n + 1) * 1000
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
def create_initiative!(state:)
|
67
|
+
published_at = %w(published rejected accepted).include?(state) ? 7.days.ago : nil
|
68
|
+
|
69
|
+
params = {
|
70
|
+
title: Decidim::Faker::Localized.sentence(word_count: 3),
|
71
|
+
description: Decidim::Faker::Localized.sentence(word_count: 25),
|
72
|
+
scoped_type: Decidim::InitiativesTypeScope.all.sample,
|
73
|
+
state:,
|
74
|
+
signature_type: "online",
|
75
|
+
signature_start_date: Date.current - 7.days,
|
76
|
+
signature_end_date: Date.current + 7.days,
|
77
|
+
published_at:,
|
78
|
+
author: Decidim::User.all.sample,
|
79
|
+
organization:
|
80
|
+
}
|
81
|
+
|
82
|
+
initiative = Decidim.traceability.perform_action!(
|
83
|
+
"publish",
|
84
|
+
Decidim::Initiative,
|
85
|
+
organization.users.first,
|
86
|
+
visibility: "all"
|
87
|
+
) do
|
88
|
+
Decidim::Initiative.create!(params)
|
89
|
+
end
|
90
|
+
initiative.add_to_index_as_search_resource
|
91
|
+
|
92
|
+
initiative
|
93
|
+
end
|
94
|
+
|
95
|
+
def create_initiative_votes!(initiative:)
|
96
|
+
users = []
|
97
|
+
rand(50).times do
|
98
|
+
author = (Decidim::User.all - users).sample
|
99
|
+
initiative.votes.create!(author:, scope: initiative.scope, hash_id: SecureRandom.hex)
|
100
|
+
users << author
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def create_component!(initiative:, component_name:)
|
105
|
+
component = Decidim::Component.create!(
|
106
|
+
name: Decidim::Components::Namer.new(initiative.organization.available_locales, component_name).i18n_name,
|
107
|
+
manifest_name: component_name,
|
108
|
+
published_at: Time.current,
|
109
|
+
participatory_space: initiative
|
110
|
+
)
|
111
|
+
|
112
|
+
return unless component_name.in? ["pages", :pages]
|
113
|
+
|
114
|
+
Decidim::Pages::CreatePage.call(component) do
|
115
|
+
on(:invalid) { raise "Cannot create page" }
|
116
|
+
end
|
117
|
+
end
|
93
118
|
end
|
94
119
|
end
|
95
120
|
end
|
data/lib/decidim/initiatives.rb
CHANGED
@@ -17,18 +17,6 @@ module Decidim
|
|
17
17
|
true
|
18
18
|
end
|
19
19
|
|
20
|
-
# Public Setting that defines the similarity minimum value to consider two
|
21
|
-
# initiatives similar. Defaults to 0.25.
|
22
|
-
config_accessor :similarity_threshold do
|
23
|
-
0.25
|
24
|
-
end
|
25
|
-
|
26
|
-
# Public Setting that defines how many similar initiatives will be shown.
|
27
|
-
# Defaults to 5.
|
28
|
-
config_accessor :similarity_limit do
|
29
|
-
5
|
30
|
-
end
|
31
|
-
|
32
20
|
# Minimum number of committee members required to pass the initiative to
|
33
21
|
# technical validation phase. Only applies to initiatives created by
|
34
22
|
# individuals.
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
namespace :decidim_initiatives do
|
4
|
-
desc "
|
4
|
+
desc "Checks validating initiatives and moves all without changes for a configured time to discarded state"
|
5
5
|
task check_validating: :environment do
|
6
6
|
Decidim::Initiatives::OutdatedValidatingInitiatives
|
7
7
|
.for(Decidim::Initiatives.max_time_in_validating_state)
|
8
8
|
.each(&:discarded!)
|
9
9
|
end
|
10
10
|
|
11
|
-
desc "
|
11
|
+
desc "Checks published initiatives and moves to accepted/rejected state depending on the votes collected when the signing period has finished"
|
12
12
|
task check_published: :environment do
|
13
13
|
Decidim::Initiatives::SupportPeriodFinishedInitiatives.new.each do |initiative|
|
14
14
|
if initiative.supports_goal_reached?
|
@@ -19,7 +19,7 @@ namespace :decidim_initiatives do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
desc "
|
22
|
+
desc "Notifies progress on published initiatives"
|
23
23
|
task notify_progress: :environment do
|
24
24
|
Decidim::Initiative
|
25
25
|
.published
|
@@ -1,17 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
namespace :
|
4
|
-
namespace :
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
next unless Decidim::Pages::Page.where(component:).empty?
|
3
|
+
namespace :decidim_initiatives do
|
4
|
+
namespace :upgrade do
|
5
|
+
desc "Fixes the broken pages"
|
6
|
+
task fix_broken_pages: :environment do
|
7
|
+
Decidim::Initiative.find_each do |initiative|
|
8
|
+
initiative.components.where(manifest_name: "pages").each do |component|
|
9
|
+
next unless Decidim::Pages::Page.where(component:).empty?
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
end
|
11
|
+
Decidim::Pages::CreatePage.call(component) do
|
12
|
+
on(:invalid) { raise "Cannot create page" }
|
15
13
|
end
|
16
14
|
end
|
17
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-initiatives
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.29.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:
|
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,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.29.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.
|
26
|
+
version: 0.29.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.
|
33
|
+
version: 0.29.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.
|
40
|
+
version: 0.29.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.
|
47
|
+
version: 0.29.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.
|
54
|
+
version: 0.29.0.rc1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: decidim-verifications
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.29.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.
|
68
|
+
version: 0.29.0.rc1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: hexapdf
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,34 +94,48 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: wkhtmltopdf-binary
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.12'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.12'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: decidim-dev
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - '='
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
117
|
+
version: 0.29.0.rc1
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - '='
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
124
|
+
version: 0.29.0.rc1
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: decidim-meetings
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - '='
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
131
|
+
version: 0.29.0.rc1
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - '='
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
138
|
+
version: 0.29.0.rc1
|
125
139
|
description: Participants initiatives plugin for decidim.
|
126
140
|
email:
|
127
141
|
- jsperezg@gmail.com
|
@@ -218,7 +232,6 @@ files:
|
|
218
232
|
- app/forms/decidim/initiatives/admin/initiatives_settings_form.rb
|
219
233
|
- app/forms/decidim/initiatives/committee_member_form.rb
|
220
234
|
- app/forms/decidim/initiatives/initiative_form.rb
|
221
|
-
- app/forms/decidim/initiatives/previous_form.rb
|
222
235
|
- app/forms/decidim/initiatives/select_initiative_type_form.rb
|
223
236
|
- app/forms/decidim/initiatives/vote_form.rb
|
224
237
|
- app/helpers/decidim/initiatives/admin/initiatives_helper.rb
|
@@ -237,7 +250,6 @@ files:
|
|
237
250
|
- app/models/decidim/initiatives_vote.rb
|
238
251
|
- app/packs/entrypoints/decidim_initiatives.js
|
239
252
|
- app/packs/entrypoints/decidim_initiatives_admin.js
|
240
|
-
- app/packs/entrypoints/decidim_initiatives_admin.scss
|
241
253
|
- app/packs/entrypoints/decidim_initiatives_initiatives_votes.js
|
242
254
|
- app/packs/entrypoints/decidim_initiatives_initiatives_votes.scss
|
243
255
|
- app/packs/entrypoints/decidim_initiatives_print.js
|
@@ -249,7 +261,6 @@ files:
|
|
249
261
|
- app/packs/src/decidim/initiatives/application.js
|
250
262
|
- app/packs/src/decidim/initiatives/identity_selector_dialog.js
|
251
263
|
- app/packs/src/decidim/initiatives/scoped_type.js
|
252
|
-
- app/packs/stylesheets/decidim/initiatives/admin/initiatives.scss
|
253
264
|
- app/packs/stylesheets/decidim/initiatives/initiatives-votes.scss
|
254
265
|
- app/packs/stylesheets/decidim/initiatives/print-initiative.scss
|
255
266
|
- app/packs/stylesheets/initiatives.scss
|
@@ -268,7 +279,6 @@ files:
|
|
268
279
|
- app/queries/decidim/initiatives/initiatives_promoted.rb
|
269
280
|
- app/queries/decidim/initiatives/organization_prioritized_initiatives.rb
|
270
281
|
- app/queries/decidim/initiatives/outdated_validating_initiatives.rb
|
271
|
-
- app/queries/decidim/initiatives/similar_initiatives.rb
|
272
282
|
- app/queries/decidim/initiatives/support_period_finished_initiatives.rb
|
273
283
|
- app/queries/decidim/initiatives/user_authorizations.rb
|
274
284
|
- app/serializers/decidim/initiatives/initiative_serializer.rb
|
@@ -360,9 +370,6 @@ files:
|
|
360
370
|
- config/locales/ar.yml
|
361
371
|
- config/locales/bg-BG.yml
|
362
372
|
- config/locales/bg.yml
|
363
|
-
- config/locales/bn-BD.yml
|
364
|
-
- config/locales/bs-BA.yml
|
365
|
-
- config/locales/ca-IT.yml
|
366
373
|
- config/locales/ca.yml
|
367
374
|
- config/locales/cs-CZ.yml
|
368
375
|
- config/locales/cs.yml
|
@@ -520,7 +527,7 @@ files:
|
|
520
527
|
- lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake
|
521
528
|
homepage: https://decidim.org
|
522
529
|
licenses:
|
523
|
-
- AGPL-3.0
|
530
|
+
- AGPL-3.0
|
524
531
|
metadata:
|
525
532
|
bug_tracker_uri: https://github.com/decidim/decidim/issues
|
526
533
|
documentation_uri: https://docs.decidim.org/
|
@@ -535,14 +542,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
535
542
|
requirements:
|
536
543
|
- - "~>"
|
537
544
|
- !ruby/object:Gem::Version
|
538
|
-
version: 3.
|
545
|
+
version: 3.2.0
|
539
546
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
540
547
|
requirements:
|
541
|
-
- - "
|
548
|
+
- - ">"
|
542
549
|
- !ruby/object:Gem::Version
|
543
|
-
version:
|
550
|
+
version: 1.3.1
|
544
551
|
requirements: []
|
545
|
-
rubygems_version: 3.
|
552
|
+
rubygems_version: 3.4.10
|
546
553
|
signing_key:
|
547
554
|
specification_version: 4
|
548
555
|
summary: Decidim initiatives module
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Initiatives
|
5
|
-
# A form object used to collect the title and description for an initiative.
|
6
|
-
class PreviousForm < Form
|
7
|
-
include TranslatableAttributes
|
8
|
-
|
9
|
-
mimic :initiative
|
10
|
-
|
11
|
-
attribute :title, String
|
12
|
-
attribute :description, String
|
13
|
-
attribute :type_id, Integer
|
14
|
-
|
15
|
-
validates :title, :description, presence: true
|
16
|
-
validates :title, length: { maximum: 150 }
|
17
|
-
validates :type_id, presence: true
|
18
|
-
|
19
|
-
def type
|
20
|
-
@type ||= type_id ? Decidim::InitiativesType.find(type_id) : context.initiative.type
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|