decidim-budgets 0.28.0 → 0.28.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/budgets/base_cell.rb +1 -1
  3. data/app/cells/decidim/budgets/budget_list_item/show.erb +1 -1
  4. data/app/cells/decidim/budgets/budgets_list/main_list.erb +1 -1
  5. data/app/cells/decidim/budgets/project_tags/show.erb +1 -2
  6. data/app/controllers/decidim/budgets/admin/projects_controller.rb +3 -2
  7. data/app/controllers/decidim/budgets/line_items_controller.rb +15 -9
  8. data/app/helpers/decidim/budgets/projects_helper.rb +4 -4
  9. data/app/packs/src/decidim/budgets/exit_handler.js +1 -1
  10. data/app/views/decidim/budgets/admin/budgets/edit.html.erb +2 -2
  11. data/app/views/decidim/budgets/admin/budgets/index.html.erb +8 -4
  12. data/app/views/decidim/budgets/admin/budgets/new.html.erb +2 -2
  13. data/app/views/decidim/budgets/admin/projects/_project-tr.html.erb +5 -3
  14. data/app/views/decidim/budgets/admin/projects/edit.html.erb +3 -3
  15. data/app/views/decidim/budgets/admin/projects/index.html.erb +6 -4
  16. data/app/views/decidim/budgets/admin/projects/new.html.erb +3 -3
  17. data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +2 -2
  18. data/app/views/decidim/budgets/projects/_addition_selector.html.erb +4 -3
  19. data/app/views/decidim/budgets/projects/_exit_modal.html.erb +1 -1
  20. data/app/views/decidim/budgets/projects/show.html.erb +1 -1
  21. data/config/locales/ar.yml +7 -0
  22. data/config/locales/bg.yml +380 -0
  23. data/config/locales/ca.yml +9 -1
  24. data/config/locales/cs.yml +8 -0
  25. data/config/locales/de.yml +10 -2
  26. data/config/locales/en.yml +8 -0
  27. data/config/locales/es-MX.yml +9 -1
  28. data/config/locales/es-PY.yml +9 -1
  29. data/config/locales/es.yml +19 -11
  30. data/config/locales/eu.yml +8 -0
  31. data/config/locales/fi-plain.yml +8 -0
  32. data/config/locales/fi.yml +8 -0
  33. data/config/locales/fr-CA.yml +8 -0
  34. data/config/locales/fr.yml +8 -0
  35. data/config/locales/he-IL.yml +1 -0
  36. data/config/locales/hu.yml +12 -0
  37. data/config/locales/it.yml +5 -0
  38. data/config/locales/ja.yml +8 -0
  39. data/config/locales/ko.yml +57 -0
  40. data/config/locales/pl.yml +81 -0
  41. data/config/locales/pt-BR.yml +62 -0
  42. data/config/locales/ru.yml +3 -0
  43. data/config/locales/sk.yml +3 -0
  44. data/config/locales/sq-AL.yml +50 -0
  45. data/config/locales/tr-TR.yml +5 -0
  46. data/config/locales/uk.yml +2 -0
  47. data/decidim-budgets.gemspec +41 -0
  48. data/lib/decidim/budgets/test/factories.rb +29 -14
  49. data/lib/decidim/budgets/version.rb +1 -1
  50. metadata +17 -16
  51. data/config/environment.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89ac6c19faae87df68dfff2ed5c37e0a56e1416fed7b6861dd6aa0f243eecdfc
4
- data.tar.gz: 58596987df45b59f635011d3b248f2dc6208bdcaf9aec8704fc88a82de66174d
3
+ metadata.gz: 25adb3de8e76859639aa0b00a073ccbf865b1202ffd54d4823d18418b1fd2190
4
+ data.tar.gz: 8545c893c9a17cb916ff905b19fbfd3a738b210ced76d3370e0618e3b3ce671d
5
5
  SHA512:
6
- metadata.gz: fafc9329e7b11770f2c72eb06c682681887c8bbecb7b1db4d50268be3a8364f65f9810198e1fbcb5c670e03fbc1651cc2570ca4f0febb161f5a31730d1865f5d
7
- data.tar.gz: a72aaea943910985ec26837978526b25a6c2486cfa62e17ac4a60397c7ee403c7b483ddb79b9baebfa51676a24b90e8ef8f118042cbbaa713443ef0f943b9d3a
6
+ metadata.gz: 5e8dabd13b848ca84e652bd4556f24aaad71b009406117b476640dbc60d897be125362847a2fd7c5fad2a5e574478e79c004eac1f391afbbbf056f11b0a92f2a
7
+ data.tar.gz: 9b47e5be95478876f53b9bc091855a9c4c2c841b0452b1788d802eb9eb7fcf1ebe29d52d855f807c510bb6b09ee45dd052d0130dcf90fe239988355596516168
@@ -13,7 +13,7 @@ module Decidim
13
13
  delegate :settings, to: :current_component
14
14
 
15
15
  def budgets_link_list(budgets)
16
- budgets.map { |budget| link_to(translated_attribute(budget.title), resource_locator(budget).path) }
16
+ budgets.map { |budget| link_to(decidim_escape_translated(budget.title), resource_locator(budget).path) }
17
17
  .to_sentence
18
18
  .html_safe
19
19
  end
@@ -2,7 +2,7 @@
2
2
  <div class="card__highlight-text md:w-[70%] p-0">
3
3
  <%= link_to resource_path, class: "p-4" do %>
4
4
  <h3 class="h3 text-secondary inline-block align-middle">
5
- <%= translated_attribute(title) %>
5
+ <%= decidim_escape_translated(title) %>
6
6
  </h3>
7
7
  <% if voted? %>
8
8
  <%= icon "check-double-line", class: "inline-block align-middle fill-success ml-2 h-[1.5em] w-[1.5em]" %>
@@ -1,5 +1,5 @@
1
1
  <h2 class="h5 md:h3 decorator"><%= t(:count, scope: i18n_scope, count: budgets.length) %></h2>
2
2
 
3
- <%= render partial: "decidim/shared/orders", formats: [:html], locals: { orders: AVAILABLE_ORDERS, i18n_scope: "decidim.budgets.projects.orders" } %>
3
+ <%= render partial: "decidim/shared/orders", formats: [:html], locals: { orders: AVAILABLE_ORDERS, i18n_scope: "decidim.budgets.budgets_list.orders" } %>
4
4
 
5
5
  <%= render :card_list %>
@@ -1,6 +1,5 @@
1
1
  <%= content_tag :ul, class: tags_classes do %>
2
- <%= icon "price-tag-3-line", class: "inline-block" %>
2
+ <%= content_tag :li, icon("price-tag-3-line", class: "inline-block") %>
3
3
  <%= content_tag :li, link_to_category if category? %>
4
-
5
4
  <%= content_tag :li, link_to_scope if scope? %>
6
5
  <% end %>
@@ -19,7 +19,8 @@ module Decidim
19
19
  def new
20
20
  enforce_permission_to :create, :project
21
21
  @form = form(ProjectForm).from_params(
22
- attachment: form(AttachmentForm).instance
22
+ { attachment: form(AttachmentForm).instance },
23
+ budget:
23
24
  )
24
25
  end
25
26
 
@@ -43,7 +44,7 @@ module Decidim
43
44
 
44
45
  def edit
45
46
  enforce_permission_to(:update, :project, project:)
46
- @form = form(ProjectForm).from_model(project)
47
+ @form = form(ProjectForm).from_model(project, budget:)
47
48
  @form.attachment = form(AttachmentForm).instance
48
49
  end
49
50
 
@@ -12,15 +12,21 @@ module Decidim
12
12
  enforce_permission_to :vote, :project, project:, budget:, workflow: current_workflow
13
13
 
14
14
  respond_to do |format|
