decidim-budgets 0.29.1 → 0.30.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/budget_list_item/vote_action.erb +2 -2
- data/app/cells/decidim/budgets/project_history_cell.rb +48 -0
- data/app/cells/decidim/budgets/project_metadata_cell.rb +3 -3
- data/app/cells/decidim/budgets/project_vote_button/show.erb +4 -2
- data/app/cells/decidim/budgets/project_vote_button_cell.rb +4 -0
- data/app/commands/decidim/budgets/admin/create_budget.rb +1 -1
- data/app/commands/decidim/budgets/admin/create_project.rb +1 -1
- data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +7 -10
- data/app/commands/decidim/budgets/admin/update_budget.rb +1 -1
- data/app/commands/decidim/budgets/admin/update_project.rb +2 -2
- data/app/commands/decidim/budgets/admin/update_project_selection.rb +1 -1
- data/app/controllers/concerns/decidim/budgets/admin/filterable.rb +7 -11
- data/app/controllers/decidim/budgets/admin/budgets_controller.rb +12 -15
- data/app/controllers/decidim/budgets/admin/projects_controller.rb +61 -85
- data/app/controllers/decidim/budgets/orders_controller.rb +7 -3
- data/app/controllers/decidim/budgets/projects_controller.rb +7 -16
- data/app/forms/decidim/budgets/admin/budget_form.rb +1 -18
- data/app/forms/decidim/budgets/admin/project_form.rb +8 -34
- data/app/forms/decidim/budgets/admin/project_import_proposals_form.rb +0 -11
- data/app/helpers/decidim/budgets/projects_helper.rb +6 -31
- data/app/models/decidim/budgets/budget.rb +2 -0
- data/app/models/decidim/budgets/project.rb +21 -1
- data/app/packs/stylesheets/budgets.scss +0 -2
- data/app/permissions/decidim/budgets/admin/permissions.rb +4 -4
- data/app/permissions/decidim/budgets/permissions.rb +2 -0
- data/app/presenters/decidim/budgets/admin_log/budget_presenter.rb +1 -1
- data/app/presenters/decidim/budgets/admin_log/project_presenter.rb +1 -1
- data/app/presenters/decidim/budgets/project_presenter.rb +28 -0
- data/app/queries/decidim/budgets/filtered_projects.rb +2 -2
- data/app/queries/decidim/budgets/metrics/budget_followers_metric_measure.rb +2 -2
- data/app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb +2 -2
- data/app/serializers/decidim/budgets/download_your_data_budgets_order_serializer.rb +2 -2
- data/app/views/decidim/budgets/admin/budgets/_actions.html.erb +21 -0
- data/app/views/decidim/budgets/admin/budgets/_budget-tr.html.erb +18 -0
- data/app/views/decidim/budgets/admin/budgets/_budgets-thead.html.erb +8 -0
- data/app/views/decidim/budgets/admin/budgets/_form.html.erb +0 -6
- data/app/views/decidim/budgets/admin/budgets/index.html.erb +16 -48
- data/app/views/decidim/budgets/admin/budgets/manage_trash.html.erb +19 -0
- data/app/views/decidim/budgets/admin/projects/_actions.html.erb +27 -0
- data/app/views/decidim/budgets/admin/projects/_bulk-actions.html.erb +0 -2
- data/app/views/decidim/budgets/admin/projects/_form.html.erb +6 -8
- data/app/views/decidim/budgets/admin/projects/_project-tr.html.erb +2 -27
- data/app/views/decidim/budgets/admin/projects/_projects-thead.html.erb +14 -0
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_dropdown.html.erb +7 -10
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_taxonomy_change.html.erb +23 -0
- data/app/views/decidim/budgets/admin/projects/index.html.erb +19 -21
- data/app/views/decidim/budgets/admin/projects/manage_trash.html.erb +26 -0
- data/app/views/decidim/budgets/admin/projects/update_attribute.js.erb +1 -1
- data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +0 -5
- data/app/views/decidim/budgets/budgets/index.html.erb +6 -1
- data/app/views/decidim/budgets/order_summary_mailer/order_summary.html.erb +0 -10
- data/app/views/decidim/budgets/orders/status.html.erb +52 -0
- data/app/views/decidim/budgets/projects/_order_progress_summary_content.html.erb +3 -3
- data/app/views/decidim/budgets/projects/index.html.erb +10 -17
- data/app/views/decidim/budgets/projects/index.js.erb +10 -0
- data/app/views/decidim/budgets/projects/show.html.erb +19 -11
- data/config/locales/ar.yml +4 -13
- data/config/locales/bg.yml +3 -44
- data/config/locales/bn-BD.yml +1 -0
- data/config/locales/bs-BA.yml +22 -0
- data/config/locales/ca.yml +95 -42
- data/config/locales/cs.yml +101 -42
- data/config/locales/de.yml +95 -42
- data/config/locales/el.yml +3 -40
- data/config/locales/en.yml +95 -42
- data/config/locales/es-MX.yml +95 -42
- data/config/locales/es-PY.yml +95 -42
- data/config/locales/es.yml +95 -42
- data/config/locales/eu.yml +176 -114
- data/config/locales/fi-plain.yml +107 -54
- data/config/locales/fi.yml +148 -95
- data/config/locales/fr-CA.yml +38 -44
- data/config/locales/fr.yml +38 -44
- data/config/locales/ga-IE.yml +0 -7
- data/config/locales/gl.yml +3 -14
- data/config/locales/hu.yml +3 -41
- data/config/locales/id-ID.yml +3 -6
- data/config/locales/is-IS.yml +0 -6
- data/config/locales/it.yml +3 -10
- data/config/locales/ja.yml +92 -42
- data/config/locales/kaa.yml +0 -1
- data/config/locales/ko.yml +0 -12
- data/config/locales/lb.yml +3 -9
- data/config/locales/lt.yml +3 -42
- data/config/locales/lv.yml +3 -6
- data/config/locales/nl.yml +3 -25
- data/config/locales/no.yml +3 -15
- data/config/locales/pl.yml +5 -44
- data/config/locales/pt-BR.yml +4 -44
- data/config/locales/pt.yml +3 -10
- data/config/locales/ro-RO.yml +3 -18
- data/config/locales/ru.yml +3 -6
- data/config/locales/sk.yml +3 -6
- data/config/locales/sq-AL.yml +0 -9
- data/config/locales/sv.yml +96 -43
- data/config/locales/tr-TR.yml +3 -10
- data/config/locales/uk.yml +3 -6
- data/config/locales/zh-CN.yml +3 -9
- data/config/locales/zh-TW.yml +3 -40
- data/db/migrate/20200827154129_add_commentable_counter_cache_to_projects.rb +1 -1
- data/db/migrate/20210310120613_add_followable_counter_cache_to_budgets.rb +1 -1
- data/db/migrate/20240828103724_add_deleted_at_to_decidim_budgets_budgets.rb +8 -0
- data/db/migrate/20240916135141_add_deleted_at_to_decidim_budgets_projects.rb +8 -0
- data/decidim-budgets.gemspec +2 -2
- data/lib/decidim/api/budget_type.rb +8 -5
- data/lib/decidim/api/budgets_type.rb +5 -8
- data/lib/decidim/api/project_type.rb +19 -8
- data/lib/decidim/budgets/admin_engine.rb +16 -2
- data/lib/decidim/budgets/component.rb +4 -5
- data/lib/decidim/budgets/engine.rb +1 -0
- data/lib/decidim/budgets/project_serializer.rb +16 -14
- data/lib/decidim/budgets/seeds.rb +0 -2
- data/lib/decidim/budgets/version.rb +1 -1
- metadata +30 -23
- data/app/cells/decidim/budgets/project_tags/show.erb +0 -5
- data/app/cells/decidim/budgets/project_tags_cell.rb +0 -18
- data/app/commands/decidim/budgets/admin/destroy_budget.rb +0 -17
- data/app/commands/decidim/budgets/admin/update_project_category.rb +0 -48
- data/app/commands/decidim/budgets/admin/update_project_scope.rb +0 -54
- data/app/helpers/decidim/budgets/admin/application_helper.rb +0 -13
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_recategorize.html.erb +0 -15
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_scope-change.html.erb +0 -22
@@ -5,20 +5,19 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This class holds a Form to create/update projects from Decidim's admin panel.
|
7
7
|
class ProjectForm < Decidim::Form
|
8
|
-
include TranslatableAttributes
|
9
|
-
include
|
10
|
-
include
|
8
|
+
include Decidim::TranslatableAttributes
|
9
|
+
include Decidim::HasTaxonomyFormAttributes
|
10
|
+
include Decidim::AttachmentAttributes
|
11
|
+
include Decidim::TranslationsHelper
|
11
12
|
include Decidim::ApplicationHelper
|
12
13
|
|
13
14
|
translatable_attribute :title, String
|
14
|
-
translatable_attribute :description,
|
15
|
+
translatable_attribute :description, Decidim::Attributes::RichText
|
15
16
|
|
16
17
|
attribute :address, String
|
17
18
|
attribute :latitude, Float
|
18
19
|
attribute :longitude, Float
|
19
20
|
attribute :budget_amount, Integer
|
20
|
-
attribute :decidim_scope_id, Integer
|
21
|
-
attribute :decidim_category_id, Integer
|
22
21
|
attribute :proposal_ids, Array[Integer]
|
23
22
|
attribute :attachment, AttachmentForm
|
24
23
|
attribute :selected, Boolean
|
@@ -29,22 +28,18 @@ module Decidim
|
|
29
28
|
validates :description, translatable_presence: true
|
30
29
|
validates :budget_amount, presence: true, numericality: { greater_than: 0 }
|
31
30
|
validates :address, geocoding: true, if: ->(form) { form.has_address? && !form.geocoded? }
|
32
|
-
validates :category, presence: true, if: ->(form) { form.decidim_category_id.present? }
|
33
|
-
validates :scope, presence: true, if: ->(form) { form.decidim_scope_id.present? }
|
34
|
-
validates :decidim_scope_id, scope_belongs_to_component: true, if: ->(form) { form.decidim_scope_id.present? }
|
35
31
|
|
36
32
|
validate :notify_missing_attachment_if_errored
|
37
33
|
|
38
|
-
delegate :categories, to: :current_component
|
39
34
|
alias component current_component
|
40
35
|
|
41
36
|
def map_model(model)
|
42
37
|
self.proposal_ids = model.linked_resources(:proposals, "included_proposals").pluck(:id)
|
43
38
|
self.selected = model.selected?
|
39
|
+
end
|
44
40
|
|
45
|
-
|
46
|
-
|
47
|
-
self.decidim_category_id = model.categorization.decidim_category_id
|
41
|
+
def participatory_space_manifest
|
42
|
+
@participatory_space_manifest ||= current_component.participatory_space.manifest.name
|
48
43
|
end
|
49
44
|
|
50
45
|
def proposals
|
@@ -72,27 +67,6 @@ module Decidim
|
|
72
67
|
@budget ||= context[:budget]
|
73
68
|
end
|
74
69
|
|
75
|
-
# Finds the Category from the decidim_category_id.
|
76
|
-
#
|
77
|
-
# Returns a Decidim::Category
|
78
|
-
def category
|
79
|
-
@category ||= categories.find_by(id: decidim_category_id)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Finds the Scope from the given decidim_scope_id, uses the component scope if missing.
|
83
|
-
#
|
84
|
-
# Returns a Decidim::Scope
|
85
|
-
def scope
|
86
|
-
@scope ||= @attributes["decidim_scope_id"].value ? current_component.scopes.find_by(id: @attributes["decidim_scope_id"].value) : current_component.scope
|
87
|
-
end
|
88
|
-
|
89
|
-
# Scope identifier
|
90
|
-
#
|
91
|
-
# Returns the scope identifier related to the project
|
92
|
-
def decidim_scope_id
|
93
|
-
super || scope&.id
|
94
|
-
end
|
95
|
-
|
96
70
|
private
|
97
71
|
|
98
72
|
# This method will add an error to the `attachment` field only if there is
|
@@ -9,15 +9,12 @@ module Decidim
|
|
9
9
|
mimic :proposals_import
|
10
10
|
|
11
11
|
attribute :origin_component_id, Integer
|
12
|
-
attribute :scope_id, Integer
|
13
12
|
attribute :default_budget, Integer
|
14
13
|
attribute :import_all_accepted_proposals, Boolean
|
15
14
|
|
16
15
|
validates :origin_component_id, :origin_component, :current_component, presence: true
|
17
16
|
validates :import_all_accepted_proposals, allow_nil: false, acceptance: true
|
18
17
|
validates :default_budget, presence: true, numericality: { greater_than: 0 }
|
19
|
-
validates :scope, presence: true, if: ->(form) { form.scope_id.present? }
|
20
|
-
validates :scope_id, scope_belongs_to_component: true, if: ->(form) { form.scope_id.present? }
|
21
18
|
|
22
19
|
def origin_component
|
23
20
|
@origin_component ||= origin_components.find_by(id: origin_component_id)
|
@@ -33,14 +30,6 @@ module Decidim
|
|
33
30
|
end
|
34
31
|
end
|
35
32
|
|
36
|
-
def scope
|
37
|
-
@scope ||= @scope_id ? current_component.scopes.find_by(id: @scope_id) : current_component.scope
|
38
|
-
end
|
39
|
-
|
40
|
-
def scope_id
|
41
|
-
@scope_id || scope&.id
|
42
|
-
end
|
43
|
-
|
44
33
|
def budget
|
45
34
|
@budget ||= context[:budget]
|
46
35
|
end
|
@@ -101,31 +101,6 @@ module Decidim
|
|
101
101
|
%(<strong>#{current_rule_call_for_action_text}</strong>. #{rule_text}).html_safe
|
102
102
|
end
|
103
103
|
|
104
|
-
# Serialize a collection of geocoded projects to be used by the dynamic map component
|
105
|
-
#
|
106
|
-
# geocoded_projects - A collection of geocoded projects
|
107
|
-
def projects_data_for_map(geocoded_projects)
|
108
|
-
geocoded_projects.map do |project|
|
109
|
-
project_data_for_map(project)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def project_data_for_map(project)
|
114
|
-
project
|
115
|
-
.slice(:latitude, :longitude, :address)
|
116
|
-
.merge(
|
117
|
-
title: decidim_escape_translated(project.title),
|
118
|
-
link: ::Decidim::ResourceLocatorPresenter.new([project.budget, project]).path,
|
119
|
-
items: cell("decidim/budgets/project_metadata", project).send(:project_items_for_map).to_json
|
120
|
-
)
|
121
|
-
end
|
122
|
-
|
123
|
-
def has_position?(project)
|
124
|
-
return if project.address.blank?
|
125
|
-
|
126
|
-
project.latitude.present? && project.longitude.present?
|
127
|
-
end
|
128
|
-
|
129
104
|
def filter_addition_type_values
|
130
105
|
return [] if voting_finished?
|
131
106
|
|
@@ -138,12 +113,12 @@ module Decidim
|
|
138
113
|
def filter_sections
|
139
114
|
@filter_sections ||= begin
|
140
115
|
items = []
|
141
|
-
items.append(method: :with_any_status, collection: filter_status_values,
|
142
|
-
|
143
|
-
items.append(method:
|
144
|
-
|
145
|
-
|
146
|
-
|
116
|
+
items.append(method: :with_any_status, collection: filter_status_values, label: t("decidim.budgets.projects.filters.status"), id: "status") if voting_finished?
|
117
|
+
current_component.available_taxonomy_filters.each do |taxonomy_filter|
|
118
|
+
items.append(method: "with_any_taxonomies[#{taxonomy_filter.root_taxonomy_id}]",
|
119
|
+
collection: filter_taxonomy_values_for(taxonomy_filter),
|
120
|
+
label: decidim_sanitize_translated(taxonomy_filter.name),
|
121
|
+
id: "taxonomy-#{taxonomy_filter.root_taxonomy_id}")
|
147
122
|
end
|
148
123
|
end
|
149
124
|
|
@@ -4,6 +4,7 @@ module Decidim
|
|
4
4
|
module Budgets
|
5
5
|
# The data store for a budget in the Decidim::Budgets component.
|
6
6
|
class Budget < ApplicationRecord
|
7
|
+
include Decidim::Taxonomizable
|
7
8
|
include Decidim::Resourceable
|
8
9
|
include Decidim::ScopableResource
|
9
10
|
include Decidim::HasComponent
|
@@ -11,6 +12,7 @@ module Decidim
|
|
11
12
|
include Decidim::Randomable
|
12
13
|
include Traceable
|
13
14
|
include Loggable
|
15
|
+
include Decidim::SoftDeletable
|
14
16
|
|
15
17
|
component_manifest_name "budgets"
|
16
18
|
|
@@ -6,6 +6,7 @@ module Decidim
|
|
6
6
|
# title, description and any other useful information to render a custom project.
|
7
7
|
class Project < Budgets::ApplicationRecord
|
8
8
|
include Decidim::Resourceable
|
9
|
+
include Decidim::Taxonomizable
|
9
10
|
include Decidim::ScopableResource
|
10
11
|
include Decidim::HasCategory
|
11
12
|
include Decidim::HasAttachments
|
@@ -19,6 +20,7 @@ module Decidim
|
|
19
20
|
include Decidim::Searchable
|
20
21
|
include Decidim::TranslatableResource
|
21
22
|
include Decidim::FilterableResource
|
23
|
+
include Decidim::SoftDeletable
|
22
24
|
|
23
25
|
translatable_fields :title, :description
|
24
26
|
|
@@ -69,6 +71,12 @@ module Decidim
|
|
69
71
|
Decidim::Budgets::AdminLog::ProjectPresenter
|
70
72
|
end
|
71
73
|
|
74
|
+
# Returns the presenter for this project, to be used in the views.
|
75
|
+
# Required by ResourceRenderer.
|
76
|
+
def presenter
|
77
|
+
Decidim::Budgets::ProjectPresenter.new(self)
|
78
|
+
end
|
79
|
+
|
72
80
|
def resource_locator
|
73
81
|
::Decidim::ResourceLocatorPresenter.new([budget, self])
|
74
82
|
end
|
@@ -139,7 +147,19 @@ module Decidim
|
|
139
147
|
end
|
140
148
|
|
141
149
|
def self.ransackable_scopes(_auth_object = nil)
|
142
|
-
[:with_any_status, :
|
150
|
+
[:with_any_status, :with_any_taxonomies]
|
151
|
+
end
|
152
|
+
|
153
|
+
def self.ransackable_attributes(auth_object = nil)
|
154
|
+
base = %w(search_text description title)
|
155
|
+
|
156
|
+
return base unless auth_object&.admin?
|
157
|
+
|
158
|
+
base + %w(id_string id selected selected_at confirmed_orders_count)
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.ransackable_associations(_auth_object = nil)
|
162
|
+
%w(taxonomies)
|
143
163
|
end
|
144
164
|
end
|
145
165
|
end
|
@@ -14,14 +14,14 @@ module Decidim
|
|
14
14
|
allow!
|
15
15
|
when :update
|
16
16
|
toggle_allow(budget)
|
17
|
-
when :
|
17
|
+
when :publish, :unpublish
|
18
18
|
toggle_allow(budget && budget.projects.empty?)
|
19
19
|
end
|
20
20
|
when :project, :projects
|
21
21
|
case permission_action.action
|
22
|
-
when :create, :import_proposals, :
|
22
|
+
when :create, :import_proposals, :project_taxonomy
|
23
23
|
permission_action.allow!
|
24
|
-
when :update
|
24
|
+
when :update
|
25
25
|
permission_action.allow! if project.present?
|
26
26
|
end
|
27
27
|
when :order
|
@@ -29,7 +29,7 @@ module Decidim
|
|
29
29
|
when :remind
|
30
30
|
permission_action.allow!
|
31
31
|
end
|
32
|
-
when :
|
32
|
+
when :project_taxonomy, :project_selected
|
33
33
|
permission_action.allow!
|
34
34
|
end
|
35
35
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
class ProjectPresenter < Decidim::ResourcePresenter
|
6
|
+
# Renders the title of the project
|
7
|
+
#
|
8
|
+
# @param links [Boolean] Should hashtags in the title be rendered as links? Default is +false+.
|
9
|
+
# @param extras [Boolean] Should extra hashtags be included? Default is +true+.
|
10
|
+
# @param html_escape [Boolean] Should HTML entities within the title be escaped? Default is +false+.
|
11
|
+
# @param all_locales [Boolean] Should the title be returned for all locales? Default is +false+.
|
12
|
+
# @return [String] The title of the project.
|
13
|
+
def title(links: false, extras: true, html_escape: false, all_locales: false)
|
14
|
+
return unless project
|
15
|
+
|
16
|
+
super(project.title, links, html_escape, all_locales, extras:)
|
17
|
+
end
|
18
|
+
|
19
|
+
delegate_missing_to :project
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def project
|
24
|
+
__getobj__
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -28,8 +28,8 @@ module Decidim
|
|
28
28
|
# by a range of dates.
|
29
29
|
def query
|
30
30
|
projects = Decidim::Budgets::Project.where(budget: budgets)
|
31
|
-
projects = projects.where(
|
32
|
-
projects = projects.where(
|
31
|
+
projects = projects.where(created_at: @start_at..) if @start_at.present?
|
32
|
+
projects = projects.where(created_at: ..@end_at) if @end_at.present?
|
33
33
|
projects
|
34
34
|
end
|
35
35
|
|
@@ -15,10 +15,10 @@ module Decidim
|
|
15
15
|
projects = Decidim::Budgets::Project.where(budget: budgets)
|
16
16
|
|
17
17
|
budgets_followers = Decidim::Follow.where(followable: projects).joins(:user)
|
18
|
-
.where(
|
18
|
+
.where(decidim_follows: { created_at: ..end_time })
|
19
19
|
cumulative_users = budgets_followers.pluck(:decidim_user_id)
|
20
20
|
|
21
|
-
budgets_followers = budgets_followers.where(
|
21
|
+
budgets_followers = budgets_followers.where(decidim_follows: { created_at: start_time.. })
|
22
22
|
quantity_users = budgets_followers.pluck(:decidim_user_id)
|
23
23
|
|
24
24
|
{
|
@@ -14,11 +14,11 @@ module Decidim
|
|
14
14
|
budgets = Decidim::Budgets::Budget.where(component: @resource)
|
15
15
|
orders = Decidim::Budgets::Order.where(budget: budgets)
|
16
16
|
.finished
|
17
|
-
.where(
|
17
|
+
.where(decidim_budgets_orders: { checked_out_at: ..end_time })
|
18
18
|
|
19
19
|
{
|
20
20
|
cumulative_users: orders.pluck(:decidim_user_id),
|
21
|
-
quantity_users: orders.where(
|
21
|
+
quantity_users: orders.where(decidim_budgets_orders: { checked_out_at: start_time.. }).pluck(:decidim_user_id)
|
22
22
|
}
|
23
23
|
end
|
24
24
|
end
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Budgets
|
5
5
|
class DownloadYourDataBudgetsOrderSerializer < Decidim::Exporters::Serializer
|
6
|
-
# Public: Initializes the serializer with a
|
6
|
+
# Public: Initializes the serializer with a budgets' order.
|
7
7
|
def initialize(order)
|
8
8
|
@order = order
|
9
9
|
end
|
10
10
|
|
11
|
-
# Serializes a
|
11
|
+
# Serializes a budgets' order for download your data
|
12
12
|
def serialize
|
13
13
|
{
|
14
14
|
id: order.id,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% if view == :deleted %>
|
2
|
+
<% if allowed_to? :restore, :budget, trashable_deleted_resource: budget %>
|
3
|
+
<%= icon_link_to "refresh-line", url_for(action: :restore, id: budget, controller: "budgets"), t("decidim.admin.actions.restore"), method: :patch, class: "action-icon--restore" %>
|
4
|
+
<% end %>
|
5
|
+
<% else %>
|
6
|
+
<% if allowed_to? :update, :budget, budget: budget %>
|
7
|
+
<%= icon_link_to "pencil-line", edit_budget_path(budget), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
|
8
|
+
<% else %>
|
9
|
+
<%= icon "pencil-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.budgets") %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= icon_link_to "list-check", budget_projects_path(budget), t("actions.edit_projects", scope: "decidim.budgets"), class: "action-icon--edit-projects" %>
|
13
|
+
|
14
|
+
<%= icon_link_to "eye-line", resource_locator(budget).path, t("actions.preview", scope: "decidim.budgets"), class: "action-icon--preview", target: :blank, data: { "external-link": false } %>
|
15
|
+
|
16
|
+
<% if allowed_to? :soft_delete, :budget, trashable_deleted_resource: budget %>
|
17
|
+
<%= icon_link_to "delete-bin-line", soft_delete_budget_path(budget), t("actions.soft_delete", scope: "decidim.admin"), method: :patch, class: "action-icon--remove", data: { confirm: t("actions.confirm_delete_budget", scope: "decidim.budgets") } %>
|
18
|
+
<% else %>
|
19
|
+
<%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.soft_delete", scope: "decidim.admin") %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<tr data-id="<%= budget.id %>">
|
2
|
+
<td>
|
3
|
+
<% if allowed_to? :update, :budget, budget: budget %>
|
4
|
+
<%= link_to translated_attribute(budget.title), budget_projects_path(budget) %><br>
|
5
|
+
<% else %>
|
6
|
+
<%= translated_attribute(budget.title) %>
|
7
|
+
<% end %>
|
8
|
+
</td>
|
9
|
+
<td>
|
10
|
+
<%= number_to_currency budget.total_budget, unit: Decidim.currency_unit, precision: 0 %>
|
11
|
+
</td>
|
12
|
+
<td>
|
13
|
+
<%= link_to budget.projects.count, budget_projects_path(budget) %>
|
14
|
+
</td>
|
15
|
+
<td class="table-list__actions">
|
16
|
+
<%= render partial: "decidim/budgets/admin/budgets/actions", locals: { budget:, view: } %>
|
17
|
+
</td>
|
18
|
+
</tr>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<thead>
|
2
|
+
<tr>
|
3
|
+
<th><%= t("models.budget.fields.name", scope: "decidim.budgets") %></th>
|
4
|
+
<th><%= t("models.budget.fields.total_budget", scope: "decidim.budgets") %></th>
|
5
|
+
<th><%= t("models.budget.fields.projects_count", scope: "decidim.budgets") %></th>
|
6
|
+
<th><%= t("actions.title", scope: "decidim.budgets") %></th>
|
7
|
+
</tr>
|
8
|
+
</thead>
|
@@ -16,12 +16,6 @@
|
|
16
16
|
<div class="row column">
|
17
17
|
<%= form.number_field :total_budget %>
|
18
18
|
</div>
|
19
|
-
|
20
|
-
<% if current_component.has_subscopes? %>
|
21
|
-
<div class="row column">
|
22
|
-
<%= scopes_select_field form, :decidim_scope_id, root: current_component.scope %>
|
23
|
-
</div>
|
24
|
-
<% end %>
|
25
19
|
</div>
|
26
20
|
</div>
|
27
21
|
</div>
|
@@ -17,58 +17,26 @@
|
|
17
17
|
</div>
|
18
18
|
<div class="table-scroll">
|
19
19
|
<table class="table-list">
|
20
|
-
|
21
|
-
<tr>
|
22
|
-
<th><%= t("models.budget.fields.name", scope: "decidim.budgets") %></th>
|
23
|
-
<th><%= t("models.budget.fields.total_budget", scope: "decidim.budgets") %></th>
|
24
|
-
<th><%= t("models.budget.fields.projects_count", scope: "decidim.budgets") %></th>
|
25
|
-
<% if current_component.has_subscopes? %>
|
26
|
-
<%= th_resource_scope_label %>
|
27
|
-
<% end %>
|
28
|
-
<th><%= t("actions.title", scope: "decidim.budgets") %></th>
|
29
|
-
</tr>
|
30
|
-
</thead>
|
20
|
+
<%= render partial: "budgets-thead" %>
|
31
21
|
<tbody>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
<%= link_to translated_attribute(budget.title), budget_projects_path(budget) %><br>
|
37
|
-
<% else %>
|
38
|
-
<%= translated_attribute(budget.title) %>
|
39
|
-
<% end %>
|
40
|
-
</td>
|
41
|
-
<td>
|
42
|
-
<%= number_to_currency budget.total_budget, unit: Decidim.currency_unit, precision: 0 %>
|
43
|
-
</td>
|
44
|
-
<td>
|
45
|
-
<%= link_to budget.projects.count, budget_projects_path(budget) %>
|
46
|
-
</td>
|
47
|
-
<% if current_component.has_subscopes? %>
|
48
|
-
<%= td_resource_scope_for(budget.scope) %>
|
49
|
-
<% end %>
|
50
|
-
<td class="table-list__actions">
|
51
|
-
<% if allowed_to? :update, :budget, budget: budget %>
|
52
|
-
<%= icon_link_to "pencil-line", edit_budget_path(budget), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
|
53
|
-
<% else %>
|
54
|
-
<%= icon "pencil-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.budgets") %>
|
55
|
-
<% end %>
|
56
|
-
|
57
|
-
<%= icon_link_to "list-check", budget_projects_path(budget), t("actions.edit_projects", scope: "decidim.budgets"), class: "action-icon--edit-projects" %>
|
58
|
-
|
59
|
-
<%= icon_link_to "eye-line", resource_locator(budget).path, t("actions.preview", scope: "decidim.budgets"), class: "action-icon--preview", target: :blank, data: { "external-link": false } %>
|
60
|
-
|
61
|
-
<% if allowed_to? :delete, :budget, budget: budget %>
|
62
|
-
<%= icon_link_to "delete-bin-line", budget_path(budget), t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
|
63
|
-
<% else %>
|
64
|
-
<%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.budgets") %>
|
65
|
-
<% end %>
|
66
|
-
</td>
|
67
|
-
</tr>
|
68
|
-
<% end %>
|
22
|
+
<%= render partial: "decidim/budgets/admin/budgets/budget-tr",
|
23
|
+
collection: budgets,
|
24
|
+
as: :budget,
|
25
|
+
locals: { view: :index } %>
|
69
26
|
</tbody>
|
70
27
|
</table>
|
71
28
|
</div>
|
29
|
+
<% if allowed_to? :manage_trash, :budget, participatory_space: current_participatory_space %>
|
30
|
+
<div class="card-divider mt-4">
|
31
|
+
<%= link_to manage_trash_budgets_path, class: "flex items-center underline text-secondary" do %>
|
32
|
+
<%= icon "delete-bin-2-line", class: "mr-2 fill-current text-secondary", role: "img" %>
|
33
|
+
<%= t("actions.view_deleted_budgets", scope: "decidim.budgets") %>
|
34
|
+
<span class="ml-2">
|
35
|
+
<%= icon_with_tooltip("information-line", t("actions.deleted_budgets_info", scope: "decidim.budgets")) %>
|
36
|
+
</span>
|
37
|
+
<% end %>
|
38
|
+
</div>
|
39
|
+
<% end %>
|
72
40
|
<div class="card-divider">
|
73
41
|
<strong><%= t ".finished_orders" %>: </strong><span><%= finished_orders.count %></span>
|
74
42
|
<span> | </span>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% add_decidim_page_title(t(".title")) %>
|
2
|
+
<div class="card">
|
3
|
+
<div class="item_show__header">
|
4
|
+
<h1 class="item_show__header-title">
|
5
|
+
<%= t(".title") %>
|
6
|
+
</h1>
|
7
|
+
</div>
|
8
|
+
<div class="table-scroll">
|
9
|
+
<table class="table-list">
|
10
|
+
<%= render partial: "budgets-thead" %>
|
11
|
+
<tbody>
|
12
|
+
<%= render partial: "decidim/budgets/admin/budgets/budget-tr",
|
13
|
+
collection: trashable_deleted_collection,
|
14
|
+
as: :budget,
|
15
|
+
locals: { view: :deleted } %>
|
16
|
+
</tbody>
|
17
|
+
</table>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<% if view == :deleted %>
|
2
|
+
<% if allowed_to? :restore, :project, trashable_deleted_resource: project %>
|
3
|
+
<%= icon_link_to "refresh-line", restore_budget_project_path(project.budget, project), t("decidim.admin.actions.restore"), method: :patch, class: "action-icon--restore" %>
|
4
|
+
<% end %>
|
5
|
+
<% else %>
|
6
|
+
<% if allowed_to? :update, :project, project: project %>
|
7
|
+
<%= icon_link_to "pencil-line", resource_locator([budget, project]).edit, t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if allowed_to? :update, :project, project: project %>
|
11
|
+
<%= icon_link_to "folder-line", project_attachment_collections_path(project), t("actions.attachment_collections", scope: "decidim.budgets"), class: "action-icon--attachment_collections" %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if allowed_to? :update, :project, project: project %>
|
15
|
+
<%= icon_link_to "attachment-line", project_attachments_path(project), t("actions.attachments", scope: "decidim.budgets"), class: "action-icon--attachments" %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= icon_link_to "eye-line", resource_locator([budget, project]).path, t("actions.preview", scope: "decidim.budgets"), target: :blank, class: "action-icon--preview", data: { "external-link": false } %>
|
19
|
+
|
20
|
+
<%= resource_permissions_link(project) %>
|
21
|
+
|
22
|
+
<% if allowed_to? :soft_delete, :project, trashable_deleted_resource: project %>
|
23
|
+
<%= icon_link_to "delete-bin-line", soft_delete_budget_project_path(project.budget, project), t("actions.soft_delete", scope: "decidim.admin"), method: :patch, class: "action-icon--delete", data: { confirm: t("actions.confirm_delete_project", scope: "decidim.budgets") } %>
|
24
|
+
<% else %>
|
25
|
+
<%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.admin") %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
@@ -2,8 +2,6 @@
|
|
2
2
|
<div class="bulk-actions-budgets">
|
3
3
|
<%= render partial: "decidim/budgets/admin/projects/bulk_actions/dropdown" %>
|
4
4
|
|
5
|
-
<%= render partial: "decidim/budgets/admin/projects/bulk_actions/recategorize" %>
|
6
|
-
<%= render partial: "decidim/budgets/admin/projects/bulk_actions/scope-change" %>
|
7
5
|
<%= render partial: "decidim/budgets/admin/projects/bulk_actions/change-selected" %>
|
8
6
|
<%= render partial: "decidim/budgets/admin/projects/bulk_actions/budget-change" %>
|
9
7
|
|
@@ -19,16 +19,14 @@
|
|
19
19
|
</div>
|
20
20
|
<% end %>
|
21
21
|
|
22
|
-
<% if
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
<% if @form.taxonomy_filters&.any? %>
|
23
|
+
<% @form.taxonomy_filters.each do |filter| %>
|
24
|
+
<div class="row column">
|
25
|
+
<%= filter_taxonomy_items_select_field form, :taxonomies, filter %>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
26
28
|
<% end %>
|
27
29
|
|
28
|
-
<div class="row column">
|
29
|
-
<%= form.categories_select :decidim_category_id, current_participatory_space.categories, include_blank: true, disable_parents: false %>
|
30
|
-
</div>
|
31
|
-
|
32
30
|
<% if Decidim::Budgets.enable_proposal_linking %>
|
33
31
|
<div class="row column">
|
34
32
|
<%= render partial: "decidim/proposals/proposals/proposals_picker", locals: { form:, field: :proposals } %>
|