decidim-budgets 0.29.2 → 0.30.0.rc2

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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/budgets/budget_list_item/vote_action.erb +2 -2
  3. data/app/cells/decidim/budgets/budgets_list/main_list.erb +1 -1
  4. data/app/cells/decidim/budgets/budgets_list/show.erb +1 -1
  5. data/app/cells/decidim/budgets/project_history_cell.rb +48 -0
  6. data/app/cells/decidim/budgets/project_metadata_cell.rb +3 -3
  7. data/app/cells/decidim/budgets/project_vote_button/show.erb +4 -2
  8. data/app/cells/decidim/budgets/project_vote_button_cell.rb +4 -0
  9. data/app/commands/decidim/budgets/admin/create_budget.rb +1 -1
  10. data/app/commands/decidim/budgets/admin/create_project.rb +1 -1
  11. data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +1 -8
  12. data/app/commands/decidim/budgets/admin/update_budget.rb +1 -1
  13. data/app/commands/decidim/budgets/admin/update_project.rb +2 -2
  14. data/app/commands/decidim/budgets/admin/update_project_selection.rb +1 -1
  15. data/app/controllers/concerns/decidim/budgets/admin/filterable.rb +7 -11
  16. data/app/controllers/decidim/budgets/admin/budgets_controller.rb +12 -15
  17. data/app/controllers/decidim/budgets/admin/projects_controller.rb +61 -85
  18. data/app/controllers/decidim/budgets/orders_controller.rb +7 -3
  19. data/app/controllers/decidim/budgets/projects_controller.rb +7 -16
  20. data/app/forms/decidim/budgets/admin/budget_form.rb +0 -17
  21. data/app/forms/decidim/budgets/admin/project_form.rb +7 -33
  22. data/app/forms/decidim/budgets/admin/project_import_proposals_form.rb +0 -11
  23. data/app/helpers/decidim/budgets/projects_helper.rb +6 -31
  24. data/app/models/decidim/budgets/budget.rb +2 -0
  25. data/app/models/decidim/budgets/project.rb +21 -1
  26. data/app/packs/stylesheets/budgets.scss +6 -4
  27. data/app/permissions/decidim/budgets/admin/permissions.rb +4 -4
  28. data/app/presenters/decidim/budgets/admin_log/budget_presenter.rb +1 -1
  29. data/app/presenters/decidim/budgets/admin_log/project_presenter.rb +1 -1
  30. data/app/presenters/decidim/budgets/project_presenter.rb +28 -0
  31. data/app/queries/decidim/budgets/filtered_projects.rb +2 -2
  32. data/app/queries/decidim/budgets/metrics/budget_followers_metric_measure.rb +2 -2
  33. data/app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb +2 -2
  34. data/app/serializers/decidim/budgets/download_your_data_budgets_order_serializer.rb +2 -2
  35. data/app/views/decidim/budgets/admin/budgets/_actions.html.erb +21 -0
  36. data/app/views/decidim/budgets/admin/budgets/_budget-tr.html.erb +18 -0
  37. data/app/views/decidim/budgets/admin/budgets/_budgets-thead.html.erb +8 -0
  38. data/app/views/decidim/budgets/admin/budgets/_form.html.erb +0 -6
  39. data/app/views/decidim/budgets/admin/budgets/index.html.erb +16 -48
  40. data/app/views/decidim/budgets/admin/budgets/manage_trash.html.erb +19 -0
  41. data/app/views/decidim/budgets/admin/projects/_actions.html.erb +27 -0
  42. data/app/views/decidim/budgets/admin/projects/_bulk-actions.html.erb +0 -2
  43. data/app/views/decidim/budgets/admin/projects/_form.html.erb +6 -8
  44. data/app/views/decidim/budgets/admin/projects/_project-tr.html.erb +2 -27
  45. data/app/views/decidim/budgets/admin/projects/_projects-thead.html.erb +14 -0
  46. data/app/views/decidim/budgets/admin/projects/bulk_actions/_dropdown.html.erb +7 -10
  47. data/app/views/decidim/budgets/admin/projects/bulk_actions/_taxonomy_change.html.erb +23 -0
  48. data/app/views/decidim/budgets/admin/projects/index.html.erb +19 -21
  49. data/app/views/decidim/budgets/admin/projects/manage_trash.html.erb +26 -0
  50. data/app/views/decidim/budgets/admin/projects/update_attribute.js.erb +1 -1
  51. data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +0 -5
  52. data/app/views/decidim/budgets/budgets/index.html.erb +7 -2
  53. data/app/views/decidim/budgets/order_summary_mailer/order_summary.html.erb +0 -10
  54. data/app/views/decidim/budgets/orders/status.html.erb +52 -0
  55. data/app/views/decidim/budgets/projects/_order.html.erb +1 -1
  56. data/app/views/decidim/budgets/projects/_order_progress_summary_content.html.erb +4 -4
  57. data/app/views/decidim/budgets/projects/index.html.erb +11 -18
  58. data/app/views/decidim/budgets/projects/index.js.erb +1 -1
  59. data/app/views/decidim/budgets/projects/show.html.erb +20 -10
  60. data/config/locales/ar.yml +3 -10
  61. data/config/locales/bg.yml +3 -43
  62. data/config/locales/ca.yml +95 -42
  63. data/config/locales/cs.yml +101 -42
  64. data/config/locales/de.yml +95 -42
  65. data/config/locales/el.yml +3 -39
  66. data/config/locales/en.yml +95 -42
  67. data/config/locales/es-MX.yml +95 -42
  68. data/config/locales/es-PY.yml +95 -42
  69. data/config/locales/es.yml +95 -42
  70. data/config/locales/eu.yml +95 -42
  71. data/config/locales/fi-plain.yml +95 -42
  72. data/config/locales/fi.yml +94 -41
  73. data/config/locales/fr-CA.yml +38 -44
  74. data/config/locales/fr.yml +38 -44
  75. data/config/locales/ga-IE.yml +0 -3
  76. data/config/locales/gl.yml +3 -7
  77. data/config/locales/hu.yml +3 -40
  78. data/config/locales/id-ID.yml +3 -3
  79. data/config/locales/is-IS.yml +0 -3
  80. data/config/locales/it.yml +3 -5
  81. data/config/locales/ja.yml +92 -42
  82. data/config/locales/kaa.yml +0 -1
  83. data/config/locales/ko.yml +0 -20
  84. data/config/locales/lb.yml +3 -5
  85. data/config/locales/lt.yml +3 -41
  86. data/config/locales/lv.yml +3 -3
  87. data/config/locales/nl.yml +3 -24
  88. data/config/locales/no.yml +3 -8
  89. data/config/locales/pl.yml +5 -43
  90. data/config/locales/pt-BR.yml +4 -43
  91. data/config/locales/pt.yml +3 -5
  92. data/config/locales/ro-RO.yml +3 -17
  93. data/config/locales/ru.yml +3 -3
  94. data/config/locales/sk.yml +3 -3
  95. data/config/locales/sq-AL.yml +0 -16
  96. data/config/locales/sv.yml +94 -41
  97. data/config/locales/tr-TR.yml +3 -5
  98. data/config/locales/uk.yml +3 -3
  99. data/config/locales/zh-CN.yml +3 -4
  100. data/config/locales/zh-TW.yml +3 -39
  101. data/db/migrate/20200827154129_add_commentable_counter_cache_to_projects.rb +1 -1
  102. data/db/migrate/20210310120613_add_followable_counter_cache_to_budgets.rb +1 -1
  103. data/db/migrate/20240828103724_add_deleted_at_to_decidim_budgets_budgets.rb +8 -0
  104. data/db/migrate/20240916135141_add_deleted_at_to_decidim_budgets_projects.rb +8 -0
  105. data/decidim-budgets.gemspec +1 -1
  106. data/lib/decidim/api/budget_type.rb +3 -6
  107. data/lib/decidim/api/budgets_type.rb +4 -5
  108. data/lib/decidim/api/project_type.rb +6 -8
  109. data/lib/decidim/budgets/admin_engine.rb +16 -2
  110. data/lib/decidim/budgets/component.rb +4 -5
  111. data/lib/decidim/budgets/engine.rb +1 -0
  112. data/lib/decidim/budgets/project_serializer.rb +16 -14
  113. data/lib/decidim/budgets/seeds.rb +0 -2
  114. data/lib/decidim/budgets/version.rb +1 -1
  115. metadata +27 -22
  116. data/app/cells/decidim/budgets/project_tags/show.erb +0 -5
  117. data/app/cells/decidim/budgets/project_tags_cell.rb +0 -18
  118. data/app/commands/decidim/budgets/admin/destroy_budget.rb +0 -17
  119. data/app/commands/decidim/budgets/admin/update_project_category.rb +0 -48
  120. data/app/commands/decidim/budgets/admin/update_project_scope.rb +0 -54
  121. data/app/helpers/decidim/budgets/admin/application_helper.rb +0 -13
  122. data/app/views/decidim/budgets/admin/projects/bulk_actions/_recategorize.html.erb +0 -15
  123. data/app/views/decidim/budgets/admin/projects/bulk_actions/_scope-change.html.erb +0 -22