15
- AddLineItem.call(persisted_current_order, project, current_user) do
16
- on(:ok) do |order|
17
- self.current_order = order
18
- format.html { redirect_back(fallback_location: budget_path(budget)) }
19
- format.js { render "update_budget" }
20
- end
21
-
22
- on(:invalid) do
23
- format.js { render "update_budget", status: :unprocessable_entity }
15
+ # Note that the user-specific lock here is important in order to
16
+ # prevent multiple simultaneous processes on different machines from
17
+ # creating multiple orders for the same user in case the button is
18
+ # pressed multiple times.
19
+ current_user.with_lock do
20
+ AddLineItem.call(persisted_current_order, project, current_user) do
21
+ on(:ok) do |order|
22
+ self.current_order = order
23
+ format.html { redirect_back(fallback_location: budget_path(budget)) }
24
+ format.js { render "update_budget" }
25
+ end
26
+
27
+ on(:invalid) do
28
+ format.js { render "update_budget", status: :unprocessable_entity }
29
+ end
24
30
  end
25
31
  end
26
32
  end
@@ -126,12 +126,12 @@ module Decidim
126
126
  project.latitude.present? && project.longitude.present?
127
127
  end
128
128
 
129
- def filter_addition_type_values(added_count:)
129
+ def filter_addition_type_values
130
130
  return [] if voting_finished?
131
131
 
132
132
  [
133
- ["all", { text: t("all", scope: "decidim.budgets.projects.project_filter"), count: nil }],
134
- ["added", { text: t("added", scope: "decidim.budgets.projects.project_filter"), count: added_count }]
133
+ ["all", t("all", scope: "decidim.budgets.projects.project_filter")],
134
+ ["added", t("added", scope: "decidim.budgets.projects.project_filter")]
135
135
  ]
136
136
  end
137
137
 
@@ -162,7 +162,7 @@ module Decidim
162
162
  references = Budget.joins(:component)
163
163
  .where(component: { participatory_space: current_participatory_space }).order(weight: :asc)
164
164
  references.map do |budget|
165
- ["#{"&nbsp;" * 4} #{translated_attribute(budget.title)}".html_safe, budget.id]
165
+ ["#{"&nbsp;" * 4} #{decidim_escape_translated(budget.title)}".html_safe, budget.id]
166
166
  end
167
167
  end
168
168
  end
@@ -68,7 +68,7 @@ $(() => {
68
68
  }
69
69
 
70
70
  $exitLink.attr("href", url);
71
- $exitLink.html(exitLinkText);
71
+ $exitLink.text(exitLinkText);
72
72
  window.Decidim.currentDialogs["exit-notification"].open();
73
73
  };
74
74
 
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t(".title") %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
  <div class="item__edit item__edit-1col">
8
8
  <div class="item__edit-form">
@@ -1,7 +1,7 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="card">
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <%= t(".title") %>
6
6
  <% if allowed_to? :export, :budget %>
7
7
  <%= export_dropdown %>
@@ -13,7 +13,7 @@
13
13
  <%= link_to t("actions.new_budget", scope: "decidim.budgets"), new_budget_path, class: "button button__sm button__secondary" if allowed_to? :create, :budget %>
14
14
  </div>
15
15
  <%= render partial: "decidim/admin/components/resource_action" %>
16
- </h2>
16
+ </h1>
17
17
  </div>
18
18
  <div class="table-scroll">
19
19
  <table class="table-list">
@@ -22,7 +22,9 @@
22
22
  <th><%= t("models.budget.fields.name", scope: "decidim.budgets") %></th>
23
23
  <th><%= t("models.budget.fields.total_budget", scope: "decidim.budgets") %></th>
24
24
  <th><%= t("models.budget.fields.projects_count", scope: "decidim.budgets") %></th>
25
- <%= th_resource_scope_label %>
25
+ <% if current_component.has_subscopes? %>
26
+ <%= th_resource_scope_label %>
27
+ <% end %>
26
28
  <th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
27
29
  </tr>
28
30
  </thead>
@@ -42,7 +44,9 @@
42
44
  <td>
