decidim-budgets 0.20.1 → 0.23.1

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 (188) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -3
  3. data/app/assets/images/decidim/budgets/icon.svg +1 -11
  4. data/app/assets/javascripts/decidim/budgets/projects.js.es6 +26 -4
  5. data/app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss +152 -24
  6. data/app/cells/decidim/budgets/base_cell.rb +22 -0
  7. data/app/cells/decidim/budgets/budget_cell.rb +21 -0
  8. data/app/cells/decidim/budgets/budget_information_modal/show.erb +28 -0
  9. data/app/cells/decidim/budgets/budget_information_modal_cell.rb +22 -0
  10. data/app/cells/decidim/budgets/budget_list_item/show.erb +22 -0
  11. data/app/cells/decidim/budgets/budget_list_item_cell.rb +40 -0
  12. data/app/cells/decidim/budgets/budget_m/data.erb +12 -0
  13. data/app/cells/decidim/budgets/budget_m/footer.erb +5 -0
  14. data/app/cells/decidim/budgets/budget_m_cell.rb +16 -0
  15. data/app/cells/decidim/budgets/budgets_header/show.erb +7 -0
  16. data/app/cells/decidim/budgets/budgets_header_cell.rb +14 -0
  17. data/app/cells/decidim/budgets/budgets_list/card_list.erb +7 -0
  18. data/app/cells/decidim/budgets/budgets_list/highlighted.erb +11 -0
  19. data/app/cells/decidim/budgets/budgets_list/show.erb +20 -0
  20. data/app/cells/decidim/budgets/budgets_list/voted.erb +43 -0
  21. data/app/cells/decidim/budgets/budgets_list_cell.rb +39 -0
  22. data/app/cells/decidim/budgets/limit_announcement_cell.rb +52 -0
  23. data/app/cells/decidim/budgets/project_list_item/project_data.erb +19 -0
  24. data/app/cells/decidim/budgets/project_list_item/project_data_vote_button.erb +15 -0
  25. data/app/cells/decidim/budgets/project_list_item/project_image.erb +5 -0
  26. data/app/cells/decidim/budgets/project_list_item/project_text.erb +23 -0
  27. data/app/cells/decidim/budgets/project_list_item/show.erb +5 -0
  28. data/app/cells/decidim/budgets/project_list_item_cell.rb +66 -0
  29. data/app/cells/decidim/budgets/project_m/data.erb +3 -3
  30. data/app/cells/decidim/budgets/project_m/footer.erb +1 -1
  31. data/app/cells/decidim/budgets/project_m_cell.rb +4 -0
  32. data/app/cells/decidim/budgets/project_selected_status_cell.rb +28 -0
  33. data/app/cells/decidim/budgets/project_tags/show.erb +5 -0
  34. data/app/cells/decidim/budgets/project_tags_cell.rb +18 -0
  35. data/app/cells/decidim/budgets/project_voted_hint_cell.rb +33 -0
  36. data/app/cells/decidim/budgets/project_votes_count_cell.rb +44 -0
  37. data/app/commands/decidim/budgets/add_line_item.rb +7 -10
  38. data/app/commands/decidim/budgets/admin/create_budget.rb +48 -0
  39. data/app/commands/decidim/budgets/admin/create_project.rb +26 -11
  40. data/app/commands/decidim/budgets/admin/destroy_budget.rb +42 -0
  41. data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +26 -25
  42. data/app/commands/decidim/budgets/admin/update_budget.rb +48 -0
  43. data/app/commands/decidim/budgets/admin/update_project.rb +20 -2
  44. data/app/commands/decidim/budgets/checkout.rb +7 -6
  45. data/app/commands/decidim/budgets/remove_line_item.rb +3 -2
  46. data/app/controllers/concerns/decidim/budgets/needs_current_order.rb +18 -2
  47. data/app/controllers/concerns/decidim/budgets/orderable.rb +57 -0
  48. data/app/controllers/decidim/budgets/admin/application_controller.rb +10 -2
  49. data/app/controllers/decidim/budgets/admin/attachment_collections_controller.rb +1 -1
  50. data/app/controllers/decidim/budgets/admin/attachments_controller.rb +2 -2
  51. data/app/controllers/decidim/budgets/admin/budgets_controller.rb +82 -0
  52. data/app/controllers/decidim/budgets/admin/projects_controller.rb +15 -12
  53. data/app/controllers/decidim/budgets/admin/proposals_imports_controller.rb +10 -2
  54. data/app/controllers/decidim/budgets/application_controller.rb +23 -0
  55. data/app/controllers/decidim/budgets/budgets_controller.rb +24 -0
  56. data/app/controllers/decidim/budgets/line_items_controller.rb +10 -6
  57. data/app/controllers/decidim/budgets/orders_controller.rb +20 -6
  58. data/app/controllers/decidim/budgets/projects_controller.rb +28 -7
  59. data/app/forms/decidim/budgets/admin/budget_form.rb +39 -0
  60. data/app/forms/decidim/budgets/admin/component_form.rb +44 -0
  61. data/app/forms/decidim/budgets/admin/project_form.rb +25 -9
  62. data/app/forms/decidim/budgets/admin/project_import_proposals_form.rb +4 -0
  63. data/app/helpers/decidim/budgets/admin/application_helper.rb +13 -0
  64. data/app/helpers/decidim/budgets/application_helper.rb +11 -0
  65. data/app/helpers/decidim/budgets/projects_helper.rb +13 -0
  66. data/app/jobs/decidim/budgets/send_order_summary_job.rb +15 -0
  67. data/app/mailers/decidim/budgets/order_summary_mailer.rb +36 -0
  68. data/app/models/decidim/budgets/budget.rb +34 -0
  69. data/app/models/decidim/budgets/line_item.rb +4 -4
  70. data/app/models/decidim/budgets/order.rb +46 -16
  71. data/app/models/decidim/budgets/project.rb +37 -4
  72. data/app/permissions/decidim/budgets/admin/permissions.rb +23 -10
  73. data/app/permissions/decidim/budgets/permissions.rb +28 -6
  74. data/app/presenters/decidim/budgets/admin_log/budget_presenter.rb +42 -0
  75. data/app/queries/decidim/budgets/filtered_projects.rb +9 -1
  76. data/app/queries/decidim/budgets/metrics/budget_followers_metric_measure.rb +3 -2
  77. data/app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb +6 -5
  78. data/app/serializers/decidim/budgets/data_portability_budgets_order_serializer.rb +3 -2
  79. data/app/services/decidim/budgets/project_search.rb +13 -17
  80. data/app/types/decidim/budgets/budget_type.rb +24 -0
  81. data/app/types/decidim/budgets/budgets_type.rb +32 -0
  82. data/app/types/decidim/budgets/project_type.rb +26 -0
  83. data/app/views/decidim/budgets/admin/budgets/_form.html.erb +23 -0
  84. data/app/views/decidim/budgets/admin/budgets/edit.html.erb +7 -0
  85. data/app/views/decidim/budgets/admin/budgets/index.html.erb +58 -0
  86. data/app/views/decidim/budgets/admin/budgets/new.html.erb +7 -0
  87. data/app/views/decidim/budgets/admin/projects/_form.html.erb +15 -10
  88. data/app/views/decidim/budgets/admin/projects/edit.html.erb +2 -2
  89. data/app/views/decidim/budgets/admin/projects/index.html.erb +20 -7
  90. data/app/views/decidim/budgets/admin/projects/new.html.erb +2 -2
  91. data/app/views/decidim/budgets/admin/projects/proposals_picker.html.erb +1 -0
  92. data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +1 -1
  93. data/app/views/decidim/budgets/budgets/index.html.erb +5 -0
  94. data/app/views/decidim/budgets/order_summary_mailer/order_summary.html.erb +22 -0
  95. data/app/views/decidim/budgets/projects/_budget_confirm.html.erb +3 -3
  96. data/app/views/decidim/budgets/projects/_budget_summary.html.erb +26 -7
  97. data/app/views/decidim/budgets/projects/_filters.html.erb +15 -7
  98. data/app/views/decidim/budgets/projects/_linked_projects.html.erb +2 -2
  99. data/app/views/decidim/budgets/projects/_order_progress.html.erb +14 -18
  100. data/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +3 -3
  101. data/app/views/decidim/budgets/projects/_project.html.erb +1 -57
  102. data/app/views/decidim/budgets/projects/_project_budget_button.html.erb +36 -7
  103. data/app/views/decidim/budgets/projects/_projects.html.erb +8 -1
  104. data/app/views/decidim/budgets/projects/index.html.erb +15 -7
  105. data/app/views/decidim/budgets/projects/index.js.erb +8 -0
  106. data/app/views/decidim/budgets/projects/show.html.erb +18 -11
  107. data/config/locales/am-ET.yml +1 -0
  108. data/config/locales/ar.yml +3 -17
  109. data/config/locales/bg-BG.yml +7 -0
  110. data/config/locales/bg.yml +6 -0
  111. data/config/locales/ca.yml +126 -12
  112. data/config/locales/cs.yml +145 -31
  113. data/config/locales/da-DK.yml +1 -0
  114. data/config/locales/da.yml +1 -0
  115. data/config/locales/de.yml +115 -12
  116. data/config/locales/el.yml +169 -0
  117. data/config/locales/en.yml +126 -12
  118. data/config/locales/eo.yml +1 -0
  119. data/config/locales/es-MX.yml +126 -12
  120. data/config/locales/es-PY.yml +126 -12
  121. data/config/locales/es.yml +126 -12
  122. data/config/locales/et-EE.yml +1 -0
  123. data/config/locales/et.yml +1 -0
  124. data/config/locales/eu.yml +4 -14
  125. data/config/locales/fi-plain.yml +127 -13
  126. data/config/locales/fi.yml +137 -23
  127. data/config/locales/fr-CA.yml +266 -0
  128. data/config/locales/fr.yml +125 -12
  129. data/config/locales/ga-IE.yml +1 -0
  130. data/config/locales/gl.yml +3 -13
  131. data/config/locales/hr-HR.yml +1 -0
  132. data/config/locales/hr.yml +1 -0
  133. data/config/locales/hu.yml +19 -13
  134. data/config/locales/id-ID.yml +3 -12
  135. data/config/locales/is-IS.yml +1 -12
  136. data/config/locales/is.yml +114 -0
  137. data/config/locales/it.yml +97 -13
  138. data/config/locales/ja-JP.yml +172 -0
  139. data/config/locales/ja.yml +262 -0
  140. data/config/locales/ko-KR.yml +1 -0
  141. data/config/locales/ko.yml +1 -0
  142. data/config/locales/lt-LT.yml +1 -0
  143. data/config/locales/lt.yml +1 -0
  144. data/config/locales/lv.yml +164 -0
  145. data/config/locales/mt-MT.yml +1 -0
  146. data/config/locales/mt.yml +1 -0
  147. data/config/locales/nl.yml +113 -13
  148. data/config/locales/no.yml +39 -13
  149. data/config/locales/om-ET.yml +1 -0
  150. data/config/locales/pl.yml +175 -62
  151. data/config/locales/pt-BR.yml +4 -14
  152. data/config/locales/pt.yml +63 -47
  153. data/config/locales/ro-RO.yml +172 -0
  154. data/config/locales/ru.yml +3 -15
  155. data/config/locales/sk-SK.yml +180 -0
  156. data/config/locales/sk.yml +166 -0
  157. data/config/locales/sl.yml +1 -0
  158. data/config/locales/so-SO.yml +1 -0
  159. data/config/locales/sr-CS.yml +27 -0
  160. data/config/locales/sv.yml +126 -12
  161. data/config/locales/ti-ER.yml +1 -0
  162. data/config/locales/tr-TR.yml +3 -13
  163. data/config/locales/uk.yml +3 -15
  164. data/config/locales/vi-VN.yml +1 -0
  165. data/config/locales/vi.yml +1 -0
  166. data/config/locales/zh-CN.yml +260 -0
  167. data/config/locales/zh-TW.yml +1 -0
  168. data/db/migrate/20200617105120_create_decidim_budgets.rb +15 -0
  169. data/db/migrate/20200629072626_rename_budget_to_budget_ammount.rb +7 -0
  170. data/db/migrate/20200629134013_add_budget_reference_to_project.rb +7 -0
  171. data/db/migrate/20200706142609_add_budget_reference_to_order.rb +7 -0
  172. data/db/migrate/20200714103519_move_budgets_to_own_model.rb +109 -0
  173. data/db/migrate/20200717140012_add_scope_to_budgets.rb +7 -0
  174. data/db/migrate/20200728075039_add_selected_at_to_project.rb +7 -0
  175. data/db/migrate/20200804175222_votes_enabled_to_votes_choices.rb +35 -0
  176. data/db/migrate/20200827154129_add_commentable_counter_cache_to_projects.rb +9 -0
  177. data/lib/decidim/budgets.rb +1 -0
  178. data/lib/decidim/budgets/admin_engine.rb +12 -5
  179. data/lib/decidim/budgets/component.rb +94 -38
  180. data/lib/decidim/budgets/engine.rb +8 -6
  181. data/lib/decidim/budgets/seeds/city.jpeg +0 -0
  182. data/lib/decidim/budgets/test/factories.rb +71 -9
  183. data/lib/decidim/budgets/version.rb +1 -1
  184. data/lib/decidim/budgets/workflows.rb +17 -0
  185. data/lib/decidim/budgets/workflows/all.rb +20 -0
  186. data/lib/decidim/budgets/workflows/base.rb +132 -0
  187. data/lib/decidim/budgets/workflows/one.rb +33 -0
  188. metadata +121 -16