@@ -6,16 +6,15 @@ module Decidim
6
6
  graphql_name "Budgets"
7
7
  description "A budget component of a participatory space."
8
8
 
9
- field :budgets, Decidim::Budgets::BudgetType.connection_type, null: true, connection: true
9
+ field :budget, Decidim::Budgets::BudgetType, "A single Budget object", null: true do
10
+ argument :id, GraphQL::Types::ID, "The id of the Budget requested", required: true
11
+ end
12
+ field :budgets, Decidim::Budgets::BudgetType.connection_type, "A collection of Budgets", null: true, connection: true
10
13
 
11
14
  def budgets
12
15
  Budget.where(component: object).includes(:component)
13
16
  end
14
17
 
15
- field :budget, Decidim::Budgets::BudgetType, null: true do
16
- argument :id, GraphQL::Types::ID, required: true
17
- end
18
-
19
18
  def budget(**args)
20
19
  Budget.where(component: object).find_by(id: args[:id])
21
20
  end
@@ -3,21 +3,19 @@
3
3
  module Decidim
4
4
  module Budgets
5
5
  class ProjectType < Decidim::Api::Types::BaseObject
6
- implements Decidim::Core::ScopableInterface
6
+ implements Decidim::Core::TimestampsInterface
7
+ implements Decidim::Core::TaxonomizableInterface
7
8
  implements Decidim::Core::AttachableInterface
