decidim-budgets 0.28.2 → 0.29.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/budgets/base_cell.rb +0 -2
- data/app/cells/decidim/budgets/budget_list_item_cell.rb +0 -3
- data/app/cells/decidim/budgets/order_activity_cell.rb +1 -1
- data/app/cells/decidim/budgets/project_l_cell.rb +0 -1
- data/app/cells/decidim/budgets/project_vote_button_cell.rb +0 -1
- data/app/cells/decidim/budgets/project_voted_hint_cell.rb +0 -2
- data/app/cells/decidim/budgets/project_votes_count_cell.rb +0 -2
- data/app/commands/decidim/budgets/admin/create_budget.rb +4 -33
- data/app/commands/decidim/budgets/admin/create_order_reminders.rb +5 -19
- data/app/commands/decidim/budgets/admin/create_project.rb +19 -45
- data/app/commands/decidim/budgets/admin/destroy_budget.rb +3 -28
- data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +1 -2
- data/app/commands/decidim/budgets/admin/update_budget.rb +4 -35
- data/app/commands/decidim/budgets/admin/update_project.rb +17 -43
- data/app/controllers/decidim/budgets/admin/application_controller.rb +5 -1
- data/app/controllers/decidim/budgets/admin/projects_controller.rb +1 -1
- data/app/forms/decidim/budgets/admin/budget_form.rb +1 -1
- data/app/helpers/decidim/budgets/projects_helper.rb +2 -2
- data/app/packs/src/decidim/budgets/admin/projects.js +1 -1
- data/app/packs/stylesheets/budgets.scss +30 -18
- data/app/views/decidim/budgets/admin/budgets/index.html.erb +1 -1
- data/app/views/decidim/budgets/admin/projects/_project-tr.html.erb +5 -0
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_budget-change.html.erb +2 -2
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_change-selected.html.erb +2 -2
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_recategorize.html.erb +2 -2
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_scope-change.html.erb +2 -2
- data/app/views/decidim/budgets/admin/projects/index.html.erb +5 -2
- data/app/views/decidim/budgets/admin/projects/update_attribute.js.erb +3 -3
- data/app/views/decidim/budgets/projects/_budget_confirm.html.erb +3 -3
- data/app/views/decidim/budgets/projects/_order_progress_progressbar_marks_right.html.erb +1 -1
- data/app/views/decidim/budgets/projects/_order_progress_summary_content.html.erb +21 -12
- data/app/views/decidim/budgets/projects/_projects.html.erb +1 -1
- data/app/views/decidim/budgets/projects/index.js.erb +1 -1
- data/config/locales/ar.yml +0 -1
- data/config/locales/bg.yml +2 -1
- data/config/locales/ca.yml +2 -1
- data/config/locales/cs.yml +2 -1
- data/config/locales/de.yml +2 -1
- data/config/locales/el.yml +0 -1
- data/config/locales/en.yml +2 -1
- data/config/locales/es-MX.yml +2 -1
- data/config/locales/es-PY.yml +2 -1
- data/config/locales/es.yml +2 -1
- data/config/locales/eu.yml +2 -1
- data/config/locales/fi-plain.yml +2 -1
- data/config/locales/fi.yml +2 -1
- data/config/locales/fr-CA.yml +2 -1
- data/config/locales/fr.yml +2 -1
- data/config/locales/gl.yml +0 -1
- data/config/locales/hu.yml +1 -1
- data/config/locales/it.yml +0 -1
- data/config/locales/ja.yml +2 -1
- data/config/locales/lb.yml +0 -1
- data/config/locales/lt.yml +0 -1
- data/config/locales/nl.yml +0 -1
- data/config/locales/no.yml +0 -1
- data/config/locales/pl.yml +2 -1
- data/config/locales/pt-BR.yml +0 -1
- data/config/locales/pt.yml +0 -1
- data/config/locales/ro-RO.yml +0 -1
- data/config/locales/sv.yml +1 -1
- data/config/locales/tr-TR.yml +0 -1
- data/config/locales/zh-CN.yml +0 -1
- data/config/locales/zh-TW.yml +0 -1
- data/decidim-budgets.gemspec +1 -1
- data/lib/decidim/budgets/project_serializer.rb +1 -0
- data/lib/decidim/budgets/seeds.rb +62 -21
- data/lib/decidim/budgets/version.rb +1 -1
- data/lib/decidim/budgets/workflows/base.rb +1 -1
- metadata +15 -16
- data/app/commands/decidim/budgets/admin/destroy_project.rb +0 -42
data/config/locales/zh-CN.yml
CHANGED
data/config/locales/zh-TW.yml
CHANGED
data/decidim-budgets.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
"homepage_uri" => "https://decidim.org",
|
20
20
|
"source_code_uri" => "https://github.com/decidim/decidim"
|
21
21
|
}
|
22
|
-
s.required_ruby_version = "~> 3.
|
22
|
+
s.required_ruby_version = "~> 3.2.0"
|
23
23
|
|
24
24
|
s.name = "decidim-budgets"
|
25
25
|
s.summary = "Decidim budgets module"
|
@@ -13,25 +13,59 @@ module Decidim
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
16
|
+
component = create_component!
|
17
|
+
|
18
|
+
rand(1...3).times do
|
19
|
+
create_budget!(component:)
|
20
|
+
end
|
21
|
+
|
22
|
+
Decidim::Budgets::Budget.where(component:).each do |budget|
|
23
|
+
rand(2...4).times do
|
24
|
+
project = create_project!(budget:)
|
25
|
+
|
26
|
+
create_attachments!(attached_to: project)
|
27
|
+
|
28
|
+
Decidim::Comments::Seed.comments_for(project)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_component!
|
16
34
|
landing_page_content = Decidim::Faker::Localized.localized do
|
17
35
|
"<h2>#{::Faker::Lorem.sentence}</h2>" \
|
18
36
|
"<p>#{::Faker::Lorem.paragraph}</p>" \
|
19
37
|
"<p>#{::Faker::Lorem.paragraph}</p>"
|
20
38
|
end
|
21
39
|
|
22
|
-
|
40
|
+
params = {
|
23
41
|
name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :budgets).i18n_name,
|
24
42
|
manifest_name: :budgets,
|
25
43
|
published_at: Time.current,
|
26
44
|
participatory_space:,
|
27
45
|
settings: {
|
46
|
+
geocoding_enabled: [true, false].sample,
|
28
47
|
landing_page_content:,
|
29
48
|
more_information_modal: Decidim::Faker::Localized.paragraph(sentence_count: 4),
|
30
49
|
workflow: Decidim::Budgets.workflows.keys.sample
|
31
50
|
}
|
32
|
-
|
51
|
+
}
|
33
52
|
|
34
|
-
|
53
|
+
Decidim.traceability.perform_action!(
|
54
|
+
"publish",
|
55
|
+
Decidim::Component,
|
56
|
+
admin_user,
|
57
|
+
visibility: "all"
|
58
|
+
) do
|
59
|
+
Decidim::Component.create!(params)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_budget!(component:)
|
64
|
+
Decidim.traceability.perform_action!(
|
65
|
+
"create",
|
66
|
+
Decidim::Budgets::Budget,
|
67
|
+
admin_user
|
68
|
+
) do
|
35
69
|
Decidim::Budgets::Budget.create!(
|
36
70
|
component:,
|
37
71
|
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
@@ -41,27 +75,34 @@ module Decidim
|
|
41
75
|
total_budget: ::Faker::Number.number(digits: 8)
|
42
76
|
)
|
43
77
|
end
|
78
|
+
end
|
44
79
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
)
|
80
|
+
def create_project!(budget:)
|
81
|
+
params = {
|
82
|
+
budget:,
|
83
|
+
scope: participatory_space.organization.scopes.sample,
|
84
|
+
category: participatory_space.categories.sample,
|
85
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
86
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
87
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
88
|
+
end,
|
89
|
+
budget_amount: ::Faker::Number.between(from: Integer(budget.total_budget * 0.7), to: budget.total_budget)
|
90
|
+
}
|
57
91
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
92
|
+
if budget.component.settings.geocoding_enabled?
|
93
|
+
params = params.merge(
|
94
|
+
address: "#{::Faker::Address.street_address} #{::Faker::Address.zip} #{::Faker::Address.city}",
|
95
|
+
latitude: ::Faker::Address.latitude,
|
96
|
+
longitude: ::Faker::Address.longitude
|
97
|
+
)
|
98
|
+
end
|
62
99
|
|
63
|
-
|
64
|
-
|
100
|
+
Decidim.traceability.perform_action!(
|
101
|
+
"create",
|
102
|
+
Decidim::Budgets::Project,
|
103
|
+
admin_user
|
104
|
+
) do
|
105
|
+
Decidim::Budgets::Project.create!(params)
|
65
106
|
end
|
66
107
|
end
|
67
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-budgets
|
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
|
- Josep Jaume Rey Peroy
|
@@ -18,70 +18,70 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.29.0.rc1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.29.0.rc1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: decidim-core
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.29.0.rc1
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.29.0.rc1
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: decidim-admin
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.29.0.rc1
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.29.0.rc1
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: decidim-dev
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.29.0.rc1
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
70
|
+
version: 0.29.0.rc1
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: decidim-proposals
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
77
|
+
version: 0.29.0.rc1
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
84
|
+
version: 0.29.0.rc1
|
85
85
|
description: A budgets component for decidim's participatory spaces.
|
86
86
|
email:
|
87
87
|
- josepjaume@gmail.com
|
@@ -132,7 +132,6 @@ files:
|
|
132
132
|
- app/commands/decidim/budgets/admin/create_order_reminders.rb
|
133
133
|
- app/commands/decidim/budgets/admin/create_project.rb
|
134
134
|
- app/commands/decidim/budgets/admin/destroy_budget.rb
|
135
|
-
- app/commands/decidim/budgets/admin/destroy_project.rb
|
136
135
|
- app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb
|
137
136
|
- app/commands/decidim/budgets/admin/update_budget.rb
|
138
137
|
- app/commands/decidim/budgets/admin/update_project.rb
|
@@ -371,14 +370,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
371
370
|
requirements:
|
372
371
|
- - "~>"
|
373
372
|
- !ruby/object:Gem::Version
|
374
|
-
version: 3.
|
373
|
+
version: 3.2.0
|
375
374
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
376
375
|
requirements:
|
377
|
-
- - "
|
376
|
+
- - ">"
|
378
377
|
- !ruby/object:Gem::Version
|
379
|
-
version:
|
378
|
+
version: 1.3.1
|
380
379
|
requirements: []
|
381
|
-
rubygems_version: 3.
|
380
|
+
rubygems_version: 3.4.10
|
382
381
|
signing_key:
|
383
382
|
specification_version: 4
|
384
383
|
summary: Decidim budgets module
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Budgets
|
5
|
-
module Admin
|
6
|
-
# This command is executed when the user deletes a Project from the admin
|
7
|
-
# panel.
|
8
|
-
class DestroyProject < Decidim::Command
|
9
|
-
# Initializes an UpdateProject Command.
|
10
|
-
#
|
11
|
-
# project - The current instance of the project to be destroyed.
|
12
|
-
# current_user - the user that performs the action
|
13
|
-
def initialize(project, current_user)
|
14
|
-
@project = project
|
15
|
-
@current_user = current_user
|
16
|
-
end
|
17
|
-
|
18
|
-
# Performs the action.
|
19
|
-
#
|
20
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
21
|
-
def call
|
22
|
-
destroy_project
|
23
|
-
broadcast(:ok)
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
attr_reader :project, :current_user
|
29
|
-
|
30
|
-
def destroy_project
|
31
|
-
Decidim.traceability.perform_action!(
|
32
|
-
:delete,
|
33
|
-
project,
|
34
|
-
current_user
|
35
|
-
) do
|
36
|
-
project.destroy!
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|