decidim-budgets 0.28.5 → 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/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 +2 -7
- 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 +2 -2
- data/app/forms/decidim/budgets/admin/project_form.rb +1 -1
- data/app/forms/decidim/budgets/admin/project_import_proposals_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/permissions/decidim/budgets/permissions.rb +0 -2
- data/app/views/decidim/budgets/admin/budgets/index.html.erb +1 -1
- data/app/views/decidim/budgets/admin/projects/_bulk-actions.html.erb +3 -5
- 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 +3 -2
- data/config/locales/bg.yml +4 -2
- data/config/locales/ca.yml +2 -1
- data/config/locales/cs.yml +3 -2
- data/config/locales/de.yml +6 -5
- data/config/locales/el.yml +1 -1
- data/config/locales/en.yml +2 -1
- data/config/locales/es-MX.yml +3 -2
- data/config/locales/es-PY.yml +3 -2
- data/config/locales/es.yml +2 -1
- data/config/locales/eu.yml +85 -93
- data/config/locales/fi-plain.yml +17 -16
- data/config/locales/fi.yml +71 -70
- data/config/locales/fr-CA.yml +6 -5
- data/config/locales/fr.yml +5 -4
- data/config/locales/ga-IE.yml +4 -0
- data/config/locales/gl.yml +7 -1
- data/config/locales/hu.yml +4 -3
- data/config/locales/id-ID.yml +3 -0
- data/config/locales/is-IS.yml +3 -0
- data/config/locales/it.yml +5 -1
- data/config/locales/ja.yml +2 -1
- data/config/locales/ko.yml +0 -8
- data/config/locales/lb.yml +4 -1
- data/config/locales/lt.yml +1 -1
- data/config/locales/lv.yml +3 -0
- data/config/locales/nl.yml +3 -3
- data/config/locales/no.yml +7 -1
- data/config/locales/pl.yml +3 -1
- data/config/locales/pt-BR.yml +3 -70
- data/config/locales/pt.yml +5 -1
- data/config/locales/ro-RO.yml +2 -2
- data/config/locales/ru.yml +3 -0
- data/config/locales/sk.yml +3 -0
- data/config/locales/sq-AL.yml +3 -10
- data/config/locales/sv.yml +57 -171
- data/config/locales/tr-TR.yml +5 -1
- data/config/locales/uk.yml +3 -0
- data/config/locales/zh-CN.yml +5 -1
- data/config/locales/zh-TW.yml +1 -1
- data/decidim-budgets.gemspec +2 -2
- data/lib/decidim/api/budget_type.rb +0 -6
- data/lib/decidim/api/budgets_type.rb +3 -1
- data/lib/decidim/api/project_type.rb +0 -13
- 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 +17 -20
- data/app/commands/decidim/budgets/admin/destroy_project.rb +0 -42
- data/config/locales/bn-BD.yml +0 -1
- data/config/locales/bs-BA.yml +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 240b6ab72430080143780dd027d5835db4014f03099e6c824fadb6b1efd75946
|
4
|
+
data.tar.gz: c21175ea1e8a905957bb74c6b9e964b0caac9c9b17400bc6c73ef37b39abbe18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6e289beaf9d39920f70a1860bc5b73da56acf017d70367143fc95b4a4bab42884c7dde260ae056f74fbd2aa981c8baf66febe5a4b8ba17ce7936d2e9a05e705
|
7
|
+
data.tar.gz: 1f5557dd4c8a82dc39ce66e8e3c5238536a69d2a84aeaa45b46fac7a07f8dd5518faca25a8c63191c900000ddd7d90220155c2f9f396511dc09228b235b7c922
|
@@ -4,8 +4,6 @@ module Decidim
|
|
4
4
|
module Budgets
|
5
5
|
# This cell has the commons for the budgets cells
|
6
6
|
class BaseCell < Decidim::ViewModel
|
7
|
-
include Decidim::LayoutHelper
|
8
|
-
include Decidim::SanitizeHelper
|
9
7
|
include Decidim::ComponentPathHelper
|
10
8
|
include Decidim::Budgets::Engine.routes.url_helpers
|
11
9
|
|
@@ -4,9 +4,6 @@ module Decidim
|
|
4
4
|
module Budgets
|
5
5
|
# This cell renders the budget item list in the budgets list
|
6
6
|
class BudgetListItemCell < BaseCell
|
7
|
-
include Decidim::SanitizeHelper
|
8
|
-
include Decidim::ApplicationHelper
|
9
|
-
include ActiveSupport::NumberHelper
|
10
7
|
include Decidim::Budgets::ProjectsHelper
|
11
8
|
|
12
9
|
delegate :highlighted, to: :current_workflow
|
@@ -5,7 +5,6 @@ module Decidim
|
|
5
5
|
# This cell renders an authorized_action button
|
6
6
|
# to vote a given instance of a Project in a budget list
|
7
7
|
class ProjectVoteButtonCell < Decidim::ViewModel
|
8
|
-
include Decidim::ActionAuthorizationHelper
|
9
8
|
include Decidim::Budgets::ProjectsHelper
|
10
9
|
include Decidim::Budgets::Engine.routes.url_helpers
|
11
10
|
|
@@ -5,43 +5,14 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user creates an Budget
|
7
7
|
# from the admin panel.
|
8
|
-
class CreateBudget < Decidim::
|
9
|
-
|
10
|
-
@form = form
|
11
|
-
end
|
12
|
-
|
13
|
-
# Creates the budget if valid.
|
14
|
-
#
|
15
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
16
|
-
def call
|
17
|
-
return broadcast(:invalid) if form.invalid?
|
18
|
-
|
19
|
-
create_budget!
|
20
|
-
|
21
|
-
broadcast(:ok, budget)
|
22
|
-
end
|
8
|
+
class CreateBudget < Decidim::Commands::CreateResource
|
9
|
+
fetch_form_attributes :component, :scope, :title, :weight, :description, :total_budget
|
23
10
|
|
24
11
|
private
|
25
12
|
|
26
|
-
|
27
|
-
|
28
|
-
def create_budget!
|
29
|
-
attributes = {
|
30
|
-
component: form.current_component,
|
31
|
-
scope: form.scope,
|
32
|
-
title: form.title,
|
33
|
-
weight: form.weight,
|
34
|
-
description: form.description,
|
35
|
-
total_budget: form.total_budget
|
36
|
-
}
|
13
|
+
def extra_params = { visibility: "all" }
|
37
14
|
|
38
|
-
|
39
|
-
Budget,
|
40
|
-
form.current_user,
|
41
|
-
attributes,
|
42
|
-
visibility: "all"
|
43
|
-
)
|
44
|
-
end
|
15
|
+
def resource_class = Decidim::Budgets::Budget
|
45
16
|
end
|
46
17
|
end
|
47
18
|
end
|
@@ -3,8 +3,10 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Budgets
|
5
5
|
module Admin
|
6
|
-
# This command is executed when admin sends vote reminders.
|
6
|
+
# This command is executed when an admin sends vote reminders.
|
7
7
|
class CreateOrderReminders < Decidim::Command
|
8
|
+
delegate :current_component, :voting_enabled?, :voting_ends_soon?, :minimum_interval_between_reminders, to: :form
|
9
|
+
|
8
10
|
def initialize(form)
|
9
11
|
@form = form
|
10
12
|
end
|
@@ -29,8 +31,8 @@ module Decidim
|
|
29
31
|
next if %w(active pending).exclude? record.state
|
30
32
|
|
31
33
|
record.state = begin
|
32
|
-
if record.remindable.created_at >
|
33
|
-
(reminder.deliveries.present? && reminder.deliveries.last.created_at >
|
34
|
+
if record.remindable.created_at > minimum_interval_between_reminders.ago ||
|
35
|
+
(reminder.deliveries.present? && reminder.deliveries.last.created_at > minimum_interval_between_reminders.ago)
|
34
36
|
"pending"
|
35
37
|
else
|
36
38
|
"active"
|
@@ -41,25 +43,9 @@ module Decidim
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
def minimum_time_between_reminders
|
45
|
-
form.minimum_interval_between_reminders.ago
|
46
|
-
end
|
47
|
-
|
48
46
|
def generator
|
49
47
|
@generator ||= Decidim::Budgets::OrderReminderGenerator.new
|
50
48
|
end
|
51
|
-
|
52
|
-
def current_component
|
53
|
-
form.current_component
|
54
|
-
end
|
55
|
-
|
56
|
-
def voting_enabled?
|
57
|
-
form.voting_enabled?
|
58
|
-
end
|
59
|
-
|
60
|
-
def voting_ends_soon?
|
61
|
-
form.voting_ends_soon?
|
62
|
-
end
|
63
49
|
end
|
64
50
|
end
|
65
51
|
end
|
@@ -5,65 +5,39 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user creates a Project from the admin
|
7
7
|
# panel.
|
8
|
-
class CreateProject < Decidim::
|
8
|
+
class CreateProject < Decidim::Commands::CreateResource
|
9
9
|
include ::Decidim::GalleryMethods
|
10
|
+
fetch_form_attributes :budget, :scope, :category, :title, :description, :budget_amount, :address, :latitude, :longitude
|
10
11
|
|
11
|
-
|
12
|
-
@form = form
|
13
|
-
end
|
14
|
-
|
15
|
-
# Creates the project if valid.
|
16
|
-
#
|
17
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
18
|
-
def call
|
19
|
-
return broadcast(:invalid) if @form.invalid?
|
20
|
-
|
21
|
-
if process_gallery?
|
22
|
-
build_gallery
|
23
|
-
return broadcast(:invalid) if gallery_invalid?
|
24
|
-
end
|
12
|
+
private
|
25
13
|
|
26
|
-
|
27
|
-
create_project!
|
28
|
-
link_proposals
|
29
|
-
create_gallery if process_gallery?
|
30
|
-
end
|
14
|
+
attr_reader :gallery
|
31
15
|
|
32
|
-
|
16
|
+
def run_after_hooks
|
17
|
+
@attached_to = resource
|
18
|
+
link_proposals
|
19
|
+
create_gallery if process_gallery?
|
33
20
|
end
|
34
21
|
|
35
|
-
|
36
|
-
|
37
|
-
attr_reader :form, :project, :gallery
|
22
|
+
def run_before_hooks
|
23
|
+
return unless process_gallery?
|
38
24
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
scope: form.scope,
|
43
|
-
category: form.category,
|
44
|
-
title: form.title,
|
45
|
-
description: form.description,
|
46
|
-
budget_amount: form.budget_amount,
|
47
|
-
address: form.address,
|
48
|
-
latitude: form.latitude,
|
49
|
-
longitude: form.longitude
|
50
|
-
}
|
25
|
+
build_gallery
|
26
|
+
raise Decidim::Commands::HookError if gallery_invalid?
|
27
|
+
end
|
51
28
|
|
52
|
-
|
53
|
-
|
54
|
-
form.current_user,
|
55
|
-
attributes,
|
56
|
-
visibility: "all"
|
57
|
-
)
|
58
|
-
@attached_to = @project
|
29
|
+
def extra_params
|
30
|
+
{ visibility: "all" }
|
59
31
|
end
|
60
32
|
|
33
|
+
def resource_class = Decidim::Budgets::Project
|
34
|
+
|
61
35
|
def proposals
|
62
|
-
@proposals ||=
|
36
|
+
@proposals ||= resource.sibling_scope(:proposals).where(id: form.proposal_ids)
|
63
37
|
end
|
64
38
|
|
65
39
|
def link_proposals
|
66
|
-
|
40
|
+
resource.link_resources(proposals, "included_proposals")
|
67
41
|
end
|
68
42
|
end
|
69
43
|
end
|
@@ -5,37 +5,12 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user destroys a Budget
|
7
7
|
# from the admin panel.
|
8
|
-
class DestroyBudget < Decidim::
|
9
|
-
def initialize(budget, current_user)
|
10
|
-
@budget = budget
|
11
|
-
@current_user = current_user
|
12
|
-
end
|
13
|
-
|
14
|
-
# Destroys the budget if valid.
|
15
|
-
#
|
16
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
17
|
-
def call
|
18
|
-
return broadcast(:invalid) if budget.projects.present?
|
19
|
-
|
20
|
-
destroy_budget!
|
21
|
-
|
22
|
-
broadcast(:ok, budget)
|
23
|
-
end
|
24
|
-
|
8
|
+
class DestroyBudget < Decidim::Commands::DestroyResource
|
25
9
|
private
|
26
10
|
|
27
|
-
|
11
|
+
def invalid? = resource.projects.present?
|
28
12
|
|
29
|
-
def
|
30
|
-
Decidim.traceability.perform_action!(
|
31
|
-
:delete,
|
32
|
-
budget,
|
33
|
-
current_user,
|
34
|
-
visibility: "all"
|
35
|
-
) do
|
36
|
-
budget.destroy!
|
37
|
-
end
|
38
|
-
end
|
13
|
+
def extra_params = { visibility: "all" }
|
39
14
|
end
|
40
15
|
end
|
41
16
|
end
|
@@ -75,8 +75,7 @@ module Decidim
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def all_proposals
|
78
|
-
Decidim::Proposals::Proposal.where(component: origin_component)
|
79
|
-
.where(state: :accepted).published.not_hidden.not_withdrawn.accepted.order(:published_at)
|
78
|
+
Decidim::Proposals::Proposal.where(component: origin_component).accepted
|
80
79
|
end
|
81
80
|
|
82
81
|
def origin_component
|
@@ -88,13 +87,9 @@ module Decidim
|
|
88
87
|
# because otherwise duplicates could be created until the component is
|
89
88
|
# published.
|
90
89
|
original_proposal.linked_resources(:projects, "included_proposals", component_published: false).any? do |project|
|
91
|
-
|
90
|
+
project.budget == form.budget
|
92
91
|
end
|
93
92
|
end
|
94
|
-
|
95
|
-
def component_budgets
|
96
|
-
@component_budgets ||= Decidim::Budgets::Budget.where(component: form.budget.component)
|
97
|
-
end
|
98
93
|
end
|
99
94
|
end
|
100
95
|
end
|
@@ -5,43 +5,12 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user updates a Budget
|
7
7
|
# from the admin panel.
|
8
|
-
class UpdateBudget < Decidim::
|
9
|
-
|
10
|
-
@form = form
|
11
|
-
@budget = budget
|
12
|
-
end
|
8
|
+
class UpdateBudget < Decidim::Commands::UpdateResource
|
9
|
+
fetch_form_attributes :scope, :title, :weight, :description, :total_budget
|
13
10
|
|
14
|
-
|
15
|
-
#
|
16
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
17
|
-
def call
|
18
|
-
return broadcast(:invalid) if form.invalid?
|
11
|
+
protected
|
19
12
|
|
20
|
-
|
21
|
-
|
22
|
-
broadcast(:ok, budget)
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
attr_reader :form, :budget
|
28
|
-
|
29
|
-
def update_budget!
|
30
|
-
attributes = {
|
31
|
-
scope: form.scope,
|
32
|
-
title: form.title,
|
33
|
-
weight: form.weight,
|
34
|
-
description: form.description,
|
35
|
-
total_budget: form.total_budget
|
36
|
-
}
|
37
|
-
|
38
|
-
Decidim.traceability.update!(
|
39
|
-
budget,
|
40
|
-
form.current_user,
|
41
|
-
attributes,
|
42
|
-
visibility: "all"
|
43
|
-
)
|
44
|
-
end
|
13
|
+
def extra_params = { visibility: "all" }
|
45
14
|
end
|
46
15
|
end
|
47
16
|
end
|
@@ -5,66 +5,40 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user changes a Project from the admin
|
7
7
|
# panel.
|
8
|
-
class UpdateProject < Decidim::
|
8
|
+
class UpdateProject < Decidim::Commands::UpdateResource
|
9
9
|
include ::Decidim::GalleryMethods
|
10
|
+
fetch_form_attributes :scope, :category, :title, :description, :budget_amount, :address, :latitude, :longitude
|
10
11
|
|
11
|
-
# Initializes an UpdateProject Command.
|
12
|
-
#
|
13
|
-
# form - The form from which to get the data.
|
14
|
-
# project - The current instance of the project to be updated.
|
15
12
|
def initialize(form, project)
|
16
|
-
|
17
|
-
@project = project
|
13
|
+
super(form, project)
|
18
14
|
@attached_to = project
|
19
15
|
end
|
20
16
|
|
21
|
-
|
22
|
-
#
|
23
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
24
|
-
def call
|
25
|
-
return broadcast(:invalid) if form.invalid?
|
26
|
-
|
27
|
-
if process_gallery?
|
28
|
-
build_gallery
|
29
|
-
return broadcast(:invalid) if gallery_invalid?
|
30
|
-
end
|
31
|
-
|
32
|
-
transaction do
|
33
|
-
update_project
|
34
|
-
link_proposals
|
35
|
-
create_gallery if process_gallery?
|
36
|
-
photo_cleanup!
|
37
|
-
end
|
17
|
+
private
|
38
18
|
|
39
|
-
|
19
|
+
def run_after_hooks
|
20
|
+
link_proposals
|
21
|
+
create_gallery if process_gallery?
|
22
|
+
photo_cleanup!
|
40
23
|
end
|
41
24
|
|
42
|
-
|
25
|
+
def run_before_hooks
|
26
|
+
return unless process_gallery?
|
43
27
|
|
44
|
-
|
28
|
+
build_gallery
|
29
|
+
raise Decidim::Commands::HookError if gallery_invalid?
|
30
|
+
end
|
45
31
|
|
46
|
-
def
|
47
|
-
|
48
|
-
project,
|
49
|
-
form.current_user,
|
50
|
-
scope: form.scope,
|
51
|
-
category: form.category,
|
52
|
-
title: form.title,
|
53
|
-
description: form.description,
|
54
|
-
budget_amount: form.budget_amount,
|
55
|
-
selected_at:,
|
56
|
-
address: form.address,
|
57
|
-
latitude: form.latitude,
|
58
|
-
longitude: form.longitude
|
59
|
-
)
|
32
|
+
def attributes
|
33
|
+
super.merge({ selected_at: })
|
60
34
|
end
|
61
35
|
|
62
36
|
def proposals
|
63
|
-
@proposals ||=
|
37
|
+
@proposals ||= resource.sibling_scope(:proposals).where(id: form.proposal_ids)
|
64
38
|
end
|
65
39
|
|
66
40
|
def link_proposals
|
67
|
-
|
41
|
+
resource.link_resources(proposals, "included_proposals")
|
68
42
|
end
|
69
43
|
|
70
44
|
def selected_at
|
@@ -9,7 +9,7 @@ module Decidim
|
|
9
9
|
# Note that it inherits from `Decidim::Components::BaseController`, which
|
10
10
|
# override its layout and provide all kinds of useful methods.
|
11
11
|
class ApplicationController < Decidim::Admin::Components::BaseController
|
12
|
-
helper_method :budget, :projects, :project
|
12
|
+
helper_method :budget, :projects, :project, :maps_enabled?
|
13
13
|
|
14
14
|
def budget
|
15
15
|
@budget ||= Budget.where(component: current_component).includes(:projects).find_by(id: params[:budget_id])
|
@@ -24,6 +24,10 @@ module Decidim
|
|
24
24
|
def project
|
25
25
|
@project ||= projects.find(params[:id])
|
26
26
|
end
|
27
|
+
|
28
|
+
def maps_enabled?
|
29
|
+
@maps_enabled ||= current_component.settings.geocoding_enabled?
|
30
|
+
end
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
@@ -68,7 +68,7 @@ module Decidim
|
|
68
68
|
def destroy
|
69
69
|
enforce_permission_to(:destroy, :project, project:)
|
70
70
|
|
71
|
-
|
71
|
+
Decidim::Commands::DestroyResource.call(project, current_user) do
|
72
72
|
on(:ok) do
|
73
73
|
flash[:notice] = I18n.t("projects.destroy.success", scope: "decidim.budgets.admin")
|
74
74
|
redirect_to budget_projects_path(budget)
|
@@ -11,7 +11,7 @@ module Decidim
|
|
11
11
|
|
12
12
|
translatable_attribute :title, String
|
13
13
|
attribute :weight, Integer, default: 0
|
14
|
-
translatable_attribute :description,
|
14
|
+
translatable_attribute :description, String
|
15
15
|
attribute :total_budget, Integer, default: 0
|
16
16
|
attribute :decidim_scope_id, Integer
|
17
17
|
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
validates :scope, presence: true, if: ->(form) { form.decidim_scope_id.present? }
|
22
22
|
validates :decidim_scope_id, scope_belongs_to_component: true, if: ->(form) { form.decidim_scope_id.present? }
|
23
23
|
|
24
|
-
# Finds the Scope from the given decidim_scope_id, uses the
|
24
|
+
# Finds the Scope from the given decidim_scope_id, uses the component scope if missing.
|
25
25
|
#
|
26
26
|
# Returns a Decidim::Scope
|
27
27
|
def scope
|
@@ -11,7 +11,7 @@ module Decidim
|
|
11
11
|
include Decidim::ApplicationHelper
|
12
12
|
|
13
13
|
translatable_attribute :title, String
|
14
|
-
translatable_attribute :description,
|
14
|
+
translatable_attribute :description, String
|
15
15
|
|
16
16
|
attribute :address, String
|
17
17
|
attribute :latitude, Float
|
@@ -34,7 +34,7 @@ module Decidim
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def scope
|
37
|
-
@scope ||= @
|
37
|
+
@scope ||= @scope_id ? current_component.scopes.find_by(id: @scope_id) : current_component.scope
|
38
38
|
end
|
39
39
|
|
40
40
|
def scope_id
|
@@ -46,7 +46,7 @@ module Decidim
|
|
46
46
|
|
47
47
|
# Returns false if the current order does not have a rule for minimum budget
|
48
48
|
# Returns false if the current order has not reached the minimum budget
|
49
|
-
#
|
49
|
+
# Otherwise returns true
|
50
50
|
def current_order_minimum_reached?
|
51
51
|
return false if current_order.minimum_budget.zero?
|
52
52
|
|
@@ -114,7 +114,7 @@ module Decidim
|
|
114
114
|
project
|
115
115
|
.slice(:latitude, :longitude, :address)
|
116
116
|
.merge(
|
117
|
-
title:
|
117
|
+
title: decidim_escape_translated(project.title),
|
118
118
|
link: ::Decidim::ResourceLocatorPresenter.new([project.budget, project]).path,
|
119
119
|
items: cell("decidim/budgets/project_metadata", project).send(:project_items_for_map).to_json
|
120
120
|
)
|
@@ -4,12 +4,8 @@
|
|
4
4
|
}
|
5
5
|
|
6
6
|
&-summary {
|
7
|
-
@apply bg-tertiary;
|
8
|
-
|
9
|
-
box-shadow: 0 4px 6px 0 rgba(211, 211, 211, 0.25);
|
10
|
-
|
11
7
|
&__content {
|
12
|
-
@apply p-4 md:p-0;
|
8
|
+
@apply bg-tertiary p-4 md:h-full md:p-0;
|
13
9
|
}
|
14
10
|
|
15
11
|
&__container {
|
@@ -21,7 +17,7 @@
|
|
21
17
|
}
|
22
18
|
|
23
19
|
&__content__header {
|
24
|
-
@apply col-span-2 text-2xl mb-2;
|
20
|
+
@apply col-span-2 text-2xl pb-2 mb-2;
|
25
21
|
|
26
22
|
.ql-editor {
|
27
23
|
@apply inline-block text-2xl;
|
@@ -37,24 +33,20 @@
|
|
37
33
|
}
|
38
34
|
|
39
35
|
&__progressbar {
|
40
|
-
@apply my-4 relative;
|
36
|
+
@apply my-0 lg:my-4 relative;
|
41
37
|
|
42
38
|
.budget-progress {
|
43
|
-
@apply bg-white rounded;
|
39
|
+
@apply bg-white rounded h-2;
|
44
40
|
}
|
45
41
|
|
46
42
|
&--minimum {
|
47
|
-
@apply absolute;
|
48
|
-
|
49
|
-
.progress-meter--minimum-mark {
|
50
|
-
@apply h-[20px] ml-auto w-[2px] bg-black block;
|
51
|
-
}
|
43
|
+
@apply absolute h-2 bg-gray-3 rounded-s;
|
52
44
|
}
|
53
45
|
|
54
46
|
&--meter {
|
55
47
|
background-color: var(--success);
|
56
48
|
|
57
|
-
@apply h-
|
49
|
+
@apply h-2 rounded-s absolute;
|
58
50
|
}
|
59
51
|
}
|
60
52
|
|
@@ -71,11 +63,11 @@
|
|
71
63
|
}
|
72
64
|
|
73
65
|
&__progressbar-legend {
|
74
|
-
@apply text-sm block;
|
66
|
+
@apply text-xs md:text-sm block;
|
75
67
|
}
|
76
68
|
|
77
69
|
&__progressbar-legend-strong {
|
78
|
-
@apply font-
|
70
|
+
@apply font-semibold block text-[10px] md:text-sm text-nowrap;
|
79
71
|
}
|
80
72
|
}
|
81
73
|
|
@@ -231,7 +223,23 @@
|
|
231
223
|
}
|
232
224
|
|
233
225
|
.budget-summary__button-modal {
|
234
|
-
@apply col-span-12 mb-4 pb-4;
|
226
|
+
@apply hidden lg:text-secondary lg:block lg:col-span-12 lg:mb-4 lg:pb-4;
|
227
|
+
}
|
228
|
+
|
229
|
+
.budget-summary__button-dropdown {
|
230
|
+
@apply col-span-12 text-secondary lg:hidden;
|
231
|
+
|
232
|
+
&_text {
|
233
|
+
@apply flex gap-4 justify-start;
|
234
|
+
|
235
|
+
svg {
|
236
|
+
@apply w-5 h-5;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
p {
|
241
|
+
@apply text-gray-4 font-normal text-[13px];
|
242
|
+
}
|
235
243
|
}
|
236
244
|
|
237
245
|
.progressbox-fixed-wrapper {
|
@@ -262,7 +270,11 @@
|
|
262
270
|
}
|
263
271
|
|
264
272
|
.budget-summary__button-modal {
|
265
|
-
@apply col-span-10 col-start-2 justify-start;
|
273
|
+
@apply hidden lg:text-secondary lg:block lg:col-span-10 lg:col-start-2 lg:justify-start;
|
274
|
+
}
|
275
|
+
|
276
|
+
.budget-summary__button-dropdown {
|
277
|
+
@apply block text-secondary col-span-10 col-start-2 justify-start lg:hidden;
|
266
278
|
}
|
267
279
|
|
268
280
|
.progressbox-fixed-wrapper {
|