8
9
  implements Decidim::Comments::CommentableInterface
9
- implements Decidim::Core::CategorizableInterface
10
10
 
11
11
  description "A project"
12
12
 
13
- field :id, GraphQL::Types::ID, "The internal ID for this project", null: false
14
- field :title, Decidim::Core::TranslatedFieldType, "The title for this project", null: true
15
- field :description, Decidim::Core::TranslatedFieldType, "The description for this project", null: true
16
13
  field :budget_amount, GraphQL::Types::Int, "The budget amount for this project", null: true, camelize: false
17
- field :selected, GraphQL::Types::Boolean, "Whether this proposal is selected or not", method: :selected?, null: true
18
- field :created_at, Decidim::Core::DateTimeType, "When this project was created", null: true
19
- field :updated_at, Decidim::Core::DateTimeType, "When this project was updated", null: true
14
+ field :description, Decidim::Core::TranslatedFieldType, "The description for this project", null: true
15
+ field :id, GraphQL::Types::ID, "The internal ID for this project", null: false
20
16
  field :reference, GraphQL::Types::String, "The reference for this project", null: true
17
+ field :selected, GraphQL::Types::Boolean, "Whether this proposal is selected or not", method: :selected?, null: true
18
+ field :title, Decidim::Core::TranslatedFieldType, "The title for this project", null: true
21
19
 
22
20
  def self.authorized?(object, context)
23
21
  context[:project] = object
@@ -13,13 +13,27 @@ module Decidim
13
13
 
14
14
  routes do
15
15
  resources :budgets do