@@ -11,9 +11,10 @@ module Decidim
11
11
  end
12
12
 
13
13
  def calculate
14
- budgets = Decidim::Budgets::Project.where(component: @resource)
14
+ budgets = Decidim::Budgets::Budget.where(component: @resource)
15
+ projects = Decidim::Budgets::Project.where(budget: budgets)
15
16
 
16
- budgets_followers = Decidim::Follow.where(followable: budgets).joins(:user)
17
+ budgets_followers = Decidim::Follow.where(followable: projects).joins(:user)
17
18
  .where("decidim_follows.created_at <= ?", end_time)
18
19
  cumulative_users = budgets_followers.pluck(:decidim_user_id)
19
20
 
@@ -11,13 +11,14 @@ module Decidim
11
11
  end
12
12
 
13
13
  def calculate
14
- budgets = Decidim::Budgets::Order.where(component: @resource).joins(:component)
15
- .finished
16
- .where("decidim_budgets_orders.checked_out_at <= ?", end_time)
14
+ budgets = Decidim::Budgets::Budget.where(component: @resource)
15
+ orders = Decidim::Budgets::Order.where(budget: budgets)
16
+ .finished
17
+ .where("decidim_budgets_orders.checked_out_at <= ?", end_time)
17
18
 
18
19
  {
19
- cumulative_users: budgets.pluck(:decidim_user_id),
20
- quantity_users: budgets.where("decidim_budgets_orders.checked_out_at >= ?", start_time).pluck(:decidim_user_id)
20
+ cumulative_users: orders.pluck(:decidim_user_id),
21
+ quantity_users: orders.where("decidim_budgets_orders.checked_out_at >= ?", start_time).pluck(:decidim_user_id)
21
22
  }