43
45
  <%= link_to budget.projects.count, budget_projects_path(budget) %>
44
46
  </td>
45
- <%= td_resource_scope_for(budget.scope) %>
47
+ <% if current_component.has_subscopes? %>
48
+ <%= td_resource_scope_for(budget.scope) %>
49
+ <% end %>
46
50
  <td class="table-list__actions">
47
51
  <% if allowed_to? :update, :budget, budget: budget %>
48
52
  <%= icon_link_to "pencil-line", edit_budget_path(budget), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
3
+ <h1 class="item_show__header-title">
4
4
  <%= t(".title") %>
5
- </h2>
5
+ </h1>
6
6
  </div>
7
7
  <div class="item__edit item__edit-1col">
8
8
  <div class="item__edit-form">
@@ -17,15 +17,17 @@
17
17
  <%= translated_attribute project.category.name %>
18
18
  <% end %>
19
19
  </td>
20
- <%= td_resource_scope_for(project.scope) %>
20
+ <% if current_component.has_subscopes? %>
21
+ <%= td_resource_scope_for(project.scope) %>
22
+ <% end %>
21
23
  <td>
22
24
  <%= project.confirmed_orders_count %>
23
25
  </td>
24
26
  <td>
25
27
  <% if project.selected? %>
26
- <%= content_tag :strong, t("projects.index.selected", scope: "decidim.budgets.admin"), class: "text-success" %>
28
+ <%= content_tag :strong, t("yes", scope: "decidim.budgets.admin.projects.index.selected_options"), class: "label success" %>
27
29
  <% else %>
28
- <%= content_tag :span, "close-line", class: "text-muted" %>
30
+ <%= content_tag :strong, t("no", scope: "decidim.budgets.admin.projects.index.selected_options"), class: "label" %>
29
31
  <% end %>
30
32
  </td>
31
33
  <td class="table-list__actions">
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title("#{translated_attribute(budget.title)} - #{t(".title")}") %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
4
- <%= "#{translated_attribute(budget.title)} #{t(".title")}" %>
5
- </h2>
3
+ <h1 class="item_show__header-title">
4
+ <%= "#{decidim_escape_translated(budget.title)} #{t(".title")}" %>
5
+ </h1>
6
6
  </div>
7
7
  <div class="item__edit item__edit-1col">
8
8
  <div class="item__edit-form">
@@ -1,14 +1,14 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
  <div class="card">
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <div>
6
- <%= link_to translated_attribute(budget.title), budgets_path %> &gt;
6
+ <%= link_to decidim_escape_translated(budget.title), budgets_path %> &gt;
7
7
  <%= t(".title") %>
8
8
  <span id="js-selected-resources-count" class="component-counter component-counter--inline" title="<%= t("decidim.budgets.admin.projects.index.selected") %>"></span>
9
9
  </div>
10
10
  <%= render partial: "bulk-actions" %>
11
- </h2>
11
+ </h1>
12
12
  </div>
13
13
  <%= admin_filter_selector(:projects) %>
14
14
  <div class="table-scroll">
@@ -19,7 +19,9 @@
19
19
  <th><%= sort_link(query, :id, t("models.project.fields.id", scope: "decidim.budgets"), default_order: :desc) %></th>
20
20
  <th class="!text-left"><%= sort_link(query, :title, t("models.project.fields.title", scope: "decidim.budgets")) %></th>
21
21
  <th><%= sort_link(query, :category_name, t("models.project.fields.category", scope: "decidim.budgets") ) %></th>
22
- <%= th_scope_sort_link %>
22
+ <% if current_component.has_subscopes? %>
23
+ <%= th_scope_sort_link %>
24
+ <% end %>
23
25
  <th><%= sort_link(query, :confirmed_orders_count, t("index.confirmed_orders_count")) %></th>
24
26
  <th><%= sort_link(query, :selected, t(".selected")) %></th>
25
27
  <th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
@@ -1,8 +1,8 @@
1
1
  <% add_decidim_page_title("#{translated_attribute(budget.title)} - #{t(".title")}") %>