16
+ collection do
17
+ get :manage_trash
18
+ end
19
+
20
+ member do
21
+ patch :soft_delete
22
+ patch :restore
23
+ end
24
+
16
25
  resources :projects do
17
26
  collection do
18
- post :update_category
19
- post :update_scope
27
+ post :update_taxonomies
20
28
  post :update_selected
21
29
  post :update_budget
22
30
  resource :proposals_import, only: [:new, :create]
31
+ get :manage_trash
32
+ end
33
+
34
+ member do
35
+ patch :soft_delete
36
+ patch :restore
23
37
  end
24
38
  end
25
39
  end
@@ -46,8 +46,8 @@ Decidim.register_component(:budgets) do |component|
46
46
  component.register_stat :orders_count do |components, start_at, end_at|
47
47
  budgets = Decidim::Budgets::Budget.where(component: components)
48
48
  orders = Decidim::Budgets::Order.where(budget: budgets)
49
- orders = orders.where("created_at >= ?", start_at) if start_at.present?
50
- orders = orders.where("created_at <= ?", end_at) if end_at.present?
49
+ orders = orders.where(created_at: start_at..) if start_at.present?
50
+ orders = orders.where(created_at: ..end_at) if end_at.present?
51
51
  orders.count
52
52
  end
53
53
 
@@ -66,7 +66,7 @@ Decidim.register_component(:budgets) do |component|
66
66
  budgets = resource_id ? Decidim::Budgets::Budget.find(resource_id) : Decidim::Budgets::Budget.where(decidim_component_id: component_instance)
67
67
  Decidim::Budgets::Project
68
68
  .where(decidim_budgets_budget_id: budgets)
69
- .includes(:category, :component)
69
+ .includes(:taxonomies, :component)
70
70
  end
71
71
 
72
72
  exports.include_in_open_data = true
@@ -75,8 +75,7 @@ Decidim.register_component(:budgets) do |component|
75
75
  end
76
76
 
77
77
  component.settings(:global) do |settings|
78
- settings.attribute :scopes_enabled, type: :boolean, default: false
79
- settings.attribute :scope_id, type: :scope
78
+ settings.attribute :taxonomy_filters, type: :taxonomy_filters
80
79
  settings.attribute :workflow, type: :enum, default: "one", choices: -> { Decidim::Budgets.workflows.keys.map(&:to_s) }
81
80
  settings.attribute :projects_per_page, type: :integer, default: 12
82
81
  settings.attribute :vote_rule_threshold_percent_enabled, type: :boolean, default: true
@@ -16,6 +16,7 @@ module Decidim
16
16
  resource :order, only: [:destroy] do
17
17
  member do
18
18
  post :checkout
19
+ get :status
19
20
  end
20
21
  resource :line_item, only: [:create, :destroy]
21
22
  end
@@ -16,14 +16,7 @@ module Decidim
16
16
  def serialize
