decidim-budgets 0.22.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -3
  3. data/app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss +5 -0
  4. data/app/cells/decidim/budgets/base_cell.rb +22 -0
  5. data/app/cells/decidim/budgets/budget_cell.rb +21 -0
  6. data/app/cells/decidim/budgets/budget_information_modal/show.erb +28 -0
  7. data/app/cells/decidim/budgets/budget_information_modal_cell.rb +22 -0
  8. data/app/cells/decidim/budgets/budget_list_item/show.erb +22 -0
  9. data/app/cells/decidim/budgets/budget_list_item_cell.rb +40 -0
  10. data/app/cells/decidim/budgets/budget_m/data.erb +12 -0
  11. data/app/cells/decidim/budgets/budget_m/footer.erb +5 -0
  12. data/app/cells/decidim/budgets/budget_m_cell.rb +16 -0
  13. data/app/cells/decidim/budgets/budgets_header/show.erb +7 -0
  14. data/app/cells/decidim/budgets/budgets_header_cell.rb +14 -0
  15. data/app/cells/decidim/budgets/budgets_list/card_list.erb +7 -0
  16. data/app/cells/decidim/budgets/budgets_list/highlighted.erb +11 -0
  17. data/app/cells/decidim/budgets/budgets_list/show.erb +20 -0
  18. data/app/cells/decidim/budgets/budgets_list/voted.erb +43 -0
  19. data/app/cells/decidim/budgets/budgets_list_cell.rb +39 -0
  20. data/app/cells/decidim/budgets/limit_announcement_cell.rb +52 -0
  21. data/app/cells/decidim/budgets/project_list_item/project_data.erb +17 -3
  22. data/app/cells/decidim/budgets/project_list_item/project_data_vote_button.erb +2 -2
  23. data/app/cells/decidim/budgets/project_list_item/project_text.erb +11 -5
  24. data/app/cells/decidim/budgets/project_list_item/show.erb +3 -3
  25. data/app/cells/decidim/budgets/project_list_item_cell.rb +8 -28
  26. data/app/cells/decidim/budgets/project_m/data.erb +1 -1
  27. data/app/cells/decidim/budgets/project_m_cell.rb +4 -0
  28. data/app/cells/decidim/budgets/project_selected_status_cell.rb +28 -0
  29. data/app/cells/decidim/budgets/project_tags/show.erb +5 -0
  30. data/app/cells/decidim/budgets/project_tags_cell.rb +18 -0
  31. data/app/cells/decidim/budgets/project_voted_hint_cell.rb +33 -0
  32. data/app/cells/decidim/budgets/project_votes_count_cell.rb +44 -0
  33. data/app/commands/decidim/budgets/add_line_item.rb +7 -10
  34. data/app/commands/decidim/budgets/admin/create_budget.rb +48 -0
  35. data/app/commands/decidim/budgets/admin/create_project.rb +12 -7
  36. data/app/commands/decidim/budgets/admin/destroy_budget.rb +42 -0
  37. data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +26 -25
  38. data/app/commands/decidim/budgets/admin/update_budget.rb +48 -0
  39. data/app/commands/decidim/budgets/admin/update_project.rb +8 -1
  40. data/app/commands/decidim/budgets/checkout.rb +6 -6
  41. data/app/commands/decidim/budgets/remove_line_item.rb +3 -2
  42. data/app/controllers/concerns/decidim/budgets/needs_current_order.rb +14 -2
  43. data/app/controllers/concerns/decidim/budgets/orderable.rb +3 -7
  44. data/app/controllers/decidim/budgets/admin/application_controller.rb +10 -2
  45. data/app/controllers/decidim/budgets/admin/attachment_collections_controller.rb +1 -1
  46. data/app/controllers/decidim/budgets/admin/attachments_controller.rb +2 -2
  47. data/app/controllers/decidim/budgets/admin/budgets_controller.rb +82 -0
  48. data/app/controllers/decidim/budgets/admin/projects_controller.rb +7 -7
  49. data/app/controllers/decidim/budgets/admin/proposals_imports_controller.rb +10 -2
  50. data/app/controllers/decidim/budgets/application_controller.rb +23 -0
  51. data/app/controllers/decidim/budgets/budgets_controller.rb +24 -0
  52. data/app/controllers/decidim/budgets/line_items_controller.rb +9 -5
  53. data/app/controllers/decidim/budgets/orders_controller.rb +20 -6
  54. data/app/controllers/decidim/budgets/projects_controller.rb +19 -18
  55. data/app/forms/decidim/budgets/admin/budget_form.rb +39 -0
  56. data/app/forms/decidim/budgets/admin/project_form.rb +14 -10
  57. data/app/forms/decidim/budgets/admin/project_import_proposals_form.rb +4 -0
  58. data/app/helpers/decidim/budgets/admin/application_helper.rb +13 -0
  59. data/app/helpers/decidim/budgets/application_helper.rb +10 -0
  60. data/app/helpers/decidim/budgets/projects_helper.rb +0 -4
  61. data/app/mailers/decidim/budgets/order_summary_mailer.rb +5 -3
  62. data/app/models/decidim/budgets/budget.rb +34 -0
  63. data/app/models/decidim/budgets/line_item.rb +4 -4
  64. data/app/models/decidim/budgets/order.rb +22 -19
  65. data/app/models/decidim/budgets/project.rb +34 -5
  66. data/app/permissions/decidim/budgets/admin/permissions.rb +23 -10
  67. data/app/permissions/decidim/budgets/permissions.rb +28 -6
  68. data/app/presenters/decidim/budgets/admin_log/budget_presenter.rb +42 -0
  69. data/app/queries/decidim/budgets/filtered_projects.rb +9 -1
  70. data/app/queries/decidim/budgets/metrics/budget_followers_metric_measure.rb +3 -2
  71. data/app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb +6 -5
  72. data/app/serializers/decidim/budgets/data_portability_budgets_order_serializer.rb +3 -2
  73. data/app/services/decidim/budgets/project_search.rb +12 -24
  74. data/app/types/decidim/budgets/budget_type.rb +24 -0
  75. data/app/types/decidim/budgets/budgets_type.rb +6 -6
  76. data/app/types/decidim/budgets/project_type.rb +2 -1
  77. data/app/views/decidim/budgets/admin/budgets/_form.html.erb +23 -0
  78. data/app/views/decidim/budgets/admin/budgets/edit.html.erb +7 -0
  79. data/app/views/decidim/budgets/admin/budgets/index.html.erb +58 -0
  80. data/app/views/decidim/budgets/admin/budgets/new.html.erb +7 -0
  81. data/app/views/decidim/budgets/admin/projects/_form.html.erb +12 -4
  82. data/app/views/decidim/budgets/admin/projects/edit.html.erb +2 -2
  83. data/app/views/decidim/budgets/admin/projects/index.html.erb +20 -7
  84. data/app/views/decidim/budgets/admin/projects/new.html.erb +2 -2
  85. data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +1 -1
  86. data/app/views/decidim/budgets/budgets/index.html.erb +5 -0
  87. data/app/views/decidim/budgets/order_summary_mailer/order_summary.html.erb +1 -0
  88. data/app/views/decidim/budgets/projects/_budget_confirm.html.erb +3 -3
  89. data/app/views/decidim/budgets/projects/_budget_summary.html.erb +19 -6
  90. data/app/views/decidim/budgets/projects/_filters.html.erb +6 -2
  91. data/app/views/decidim/budgets/projects/_linked_projects.html.erb +1 -1
  92. data/app/views/decidim/budgets/projects/_order_progress.html.erb +10 -6
  93. data/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +3 -3
  94. data/app/views/decidim/budgets/projects/_project_budget_button.html.erb +36 -7
  95. data/app/views/decidim/budgets/projects/index.html.erb +12 -4
  96. data/app/views/decidim/budgets/projects/show.html.erb +17 -10
  97. data/config/locales/am-ET.yml +1 -0
  98. data/config/locales/ar.yml +2 -11
  99. data/config/locales/bg.yml +6 -0
  100. data/config/locales/ca.yml +102 -10
  101. data/config/locales/cs.yml +105 -13
  102. data/config/locales/da.yml +1 -0
  103. data/config/locales/de.yml +90 -9
  104. data/config/locales/el.yml +3 -9
  105. data/config/locales/en.yml +101 -9
  106. data/config/locales/eo.yml +1 -0
  107. data/config/locales/es-MX.yml +101 -9
  108. data/config/locales/es-PY.yml +101 -9
  109. data/config/locales/es.yml +102 -10
  110. data/config/locales/et.yml +1 -0
  111. data/config/locales/eu.yml +3 -8
  112. data/config/locales/fi-plain.yml +102 -10
  113. data/config/locales/fi.yml +103 -11
  114. data/config/locales/fr-CA.yml +100 -9
  115. data/config/locales/fr.yml +100 -9
  116. data/config/locales/gl.yml +2 -7
  117. data/config/locales/hr.yml +1 -0
  118. data/config/locales/hu.yml +2 -7
  119. data/config/locales/id-ID.yml +2 -6
  120. data/config/locales/is-IS.yml +0 -6
  121. data/config/locales/is.yml +114 -0
  122. data/config/locales/it.yml +71 -9
  123. data/config/locales/ja-JP.yml +1 -0
  124. data/config/locales/ja.yml +262 -0
  125. data/config/locales/ko-KR.yml +1 -0
  126. data/config/locales/ko.yml +1 -0
  127. data/config/locales/lt.yml +1 -0
  128. data/config/locales/{lv-LV.yml → lv.yml} +2 -10
  129. data/config/locales/mt.yml +1 -0
  130. data/config/locales/nl.yml +88 -10
  131. data/config/locales/no.yml +22 -9
  132. data/config/locales/om-ET.yml +1 -0
  133. data/config/locales/pl.yml +113 -22
  134. data/config/locales/pt-BR.yml +2 -7
  135. data/config/locales/pt.yml +3 -9
  136. data/config/locales/ro-RO.yml +3 -10
  137. data/config/locales/ru.yml +2 -9
  138. data/config/locales/sk.yml +2 -11
  139. data/config/locales/sl.yml +0 -4
  140. data/config/locales/so-SO.yml +1 -0
  141. data/config/locales/sr-CS.yml +0 -2
  142. data/config/locales/sv.yml +80 -9
  143. data/config/locales/ti-ER.yml +1 -0
  144. data/config/locales/tr-TR.yml +2 -7
  145. data/config/locales/uk.yml +2 -9
  146. data/config/locales/vi-VN.yml +1 -0
  147. data/config/locales/vi.yml +1 -0
  148. data/config/locales/zh-CN.yml +260 -0
  149. data/config/locales/zh-TW.yml +1 -0
  150. data/db/migrate/20200617105120_create_decidim_budgets.rb +15 -0
  151. data/db/migrate/20200629072626_rename_budget_to_budget_ammount.rb +7 -0
  152. data/db/migrate/20200629134013_add_budget_reference_to_project.rb +7 -0
  153. data/db/migrate/20200706142609_add_budget_reference_to_order.rb +7 -0
  154. data/db/migrate/20200714103519_move_budgets_to_own_model.rb +109 -0
  155. data/db/migrate/20200717140012_add_scope_to_budgets.rb +7 -0
  156. data/db/migrate/20200728075039_add_selected_at_to_project.rb +7 -0
  157. data/db/migrate/20200804175222_votes_enabled_to_votes_choices.rb +35 -0
  158. data/db/migrate/20200827154129_add_commentable_counter_cache_to_projects.rb +9 -0
  159. data/lib/decidim/budgets.rb +1 -0
  160. data/lib/decidim/budgets/admin_engine.rb +10 -5
  161. data/lib/decidim/budgets/component.rb +83 -38
  162. data/lib/decidim/budgets/engine.rb +8 -6
  163. data/lib/decidim/budgets/test/factories.rb +42 -13
  164. data/lib/decidim/budgets/version.rb +1 -1
  165. data/lib/decidim/budgets/workflows.rb +17 -0
  166. data/lib/decidim/budgets/workflows/all.rb +20 -0
  167. data/lib/decidim/budgets/workflows/base.rb +132 -0
  168. data/lib/decidim/budgets/workflows/one.rb +33 -0
  169. metadata +84 -17
  170. data/app/cells/decidim/budgets/project_list_item/project_data_number.erb +0 -3
  171. data/app/cells/decidim/budgets/project_list_item/project_data_votes.erb +0 -7