22
23
  end
23
24
  end
@@ -12,7 +12,8 @@ module Decidim
12
12
  def serialize
13
13
  {
14
14
  id: order.id,
15
- component: order.component.name,
15
+ budget: order.budget.title,
16
+ component: order.budget.component.name,
16
17
  checked_out_at: order.checked_out_at,
17
18
  projects: all_projects,
18
19
  created_at: order.created_at,
@@ -30,7 +31,7 @@ module Decidim
30
31
  id: project.id,
31
32
  title: project.title,
32
33
  description: project.description,
33
- budget: project.budget,
34
+ budget_amount: project.budget_amount,
34
35
  scope: project.try(:scope).try(:name),
35
36
  reference: project.reference,
36
37
  created_at: project.created_at,
@@ -6,37 +6,33 @@ module Decidim
6
6
  # `current_component` param with a `Decidim::Component` in order to
7
7
  # find the projects.
8
8
  class ProjectSearch < ResourceSearch
9
+ text_search_fields :title, :description
10
+
9
11
  # Public: Initializes the service.
10
12
  # component - A Decidim::Component to get the projects from.
11
13
  def initialize(options = {})
12
14
  super(Project.all, options)
13
15
  end
14
16
 
15
- # Handle the search_text filter
16
- def search_search_text
17
- query
18
- .where(localized_search_text_in(:title), text: "%#{search_text}%")
19
- .or(query.where(localized_search_text_in(:description), text: "%#{search_text}%"))
17
+ # Creates the SearchLight base query.
18
+ def base_query
19
+ raise "Missing budget" unless budget
20
+ raise "Missing component" unless component
21
+
22
+ @scope.where(budget: budget)
20
23
  end
21
24
 
22
25
  # Returns the random projects for the current page.
23
26
  def results
24
- Project.where(id: super.pluck(:id))
27
+ Project.where(id: super.pluck(:id)).includes([:scope, :component, :attachments, :category])
25
28
  end
26
29
 
27
30
  private
28
31
 
29
- # Internal: builds the needed query to search for a text in the organization's
30
- # available locales. Note that it is intended to be used as follows:
31
- #
32
- # Example:
33
- # Resource.where(localized_search_text_for(:title, text: "my_query"))
34
- #
35
- # The Hash with the `:text` key is required or it won't work.
36
- def localized_search_text_in(field)
37
- options[:organization].available_locales.map do |l|
38
- "#{field} ->> '#{l}' ILIKE :text"
39
- end.join(" OR ")
32
+ # Private: Since budget is not used by a search method we need
33
+ # to define the method manually.
34
+ def budget
35
+ options[:budget]
40
36
  end
41
37
  end
42
38
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ BudgetType = GraphQL::ObjectType.define do
6
+ interfaces [
7
+ -> { Decidim::Core::ScopableInterface },
8
+ -> { Decidim::Core::TraceableInterface }
9
+ ]
10
+
11
+ name "Budget"
12
+ description "A budget"
13
+
14
+ field :id, !types.ID, "The internal ID of this budget"
15
+ field :title, !Decidim::Core::TranslatedFieldType, "The title for this budget"
16
+ field :description, !Decidim::Core::TranslatedFieldType, "The description for this budget"
17
+ field :total_budget, !types.Int, "The total budget"
18
+ field :createdAt, Decidim::Core::DateTimeType, "When this budget was created", property: :created_at
19
+ field :updatedAt, Decidim::Core::DateTimeType, "When this budget was updated", property: :updated_at
20
+
21
+ field :projects, !types[Decidim::Budgets::ProjectType], "The projects for this budget"
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ BudgetsType = GraphQL::ObjectType.define do
6
+ interfaces [-> { Decidim::Core::ComponentInterface }]
7
+
8
+ name "Budgets"
9
+ description "A budget component of a participatory space."
10
+
11
+ connection :budgets, BudgetType.connection_type do
12
+ resolve ->(component, _args, _ctx) {
13
+ BudgetsTypeHelper.base_scope(component).includes(:component)
14
+ }
15
+ end
16
+
17
+ field(:budget, BudgetType) do
18
+ argument :id, !types.ID
19
+
20
+ resolve ->(component, args, _ctx) {
21
+ BudgetsTypeHelper.base_scope(component).find_by(id: args[:id])
22
+ }
23
+ end
24
+ end
25
+
26
+ module BudgetsTypeHelper
27
+ def self.base_scope(component)
28
+ Budget.where(component: component)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ ProjectType = GraphQL::ObjectType.define do
6
+ interfaces [
7
+ -> { Decidim::Core::ScopableInterface },
8
+ -> { Decidim::Core::AttachableInterface },
9
+ -> { Decidim::Comments::CommentableInterface },
10
+ -> { Decidim::Core::CategorizableInterface }
11
+ ]
12
+
13
+ name "Project"
14
+ description "A project"
15
+
16
+ field :id, !types.ID, "The internal ID for this project"
17
+ field :title, Decidim::Core::TranslatedFieldType, "The title for this project"
18
+ field :description, Decidim::Core::TranslatedFieldType, "The description for this project"
19
+ field :budget_amount, types.Int, "The budget amount for this project"
20
+ field :selected, types.Boolean, "Whether this proposal is selected or not", property: :selected?
21
+ field :createdAt, Decidim::Core::DateTimeType, "When this project was created", property: :created_at
22
+ field :updatedAt, Decidim::Core::DateTimeType, "When this project was updated", property: :updated_at
23
+ field :reference, types.String, "The reference for this project"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,23 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title"><%= title %></h2>
4
+ </div>
5
+
6
+ <div class="card-section">
7
+ <div class="row column">
8
+ <%= form.translated :text_field, :title, autofocus: true %>
9
+
10
+ <%= form.number_field :weight %>
11
+
12
+ <%= form.translated :editor, :description %>
13
+
14
+ <%= form.number_field :total_budget %>
15
+
16
+ <% if current_component.has_subscopes? %>
17
+ <div class="row column">
18
+ <%= scopes_picker_field form, :decidim_scope_id, root: current_component.scope %>
19
+ </div>
20
+ <% end %>
21
+ </div>
22
+ </div>
23
+ </div>
@@ -0,0 +1,7 @@
1
+ <%= decidim_form_for(@form, html: { class: "form edit_budget" }) do |f| %>
2
+ <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
+
4
+ <div class="button--double form-general-submit">
5
+ <%= f.submit t(".update") %>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,58 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t(".title") %>
5
+
6
+ <%= link_to t("actions.new", scope: "decidim.budgets", name: t("models.budget.name", scope: "decidim.budgets.admin")), new_budget_path, class: "button tiny button--title" if allowed_to? :create, :budget %>
7
+ </h2>
8
+ </div>
9
+
10
+ <div class="card-section">
11
+ <div class="table-scroll">
12
+ <table class="table-list">
13
+ <thead>
14
+ <tr>
15
+ <th><%= t("models.budget.fields.name", scope: "decidim.budgets") %></th>
16
+ <th><%= t("models.budget.fields.total_budget", scope: "decidim.budgets") %></th>
17
+ <th><%= t("models.budget.fields.projects_count", scope: "decidim.budgets") %></th>
18
+ <%= th_resource_scope_label %>
19
+ <th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <% budgets.each do |budget| %>
24
+ <tr data-id="<%= budget.id %>">
25
+ <td>
26
+ <%= link_to translated_attribute(budget.title), resource_locator(budget).path %>
27
+ </td>
28
+ <td>
29
+ <%= number_to_currency budget.total_budget, unit: Decidim.currency_unit, precision: 0 %>
30
+ </td>
31
+ <td>
32
+ <%= link_to budget.projects.count, budget_projects_path(budget) %>
33
+ </td>
34
+ <%= td_resource_scope_for(budget.scope) %>
35
+ <td class="table-list__actions">
36
+ <%= icon_link_to "eye", resource_locator(budget).path, t("actions.preview", scope: "decidim.budgets"), class: "action-icon--preview", target: :blank %>
37
+
38
+ <%= icon_link_to "list", budget_projects_path(budget), t("actions.edit_projects", scope: "decidim.budgets"), class: "action-icon--edit-projects" %>
39
+
40
+ <% if allowed_to? :update, :budget, budget: budget %>
41
+ <%= icon_link_to "pencil", edit_budget_path(budget), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
42
+ <% else %>
43
+ <%= icon "pencil", class: "action-icon action-icon--disabled", role: "img" %>
44
+ <% end %>
45
+
46
+ <% if allowed_to? :delete, :budget, budget: budget %>
47
+ <%= icon_link_to "circle-x", budget_path(budget), t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
48
+ <% else %>
49
+ <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
50
+ <% end %>
51
+ </td>
52
+ </tr>
53
+ <% end %>
54
+ </tbody>
55
+ </table>
56
+ </div>
57
+ </div>
58
+ </div>
@@ -0,0 +1,7 @@
1
+ <%= decidim_form_for(@form, html: { class: "form new_budget" }) do |f| %>
2
+ <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
+
4
+ <div class="button--double form-general-submit">
5
+ <%= f.submit t(".create") %>
6
+ </div>
7
+ <% end %>
@@ -1,6 +1,8 @@
1
1
  <div class="card">
2
2
  <div class="card-divider">
3
- <h2 class="card-title"><%= title %></h2>
3
+ <h2 class="card-title">
4
+ <%= title.html_safe %>
5
+ </h2>
4
6
  </div>
5
7
 
6
8
  <div class="card-section">
@@ -13,12 +15,12 @@
13
15
  </div>
14
16
 
15
17
  <div class="row column">
16
- <%= form.number_field :budget %>
18
+ <%= form.number_field :budget_amount %>
17
19
  </div>
18
20
 
19
- <% if current_participatory_space.has_subscopes? %>
21
+ <% if current_component.has_subscopes? %>
20
22
  <div class="row column">
21
- <%= scopes_picker_field form, :decidim_scope_id %>
23
+ <%= scopes_picker_field form, :decidim_scope_id, root: budget.scope %>
22
24
  </div>
23
25
  <% end %>
24
26
 
@@ -27,12 +29,15 @@
27
29
  </div>
28
30
 
29
31
  <div class="row column">
30
- <% if @form.proposals %>
31
- <%= form.select :proposal_ids,
32
- @form.proposals,
33
- {},
34
- { multiple: true, class: "chosen-select" } %>
35
- <% end %>
32
+ <%= proposals_picker(form, :proposals, proposals_picker_projects_path) %>
36
33
  </div>
34
+
35
+ <%= render partial: "decidim/admin/shared/gallery", locals: { form: form } %>
36
+
37
+ <% if form.object.persisted? %>
38
+ <div class="row column">
39
+ <%= form.check_box :selected %>
40
+ </div>
41
+ <% end %>
37
42
  </div>
38
43
  </div>
@@ -1,5 +1,5 @@
1
- <%= decidim_form_for(@form, html: { class: "form edit_project" }) do |f| %>
2
- <%= render partial: "form", object: f, locals: { title: t(".title") } %>
1
+ <%= decidim_form_for([budget, @form], html: { class: "form edit_project" }) do |f| %>
2
+ <%= render partial: "form", object: f, locals: { title: "#{translated_attribute(budget.title)} &gt; #{t(".title")}" } %>
3
3
 
4
4
  <div class="button--double form-general-submit">
5
5
  <%= f.submit t(".update") %>
@@ -1,9 +1,10 @@
1
1
  <div class="card">
2
2
  <div class="card-divider">
3
3
  <h2 class="card-title">
4
+ <%= link_to translated_attribute(budget.title), budgets_path %> &gt;
4
5
  <%= t(".title") %>
5
- <%= link_to t("actions.new", scope: "decidim.budgets"), new_project_path, class: "button tiny button--title new" if allowed_to? :create, :project %>
6
- <%= link_to t("actions.import", scope: "decidim.budgets", name: t("models.project.name", scope: "decidim.budgets.admin")), new_proposals_import_path, class: "button tiny button--title" if allowed_to? :import_proposals, :project %>
6
+ <%= link_to t("actions.new", scope: "decidim.budgets", name: t("models.project.name", scope: "decidim.budgets.admin")), new_budget_project_path, class: "button tiny button--title new" if allowed_to? :create, :project %>
7
+ <%= link_to t("actions.import", scope: "decidim.budgets", name: t("models.project.name", scope: "decidim.budgets.admin")), new_budget_proposals_import_path(budget), class: "button tiny button--title" if allowed_to? :import_proposals, :project %>
7
8
  </h2>
8
9
  </div>
9
10
 
@@ -13,7 +14,9 @@
13
14
  <thead>
14
15
  <tr>
15
16
  <th><%= t("models.project.fields.title", scope: "decidim.budgets") %></th>
16
- <th class="center"><%= t("index.confirmed_orders_count") %></th>
17
+ <th><%= t("index.confirmed_orders_count") %></th>
18
+ <th><%= t(".selected") %></th>
19
+ <%= th_resource_scope_label %>
17
20
  <th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
18
21
  </tr>
19
22
  </thead>
@@ -23,14 +26,22 @@
23
26
  <td>
24
27
  <%= translated_attribute(project.title) %><br>
25
28
  </td>
26
- <td class='center'>
29
+ <td>
27
30
  <%= project.confirmed_orders_count %>
28
31
  </td>
32
+ <td>
33
+ <% if project.selected? %>
34
+ <%= content_tag :strong, t(".selected"), class: "text-success" %>
35
+ <% else %>
36
+ <%= content_tag :span, "×", class: "text-muted" %>
37
+ <% end %>
38
+ </td>
39
+ <%= td_resource_scope_for(project.scope) %>
29
40
  <td class="table-list__actions">
30
- <%= icon_link_to "eye", resource_locator(project).path, t("actions.preview", scope: "decidim.budgets"), target: :blank, class: "action-icon--preview" %>
41
+ <%= icon_link_to "eye", resource_locator([budget, project]).path, t("actions.preview", scope: "decidim.budgets"), target: :blank, class: "action-icon--preview" %>
31
42
 
32
43
  <% if allowed_to? :update, :project, project: project %>
33
- <%= icon_link_to "pencil", edit_project_path(project), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
44
+ <%= icon_link_to "pencil", resource_locator([budget, project]).edit, t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
34
45
  <% end %>
35
46
 
36
47
  <% if allowed_to? :update, :project, project: project %>
@@ -44,7 +55,9 @@
44
55
  <%= resource_permissions_link(project) %>
45
56
 
46
57
  <% if allowed_to? :destroy, :project, project: project %>
47
- <%= icon_link_to "circle-x", project_path(project), t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
58
+ <%= icon_link_to "circle-x", resource_locator([budget, project]).show, t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
59
+ <% else %>
60
+ <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
48
61
  <% end %>
49
62
  </td>
50
63
  </tr>
@@ -1,5 +1,5 @@
1
- <%= decidim_form_for(@form, html: { class: "form new_project" }) do |f| %>
2
- <%= render partial: "form", object: f, locals: { title: t(".title") } %>
1
+ <%= decidim_form_for([budget, @form], html: { class: "form new_project" }) do |f| %>
2
+ <%= render partial: "form", object: f, locals: { title: "#{translated_attribute(budget.title)} &gt; #{t(".title")}" } %>
3
3
 
4
4
  <div class="button--double form-general-submit">
5
5
  <%= f.submit t(".create") %>
@@ -0,0 +1 @@
1
+ <%= cell "decidim/proposals/proposals_picker", current_component %>
@@ -1,4 +1,4 @@
1
- <%= decidim_form_for(@form, url: proposals_import_path, html: { class: "form import_proposals" }) do |f| %>
1
+ <%= decidim_form_for(@form, url: budget_proposals_import_path(budget), html: { class: "form import_proposals" }) do |f| %>
2
2
  <% if @form.origin_components.any? %>
3
3
  <div class="card">
4
4
  <div class="card-divider">
@@ -0,0 +1,5 @@
1
+ <%= render partial: "decidim/shared/component_announcement" %>
2
+
3
+ <%= cell("decidim/budgets/budgets_header", current_workflow) %>
4
+
5
+ <%= cell("decidim/budgets/budgets_list", current_workflow) %>
@@ -0,0 +1,22 @@
1
+ <% if @component.try(:scopes_enabled) %>
2
+ <%= t(
3
+ ".voted_on_space_with_scope",
4
+ space_name: translated_attribute(@space.title),
5
+ scope_name: translated_attribute(@component.scope.name),
6
+ scope_type: translated_attribute(@component.scope.scope_type.name)
7
+ ) %>
8
+ <% else %>
9
+ <%= t(
10
+ ".voted_on_space",
11
+ budget_name: translated_attribute(@budget.title),
12
+ space_name: translated_attribute(@space.title)
13
+ ) %>
14
+ <% end %>
15
+
16
+ <p><%= t(".selected_projects") %></p>
17
+
18
+ <ul>
19
+ <% @order.projects.each do |project| %>
20
+ <li><%= translated_attribute(project.title) %></li>
21
+ <% end %>
22
+ </ul>