17
17
  {
18
18
  id: project.id,
19
- category: {
20
- id: project.category.try(:id),
21
- name: project.category.try(:name) || empty_translatable
22
- },
23
- scope: {
24
- id: project.scope.try(:id),
25
- name: project.scope.try(:name) || empty_translatable
26
- },
19
+ taxonomies:,
27
20
  participatory_space: {
28
21
  id: project.participatory_space.id,
29
22
  url: Decidim::ResourceLocatorPresenter.new(project.participatory_space).url
@@ -31,13 +24,22 @@ module Decidim
31
24
  component: { id: component.id },
32
25
  title: project.title,
33
26
  description: project.description,
34
- budget: { id: project.budget.id },
27
+ budget: { id: project.budget.id,
28
+ title: project.budget.title,
29
+ url: budget_url },
35
30
  budget_amount: project.budget_amount,
36
- confirmed_votes: project.confirmed_orders_count,
31
+ confirmed_votes: (project.confirmed_orders_count if
32
+ project.component.current_settings.show_votes?),
37
33
  comments: project.comments_count,
38
34
  created_at: project.created_at,
39
35
  url: project.polymorphic_resource_url({}),
40
36
  address: project.address,
37
+ updated_at: project.updated_at,
38
+ selected_at: project.selected_at,
39
+ reference: project.reference,
40
+ follows_count: project.follows_count,
41
+ latitude: project.latitude,
42
+ longitude: project.longitude,
41
43
  related_proposals:,
42
44
  related_proposal_titles:,
43
45
  related_proposal_urls:
@@ -49,10 +51,6 @@ module Decidim
49
51
  attr_reader :project
50
52
  alias resource project
51
53
 
52
- def component
53
- project.component
54
- end
55
-
56
54
  def related_proposals
57
55
  project.linked_resources(:proposals, "included_proposals").map(&:id)
58
56
  end
@@ -73,6 +71,10 @@ module Decidim
73
71
  Decidim::ResourceLocatorPresenter.new(project).url
74
72
  end
75
73
 
74
+ def budget_url
75
+ Decidim::EngineRouter.main_proxy(component).budget_url(project.budget)
76
+ end
77
+
76
78
  def empty_translatable(locales = Decidim.available_locales)
77
79
  locales.each_with_object({}) do |locale, result|
78
80
  result[locale.to_s] = ""
@@ -80,8 +80,6 @@ module Decidim
80
80
  def create_project!(budget:)
81
81
  params = {
82
82
  budget:,
83
- scope: participatory_space.organization.scopes.sample,
84
- category: participatory_space.categories.sample,
85
83
  title: Decidim::Faker::Localized.sentence(word_count: 2),
86
84
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
87
85
  Decidim::Faker::Localized.paragraph(sentence_count: 3)
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-budgets version.
5
5
  module Budgets
6
6
  def self.version
7
- "0.29.2"
7
+ "0.30.0.rc2"
8
8
  end
9
9
  end
10
10
  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.29.2
4
+ version: 0.30.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-02-12 00:00:00.000000000 Z
13
+ date: 2025-03-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-comments
@@ -18,70 +18,70 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.29.2
21
+ version: 0.30.0.rc2
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.29.2
28
+ version: 0.30.0.rc2
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.29.2
35
+ version: 0.30.0.rc2
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.29.2
42
+ version: 0.30.0.rc2
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.29.2
49
+ version: 0.30.0.rc2
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.29.2
56
+ version: 0.30.0.rc2
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.29.2
63
+ version: 0.30.0.rc2
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.29.2
70
+ version: 0.30.0.rc2
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.29.2
77
+ version: 0.30.0.rc2
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.29.2
84
+ version: 0.30.0.rc2
85
85
  description: A budgets component for decidim's participatory spaces.
86
86
  email:
87
87
  - josepjaume@gmail.com
@@ -115,14 +115,13 @@ files:
115
115
  - app/cells/decidim/budgets/limit_announcement_cell.rb
116
116
  - app/cells/decidim/budgets/order_activity_cell.rb
117
117
  - app/cells/decidim/budgets/project_cell.rb
118
+ - app/cells/decidim/budgets/project_history_cell.rb
118
119
  - app/cells/decidim/budgets/project_l/extra_data.erb
119
120
  - app/cells/decidim/budgets/project_l/metadata.erb
120
121
  - app/cells/decidim/budgets/project_l_cell.rb
121
122
  - app/cells/decidim/budgets/project_metadata_cell.rb
122
123
  - app/cells/decidim/budgets/project_s_cell.rb
123
124
  - app/cells/decidim/budgets/project_selected_status_cell.rb
124
- - app/cells/decidim/budgets/project_tags/show.erb
125
- - app/cells/decidim/budgets/project_tags_cell.rb
126
125
  - app/cells/decidim/budgets/project_vote_button/show.erb
127
126
  - app/cells/decidim/budgets/project_vote_button_cell.rb
128
127
  - app/cells/decidim/budgets/project_voted_hint_cell.rb
@@ -131,12 +130,9 @@ files:
131
130
  - app/commands/decidim/budgets/admin/create_budget.rb
132
131
  - app/commands/decidim/budgets/admin/create_order_reminders.rb
133
132
  - app/commands/decidim/budgets/admin/create_project.rb
134
- - app/commands/decidim/budgets/admin/destroy_budget.rb
135
133
  - app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb
136
134
  - app/commands/decidim/budgets/admin/update_budget.rb
137
135
  - app/commands/decidim/budgets/admin/update_project.rb
138
- - app/commands/decidim/budgets/admin/update_project_category.rb
139
- - app/commands/decidim/budgets/admin/update_project_scope.rb
140
136
  - app/commands/decidim/budgets/admin/update_project_selection.rb
141
137
  - app/commands/decidim/budgets/admin/update_projects_budget.rb
142
138
  - app/commands/decidim/budgets/cancel_order.rb
@@ -161,7 +157,6 @@ files:
161
157
  - app/forms/decidim/budgets/admin/order_reminder_form.rb
162
158
  - app/forms/decidim/budgets/admin/project_form.rb
163
159
  - app/forms/decidim/budgets/admin/project_import_proposals_form.rb
164
- - app/helpers/decidim/budgets/admin/application_helper.rb
165
160
  - app/helpers/decidim/budgets/admin/filterable_helper.rb
166
161
  - app/helpers/decidim/budgets/admin/project_bulk_actions_helper.rb
167
162
  - app/helpers/decidim/budgets/application_helper.rb
@@ -187,25 +182,32 @@ files:
187
182
  - app/permissions/decidim/budgets/permissions.rb
188
183
  - app/presenters/decidim/budgets/admin_log/budget_presenter.rb
189
184
  - app/presenters/decidim/budgets/admin_log/project_presenter.rb
185
+ - app/presenters/decidim/budgets/project_presenter.rb
190
186
  - app/queries/decidim/budgets/filtered_projects.rb
191
187
  - app/queries/decidim/budgets/metrics/budget_followers_metric_measure.rb
192
188
  - app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb
193
189
  - app/serializers/decidim/budgets/download_your_data_budgets_order_serializer.rb
194
190
  - app/services/decidim/budgets/order_reminder_generator.rb
191
+ - app/views/decidim/budgets/admin/budgets/_actions.html.erb
192
+ - app/views/decidim/budgets/admin/budgets/_budget-tr.html.erb
193
+ - app/views/decidim/budgets/admin/budgets/_budgets-thead.html.erb
195
194
  - app/views/decidim/budgets/admin/budgets/_form.html.erb
196
195
  - app/views/decidim/budgets/admin/budgets/edit.html.erb
197
196
  - app/views/decidim/budgets/admin/budgets/index.html.erb
197
+ - app/views/decidim/budgets/admin/budgets/manage_trash.html.erb
198
198
  - app/views/decidim/budgets/admin/budgets/new.html.erb
199
+ - app/views/decidim/budgets/admin/projects/_actions.html.erb
199
200
  - app/views/decidim/budgets/admin/projects/_bulk-actions.html.erb
200
201
  - app/views/decidim/budgets/admin/projects/_form.html.erb
201
202
  - app/views/decidim/budgets/admin/projects/_project-tr.html.erb
203
+ - app/views/decidim/budgets/admin/projects/_projects-thead.html.erb
202
204
  - app/views/decidim/budgets/admin/projects/bulk_actions/_budget-change.html.erb
203
205
  - app/views/decidim/budgets/admin/projects/bulk_actions/_change-selected.html.erb
204
206
  - app/views/decidim/budgets/admin/projects/bulk_actions/_dropdown.html.erb
205
- - app/views/decidim/budgets/admin/projects/bulk_actions/_recategorize.html.erb
206
- - app/views/decidim/budgets/admin/projects/bulk_actions/_scope-change.html.erb
207
+ - app/views/decidim/budgets/admin/projects/bulk_actions/_taxonomy_change.html.erb
207
208
  - app/views/decidim/budgets/admin/projects/edit.html.erb
208
209
  - app/views/decidim/budgets/admin/projects/index.html.erb
210
+ - app/views/decidim/budgets/admin/projects/manage_trash.html.erb
209
211
  - app/views/decidim/budgets/admin/projects/new.html.erb
210
212
  - app/views/decidim/budgets/admin/projects/update_attribute.js.erb
211
213
  - app/views/decidim/budgets/admin/proposals_imports/new.html.erb
@@ -213,6 +215,7 @@ files:
213
215
  - app/views/decidim/budgets/budgets/index.js.erb
214
216
  - app/views/decidim/budgets/line_items/update_budget.js.erb
215
217
  - app/views/decidim/budgets/order_summary_mailer/order_summary.html.erb
218
+ - app/views/decidim/budgets/orders/status.html.erb
216
219
  - app/views/decidim/budgets/projects/_addition_selector.html.erb
217
220
  - app/views/decidim/budgets/projects/_budget_confirm.html.erb
218
221
  - app/views/decidim/budgets/projects/_budget_excess.html.erb
@@ -336,6 +339,8 @@ files:
336
339
  - db/migrate/20200827154129_add_commentable_counter_cache_to_projects.rb
337
340
  - db/migrate/20210310120613_add_followable_counter_cache_to_budgets.rb
338
341
  - db/migrate/20220428072638_add_geolocalization_fields_to_projects.rb
342
+ - db/migrate/20240828103724_add_deleted_at_to_decidim_budgets_budgets.rb
343
+ - db/migrate/20240916135141_add_deleted_at_to_decidim_budgets_projects.rb
339
344
  - decidim-budgets.gemspec
340
345
  - lib/decidim/api/budget_type.rb
341
346
  - lib/decidim/api/budgets_type.rb
@@ -372,14 +377,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
372
377
  requirements:
373
378
  - - "~>"
374
379
  - !ruby/object:Gem::Version
375
- version: 3.2.0
380
+ version: 3.3.0
376
381
  required_rubygems_version: !ruby/object:Gem::Requirement
377
382
  requirements:
378
383
  - - ">="
379
384
  - !ruby/object:Gem::Version
380
385
  version: '0'
381
386
  requirements: []
382
- rubygems_version: 3.4.10
387
+ rubygems_version: 3.5.11
383
388
  signing_key:
384
389
  specification_version: 4
385
390
  summary: Decidim budgets module
@@ -1,5 +0,0 @@
1
- <%= content_tag :ul, class: tags_classes do %>
2
- <%= content_tag :li, icon("price-tag-3-line", class: "inline-block") %>
3
- <%= content_tag :li, link_to_category if category? %>
4
- <%= content_tag :li, link_to_scope if scope? %>
5
- <% end %>
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Budgets
5
- # This cell overrides *_path methods from Decidim::TagsCell for project tags
6
- class ProjectTagsCell < Decidim::TagsCell
7
- private
8
-
9
- def category_path
10
- resource_locator([model.budget, model]).index(filter: { with_any_category: [model.category.id.to_s] })
11
- end
12
-
13
- def scope_path
14
- resource_locator([model.budget, model]).index(filter: { with_any_scope: [model.scope.id] })
15
- end
16
- end
17
- end
18
- end
@@ -1,17 +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 destroys a Budget
7
- # from the admin panel.
8
- class DestroyBudget < Decidim::Commands::DestroyResource
9
- private
10
-
11
- def invalid? = resource.projects.present?
12
-
13
- def extra_params = { visibility: "all" }
14
- end
15
- end
16
- end
17
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Budgets
5
- module Admin
6
- class UpdateProjectCategory < Decidim::Command
7
- include TranslatableAttributes
8
-
9
- # Public: Initializes the command.
10
- #
11
- # category_id - the category id to update
12
- # project_ids - the project ids to update.
13
- def initialize(category_id, project_ids)
14
- @category = Decidim::Category.find_by id: category_id
15
- @project_ids = project_ids
16
- @response = { category_name: "", successful: [], errored: [] }
17
- end
18
-
19
- def call
20
- return broadcast(:invalid_category) if @category.blank?
21
- return broadcast(:invalid_project_ids) if @project_ids.blank?
22
-
23
- @response[:category_name] = @category.translated_name
24
- Project.where(id: @project_ids).find_each do |project|
25
- if @category == project.category
26
- @response[:errored] << translated_attribute(project.title)
27
- else
28
- transaction do
29
- update_project_category project
30
- end
31
- @response[:successful] << translated_attribute(project.title)
32
- end
33
- end
34
-
35
- broadcast(:update_projects_category, @response)
36
- end
37
-
38
- private
39
-
40
- def update_project_category(project)
41
- project.update!(
42
- category: @category
43
- )
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Budgets
5
- module Admin
6
- class UpdateProjectScope < Decidim::Command
7
- include TranslatableAttributes
8
-
9
- # Public: Initializes the command.
10
- #
11
- # scope_id - the scope id to update
12
- # project_ids - the project ids to update.
13
- def initialize(scope_id, project_ids)
14
- @scope = ::Decidim::Scope.find_by id: scope_id
15
- @project_ids = project_ids
16
- @response = { scope_name: "", successful: [], errored: [] }
17
- end
18
-
19
- def call
20
- return broadcast(:invalid_scope) if @scope.blank?
21
- return broadcast(:invalid_project_ids) if @project_ids.blank?
22
-
23
- update_projects_scope
24
-
25
- broadcast(:update_projects_scope, @response)
26
- end
27
-
28
- private
29
-
30
- attr_reader :scope, :project_ids
31
-
32
- def update_projects_scope
33
- @response[:scope_name] = translated_attribute(scope.name, scope.organization)
34
- ::Decidim::Budgets::Project.where(id: project_ids).find_each do |project|
35
- if scope == project.scope
36
- @response[:errored] << translated_attribute(project.title)
37
- else
38
- transaction do
39
- update_project_scope project
40
- end
41
- @response[:successful] << translated_attribute(project.title)
42
- end
43
- end
44
- end
45
-
46
- def update_project_scope(project)
47
- project.update!(
48
- scope:
49
- )
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Budgets
5
- module Admin
6
- # Custom helpers, scoped to the budgets admin engine.
7
- #
8
- module ApplicationHelper
9
- include Decidim::Admin::ResourceScopeHelper
10
- end
11
- end
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- <div id="js-recategorize-projects-actions" class="hide js-bulk-action-form">
2
- <%= form_tag(update_category_budget_projects_path, method: :post, remote: true, id: "js-form-recategorize-projects", class: "form form-defaults flex items-center gap-x-2") do %>
3
- <div class="hide">
4
- <% projects.each do |project| %>
5
- <%= check_box_tag "project_ids[]", project.id, false, class: "js-check-all-resources js-resource-id-#{project.id}" %>
6
- <% end %>
7
- </div>
8
-
9
- <%= bulk_categories_select current_component.categories %>
10
-
11
- <%= submit_tag(t("decidim.budgets.admin.projects.index.update"), id: "js-submit-edit-category", class: "button button__sm button__secondary small button--simple float-left") %>
12
-
13
- <button id="js-cancel-edit-category" class="button button__sm button__secondary js-cancel-bulk-action" type="button"><%= t("decidim.budgets.admin.projects.index.cancel") %></button>
14
- <% end %>
15
- </div>
@@ -1,22 +0,0 @@
1
- <div id="js-scope-change-projects-actions" class="hide js-bulk-action-form">
2
- <%= form_tag(update_scope_budget_projects_path, method: :post, remote: true, id: "js-form-scope-change-projects", class: "form form-defaults flex items-center gap-x-2") do %>
3
-
4
- <div class="hide">
5
- <% projects.each do |project| %>
6
- <%= check_box_tag "project_ids[]", project.id, false, class: "js-check-all-resources js-resource-id-#{project.id}" %>
7
- <% end %>
8
- </div>
9
-
10
- <%= scopes_select_tag(:scope_id) %>
11
-
12
- <%= submit_tag(
13
- t("decidim.budgets.admin.projects.index.update_scope_button"),
14
- id: "js-submit-scope-change-projects",
15
- class: "button button__sm button__secondary small button--simple float-left"
16
- ) %>
17
-
18
- <button id="js-cancel-scope-change-projects" class="button button__sm button__secondary js-cancel-bulk-action" type="button">
19
- <%= t("decidim.budgets.admin.projects.index.cancel") %>
20
- </button>
21
- <% end %>
22
- </div>