@@ -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
@@ -8,24 +8,24 @@ module Decidim
8
8
  name "Budgets"
9
9
  description "A budget component of a participatory space."
10
10
 
11
- connection :projects, ProjectType.connection_type do
11
+ connection :budgets, BudgetType.connection_type do
12
12
  resolve ->(component, _args, _ctx) {
13
- ProjectTypeHelper.base_scope(component).includes(:component)
13
+ BudgetsTypeHelper.base_scope(component).includes(:component)
14
14
  }
15
15
  end
16
16
 
17
- field(:project, ProjectType) do
17
+ field(:budget, BudgetType) do
18
18
  argument :id, !types.ID
19
19
 
20
20
  resolve ->(component, args, _ctx) {
21
- ProjectTypeHelper.base_scope(component).find_by(id: args[:id])
21
+ BudgetsTypeHelper.base_scope(component).find_by(id: args[:id])
22
22
  }
23
23
  end
24
24
  end
25
25
 
26
- module ProjectTypeHelper
26
+ module BudgetsTypeHelper
27
27
  def self.base_scope(component)
28
- Project.where(component: component)
28
+ Budget.where(component: component)
29
29
  end
30
30
  end
31
31
  end
@@ -16,7 +16,8 @@ module Decidim
16
16
  field :id, !types.ID, "The internal ID for this project"
17
17
  field :title, Decidim::Core::TranslatedFieldType, "The title for this project"
18
18
  field :description, Decidim::Core::TranslatedFieldType, "The description for this project"
19
- field :budget, types.Int, "The budget 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?
20
21
  field :createdAt, Decidim::Core::DateTimeType, "When this project was created", property: :created_at
21
22
  field :updatedAt, Decidim::Core::DateTimeType, "When this project was updated", property: :updated_at
22
23
  field :reference, types.String, "The reference for this project"
@@ -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
 
@@ -31,5 +33,11 @@
31
33
  </div>
32
34
 
33
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 %>
34
42
  </div>
35
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") %>
@@ -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) %>
@@ -8,6 +8,7 @@
8
8
  <% else %>
9
9
  <%= t(
10
10
  ".voted_on_space",
11
+ budget_name: translated_attribute(@budget.title),
11
12
  space_name: translated_attribute(@space.title)
12
13
  ) %>
13
14
  <% end %>
@@ -11,9 +11,9 @@
11
11
  <ul class="card__content">
12
12
  <% current_order.projects.each do |project| %>
13
13
  <li class="budget-summary__selected-item">
14
- <%= link_to translated_attribute(project.title), project %>
14
+ <%= link_to translated_attribute(project.title), resource_locator([budget, project]).path %>
15
15
  <strong class="budget-summary__selected-number">
16
- <%= budget_to_currency project.budget %>
16
+ <%= budget_to_currency project.budget_amount %>
17
17
  </strong>
18
18
  </li>
19
19
  <% end %>
@@ -22,7 +22,7 @@
22
22
  <p class="text-center"><%= t(".are_you_sure") %></p>
23
23
  <div class="row">
24
24
  <div class="columns medium-8 medium-offset-2">
25
- <%= button_to t(".confirm"), "#{checkout_order_path}#content", class: "button expanded", data: { disable: true } %>
25
+ <%= button_to t(".confirm"), checkout_budget_order_path(budget), class: "button expanded", data: { disable: true } %>
26
26
  </div>
27
27
  </div>
28
28
  <div class="text-center">
@@ -1,13 +1,24 @@
1
- <div class="card budget-summary" data-progress-reference data-safe-url="<%= projects_base_url %>">
1
+ <div class="card budget-summary" data-progress-reference data-safe-url="<%= budget_url(budget) %>">
2
2
  <div class="card__content">
3
3
  <% if include_heading %>
4
4
  <% if current_order_checked_out? %>
5
- <h3 class="heading3"><%= t(".checked_out.title") %></h3>
5
+ <h3 class="heading3">
6
+ <%= t(".checked_out.title") %>
7
+ <% unless current_workflow.single? %>
8
+ <small><%= translated_attribute(budget.title) %></small>
9
+ <% end %>
10
+ </h3>
6
11
  <p>
7
- <%= raw t(".checked_out.description", cancel_link: link_to(t(".cancel_order"), order_path, method: :delete, class: "cancel-order", data: { confirm: t(".are_you_sure") })) %>
12
+ <%= raw t(".checked_out.description", cancel_link: link_to(t(".cancel_order"), budget_order_path(return_to: "budget"), method: :delete, class: "cancel-order", data: { confirm: t(".are_you_sure") })) %>
8
13
  </p>
9
14
  <% else %>
10
- <h3 class="heading3"><%= t(".title") %></h3>
15
+ <h3 class="heading3">
16
+ <% if current_workflow.single? %>
17
+ <%= t(".title") %>
18
+ <% else %>
19
+ <%= translated_attribute(budget.title) %>
20
+ <% end %>
21
+ </h3>
11
22
  <p>
12
23
  <% if current_order.minimum_projects_rule? %>
13
24
  <%= t(".description_minimum_projects_rule", minimum_number: current_order.minimum_projects) %>
@@ -18,10 +29,10 @@
18
29
  <% end %>
19
30
  <% end %>
20
31
 
21
- <div class="budget-summary__total" data-total-budget="<%= component_settings.total_budget %>">
32
+ <div class="budget-summary__total" data-total-budget="<%= budget.total_budget %>">
22
33
  <span class="mini-title"><%= t("total_budget") %>
23
34
  <strong class="mini-title__strong mini-title__strong--highlight">
24
- <%= budget_to_currency(component_settings.total_budget) %>
35
+ <%= budget_to_currency(budget.total_budget) %>
25
36
  </strong>
26
37
  </span>
27
38
  </div>
@@ -34,6 +45,8 @@
34
45
  <%= render partial: "order_total_budget" %>
35
46
  </span>
36
47
  </div>
48
+
49
+ <%= cell("decidim/budgets/budget_information_modal", budget) %>
37
50
  </div>
38
51
 
39
52
  <%= render partial: "order_selected_projects" %>
@@ -14,8 +14,12 @@
14
14
  </div>
15
15
  </div>
16
16
 
17
- <% if current_participatory_space.has_subscopes? %>
18
- <%= form.check_boxes_tree :scope_id, filter_scopes_values, legend_title: t(".scope"), "aria-controls": "projects" %>
17
+ <% if voting_finished? %>
18
+ <%= form.check_boxes_tree :status, filter_status_values, legend_title: t(".status"), "aria-controls": "projects" %>
19
+ <% end %>
20
+
21
+ <% if current_component.has_subscopes? %>
22
+ <%= form.check_boxes_tree :scope_id, resource_filter_scope_values(budget.scope), legend_title: t(".scope"), "aria-controls": "projects" %>
19
23
  <% end %>
20
24
 
21
25
  <% if current_participatory_space.categories.any? %>
@@ -2,7 +2,7 @@
2
2
  <% resources.each do |project| %>
3
3
  <div class="card--list__item">
4
4
  <%= icon "actions", class: "card--list__icon", role: "img", "aria-hidden": true, remove_icon_class: true %>
5
- <%= link_to resource_locator(project).path, class: "card--list__text card__link card__link--block" do %>
5
+ <%= link_to resource_locator([project.budget, project]).path, class: "card--list__text card__link card__link--block" do %>
6
6
  <h5 class="card--list__heading">
7
7
  <%= translated_attribute(project.title) %>
8
8
  </h5>
@@ -1,27 +1,31 @@
1
1
  <div id="order-progress">
2
2
  <div class="budget-summary__progressbox" data-current-budget="<%= current_order ? current_order.total_budget : 0 %>">
3
3
  <div class="progress budget-progress" role="progressbar" aria-valuenow="<%= current_order_budget_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemin="0" aria-valuemax="100">
4
- <div class="progress-meter progress-meter--minimum" style="width: <%= component_settings.vote_threshold_percent %>%"></div>
4
+ <div class="progress-meter progress-meter--minimum" style="width: <%= current_order_budget_percent_minimum %>%"></div>
5
5
  <!--Change width and text dynamically.-->
6
6
  <div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
7
7
  <span class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</span>
8
8
  </div>
9
9
  </div>
10
- <% unless current_order_checked_out? %>
11
- <button class="button small button--sc" data-toggle="budget-confirm" <%= budget_confirm_disabled_attr %>><%= t(".vote") %></button>
10
+ <% if !current_order_checked_out? && voting_open? %>
11
+ <button class="button small button--sc" data-toggle="budget-confirm" <%= budget_confirm_disabled_attr %>>
12
+ <%= t(".vote") %>
13
+ </button>
12
14
  <% end %>
13
15
  </div>
14
16
 
15
17
  <div class="progressbox-fixed-wrapper" data-progressbox-fixed>
16
18
  <div class="budget-summary__progressbox budget-summary__progressbox--fixed">
17
19
  <div class="progress budget-progress budget-progress--fixed" role="progressbar" aria-valuenow="<%= current_order_budget_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemin="0" aria-valuemax="100">
18
- <div class="progress-meter progress-meter--minimum" style="width: <%= component_settings.vote_threshold_percent %>%"></div>
20
+ <div class="progress-meter progress-meter--minimum" style="width: <%= current_order_budget_percent_minimum %>%"></div>
19
21
  <div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
20
22
  <span class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</span>
21
23
  </div>
22
24
  </div>
23
- <% unless current_order_checked_out? %>
24
- <button class="button small button--sc" data-toggle="budget-confirm" <%= budget_confirm_disabled_attr %>><%= t(".vote") %></button>
25
+ <% if !current_order_checked_out? && voting_open? %>
26
+ <button class="button small button--sc" data-toggle="budget-confirm" <%= budget_confirm_disabled_attr %>>
27
+ <%= t(".vote") %>
28
+ </button>
25
29
  <% end %>
26
30
  </div>
27
31
  </div>
@@ -9,12 +9,12 @@
9
9
  <ul class="budget-summary__selected-list">
10
10
  <% current_order.projects.each do |project| %>
11
11
  <li class="budget-summary__selected-item">
12
- <%= link_to translated_attribute(project.title), project %>
12
+ <%= link_to translated_attribute(project.title), resource_locator([budget, project]).path %>
13
13
  <strong class="budget-summary__selected-number">
14
- <%= budget_to_currency project.budget %>
14
+ <%= budget_to_currency project.budget_amount %>
15
15
  </strong>
16
16
  <% unless current_order_checked_out? %>
17
- <%= button_to order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true }, form: { style: "display: inline" } do %>
17
+ <%= button_to budget_order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true }, form: { style: "display: inline" } do %>
18
18
  <%= icon("trash", aria_label: t(".remove"), role: "img") %>
19
19
  <% end %>
20
20
  <% end %>