2
2
  <div class="item_show__header">
3
- <h2 class="item_show__header-title">
4
- <%= "#{translated_attribute(budget.title)} &gt; #{t(".title")}".html_safe %>
5
- </h2>
3
+ <h1 class="item_show__header-title">
4
+ <%= "#{decidim_escape_translated(budget.title)} &gt; #{t(".title")}".html_safe %>
5
+ </h1>
6
6
  </div>
7
7
  <div class="item__edit item__edit-1col">
8
8
  <div class="item__edit-form">
@@ -1,9 +1,9 @@
1
1
  <% add_decidim_page_title(t(".title")) %>
2
2
 
3
3
  <div class="item_show__header">
4
- <h2 class="item_show__header-title">
4
+ <h1 class="item_show__header-title">
5
5
  <%= t(".title") %>
6
- </h2>
6
+ </h1>
7
7
  </div>
8
8
 
9
9
  <div class="item__edit item__edit-1col">
@@ -1,15 +1,16 @@
1
1
  <%= filter_form_for filter, url_for, data: { filters: "", component: "accordion" } do |form| %>
2
2
  <%= form.collection_radio_buttons(
3
3
  :addition_type,
4
- filter_addition_type_values(added_count: search.result.with_order(current_order).size),
4
+ filter_addition_type_values,
5
5
  :first,
6
6
  :last
7
7
  ) do |builder|
8
+ added_count = search.result.with_order(current_order).size unless builder.value == "all"
8
9
  builder.label(class: "button button__xs button__pill #{filter.addition_type == builder.value ? 'button__pill--active' : ''}") do %>
9
10
  <span>
10
- <%= builder.text[:text] %>
11
+ <%= builder.text %>
11
12
  </span>
12
- <%= render partial: "projects_count", locals: { count: builder.text[:count] } %>
13
+ <%= render partial: "projects_count", locals: { count: added_count } %>
13
14
  <%= builder.radio_button(class: "!hidden") %>
14
15
  <% end %>
15
16
  <% end %>
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  <div data-dialog-actions>
13
13
  <button data-dialog-close="exit-notification" class="button button__sm md:button__lg button__secondary">
14
- <p><%= t("cancel", scope: "decidim.budgets.projects.exit_modal") %></p>
14
+ <%= t("cancel", scope: "decidim.budgets.projects.exit_modal") %>
15
15
  </button>
16
16
  <%= link_to t("exit", scope: "decidim.budgets.projects.exit_modal"), budget_projects_path, id: "exit-notification-link", class: "button button__sm md:button__lg button__secondary" %>
17
17
  </div>
@@ -38,7 +38,7 @@ edit_link(
38
38
  <% end %>
39
39
  <%= cell("decidim/budgets/project_selected_status", project, as_label: true) %>
40
40
  <h1 class="h1 decorator budget__definition-project__title editor-content">
41
- <%= decidim_sanitize_editor translated_attribute project.title %>
41
+ <%= decidim_sanitize translated_attribute project.title %>
42
42
  </h1>
43
43
  </section>
44
44
  <section class="layout-main__section">
@@ -60,7 +60,12 @@ ar:
60
60
  change_category: تغيير الفئة
61
61
  finished_orders: الانتهاء من الأصوات
62
62
  pending_orders: في انتظار الأصوات
63
+ selected_options:
64
+ 'no': 'لا'
65
+ 'yes': 'نعم'
63
66
  title: مشاريع
67
+ update: تحديث
68
+ update_budget_button: تحديث ميزانية المشروع
64
69
  new:
65
70
  create: إنشاء
66
71
  title: مشروع جديد
@@ -78,6 +83,8 @@ ar:
78
83
  budget_information_modal:
79
84
  continue: مواصلة
80
85
  more_information: المزيد من المعلومات
86
+ budgets_list:
87
+ budgets: الميزانيات
81
88
  models:
82
89
  budget:
83
90
  fields: