decidim-budgets 0.22.0 → 0.23.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) 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 +23 -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 +22 -13
  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 +108 -16
  102. data/config/locales/da.yml +1 -0
  103. data/config/locales/de.yml +120 -28
  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 +5 -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 +101 -9
  115. data/config/locales/fr.yml +101 -9
  116. data/config/locales/gl.yml +70 -10
  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 +25 -9
  132. data/config/locales/om-ET.yml +1 -0
  133. data/config/locales/pl.yml +114 -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/si-LK.yml +1 -0
  139. data/config/locales/sk.yml +2 -11
  140. data/config/locales/sl.yml +0 -4
  141. data/config/locales/so-SO.yml +1 -0
  142. data/config/locales/sr-CS.yml +0 -2
  143. data/config/locales/sv.yml +101 -9
  144. data/config/locales/sw-KE.yml +1 -0
  145. data/config/locales/ti-ER.yml +1 -0
  146. data/config/locales/tr-TR.yml +153 -34
  147. data/config/locales/uk.yml +2 -9
  148. data/config/locales/vi-VN.yml +1 -0
  149. data/config/locales/vi.yml +1 -0
  150. data/config/locales/zh-CN.yml +260 -0
  151. data/config/locales/zh-TW.yml +1 -0
  152. data/db/migrate/20200617105120_create_decidim_budgets.rb +15 -0
  153. data/db/migrate/20200629072626_rename_budget_to_budget_ammount.rb +7 -0
  154. data/db/migrate/20200629134013_add_budget_reference_to_project.rb +7 -0
  155. data/db/migrate/20200706142609_add_budget_reference_to_order.rb +7 -0
  156. data/db/migrate/20200714103519_move_budgets_to_own_model.rb +109 -0
  157. data/db/migrate/20200717140012_add_scope_to_budgets.rb +7 -0
  158. data/db/migrate/20200728075039_add_selected_at_to_project.rb +7 -0
  159. data/db/migrate/20200804175222_votes_enabled_to_votes_choices.rb +35 -0
  160. data/db/migrate/20200827154129_add_commentable_counter_cache_to_projects.rb +9 -0
  161. data/lib/decidim/budgets.rb +1 -0
  162. data/lib/decidim/budgets/admin_engine.rb +10 -5
  163. data/lib/decidim/budgets/component.rb +83 -38
  164. data/lib/decidim/budgets/engine.rb +8 -6
  165. data/lib/decidim/budgets/test/factories.rb +42 -13
  166. data/lib/decidim/budgets/version.rb +1 -1
  167. data/lib/decidim/budgets/workflows.rb +17 -0
  168. data/lib/decidim/budgets/workflows/all.rb +20 -0
  169. data/lib/decidim/budgets/workflows/base.rb +132 -0
  170. data/lib/decidim/budgets/workflows/one.rb +33 -0
  171. metadata +89 -20
  172. data/app/cells/decidim/budgets/project_list_item/project_data_number.erb +0 -3
  173. data/app/cells/decidim/budgets/project_list_item/project_data_votes.erb +0 -7
@@ -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,45 +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}%"))
20
- end
21
-
22
- def search_category_id
23
- super
24
- end
17
+ # Creates the SearchLight base query.
18
+ def base_query
19
+ raise "Missing budget" unless budget
20
+ raise "Missing component" unless component
25
21
 
26
- def search_scope_id
27
- super
22
+ @scope.where(budget: budget)
28
23
  end
29
24
 
30
25
  # Returns the random projects for the current page.
31
26
  def results
32
- Project.where(id: super.pluck(:id))
27
+ Project.where(id: super.pluck(:id)).includes([:scope, :component, :attachments, :category])
33
28
  end
34
29
 
35
30
  private
36
31
 
37
- # Internal: builds the needed query to search for a text in the organization's
38
- # available locales. Note that it is intended to be used as follows:
39
- #
40
- # Example:
41
- # Resource.where(localized_search_text_for(:title, text: "my_query"))
42
- #
43
- # The Hash with the `:text` key is required or it won't work.
44
- def localized_search_text_in(field)
45
- options[:organization].available_locales.map do |l|
46
- "#{field} ->> '#{l}' ILIKE :text"
47
- 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]
48
36
  end
49
37
  end
50
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
@@ -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">