decidim-budgets 0.24.3 → 0.25.0.rc1

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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/budgets/budget_list_item/show.erb +2 -2
  3. data/app/cells/decidim/budgets/project_voted_hint_cell.rb +1 -1
  4. data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +7 -1
  5. data/app/controllers/decidim/budgets/admin/projects_controller.rb +1 -1
  6. data/app/models/decidim/budgets/project.rb +7 -17
  7. data/app/packs/entrypoints/decidim_budgets.js +5 -0
  8. data/app/{assets/images/decidim/budgets/icon.svg → packs/images/decidim/budgets/decidim_budgets.svg} +0 -0
  9. data/app/{assets/javascripts/decidim/budgets/progressFixed.js.es6 → packs/src/decidim/budgets/progressFixed.js} +0 -0
  10. data/app/{assets/javascripts/decidim/budgets/projects.js.es6 → packs/src/decidim/budgets/projects.js} +0 -3
  11. data/app/packs/stylesheets/decidim/budgets/_budgets.scss +3 -0
  12. data/app/{assets → packs}/stylesheets/decidim/budgets/budget/_budget-list.scss +3 -3
  13. data/app/{assets → packs}/stylesheets/decidim/budgets/budget/_budget-meter.scss +0 -0
  14. data/app/{assets → packs}/stylesheets/decidim/budgets/budget/_progress.scss +0 -0
  15. data/app/serializers/decidim/budgets/data_portability_budgets_order_serializer.rb +1 -0
  16. data/app/services/decidim/budgets/project_search.rb +6 -0
  17. data/app/views/decidim/budgets/admin/budgets/index.html.erb +2 -2
  18. data/app/views/decidim/budgets/admin/projects/_form.html.erb +5 -3
  19. data/app/views/decidim/budgets/admin/projects/index.html.erb +1 -1
  20. data/app/views/decidim/budgets/projects/_filters.html.erb +2 -2
  21. data/app/views/decidim/budgets/projects/index.html.erb +1 -2
  22. data/app/views/decidim/budgets/projects/show.html.erb +3 -2
  23. data/config/assets.rb +9 -0
  24. data/config/locales/ar.yml +0 -3
  25. data/config/locales/ca.yml +8 -2
  26. data/config/locales/cs.yml +8 -2
  27. data/config/locales/de.yml +8 -2
  28. data/config/locales/el.yml +0 -3
  29. data/config/locales/en.yml +9 -2
  30. data/config/locales/es-MX.yml +8 -2
  31. data/config/locales/es-PY.yml +8 -2
  32. data/config/locales/es.yml +8 -2
  33. data/config/locales/eu.yml +0 -3
  34. data/config/locales/fi-plain.yml +8 -2
  35. data/config/locales/fi.yml +8 -2
  36. data/config/locales/fr-CA.yml +1 -2
  37. data/config/locales/fr-LU.yml +294 -0
  38. data/config/locales/fr.yml +2 -3
  39. data/config/locales/gl.yml +8 -2
  40. data/config/locales/hu.yml +0 -3
  41. data/config/locales/id-ID.yml +0 -3
  42. data/config/locales/it.yml +73 -5
  43. data/config/locales/ja.yml +41 -2
  44. data/config/locales/lb-LU.yml +1 -0
  45. data/config/locales/lv.yml +0 -3
  46. data/config/locales/nl.yml +8 -2
  47. data/config/locales/no.yml +0 -4
  48. data/config/locales/pl.yml +3 -2
  49. data/config/locales/pt-BR.yml +162 -1
  50. data/config/locales/pt.yml +0 -3
  51. data/config/locales/ro-RO.yml +11 -3
  52. data/config/locales/ru.yml +0 -3
  53. data/config/locales/sk.yml +0 -3
  54. data/config/locales/sv.yml +7 -1
  55. data/config/locales/tr-TR.yml +0 -4
  56. data/config/locales/uk.yml +0 -3
  57. data/config/locales/zh-CN.yml +0 -4
  58. data/lib/decidim/budgets.rb +7 -0
  59. data/lib/decidim/budgets/component.rb +24 -6
  60. data/lib/decidim/budgets/engine.rb +1 -6
  61. data/lib/decidim/budgets/project_serializer.rb +2 -1
  62. data/lib/decidim/budgets/version.rb +1 -1
  63. metadata +26 -58
  64. data/app/assets/config/decidim_budgets_manifest.js +0 -1
  65. data/app/assets/stylesheets/decidim/budgets/_budgets.scss +0 -1
  66. data/config/locales/ja-JP.yml +0 -172
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a99236af82e1741b097227cf2e4f026411ad3e010194e802386ca695846479ce
4
- data.tar.gz: 5c257f19c77ca4a45f044ce7cd676a4b3c4579e33928d0a0c6d8f23220ce7d72
3
+ metadata.gz: 8d5f52b55491cbb9db4ab39ad53f9f5f4bef09904eebb5cec0353647fd9a3855
4
+ data.tar.gz: b54721c17f5446818644ff49058570562259cb1ff049ae9554f6bd8208ec205f
5
5
  SHA512:
6
- metadata.gz: 42d26e2dfa1f1e5c8a740882f13fe5fa32995a07baaaba95865a6414367308dfadbd5cb24a20ad70e486e77c349e3101fc44042dec1934f8151156c0ad5ba907
7
- data.tar.gz: d632d45a8bb76e79aa113e3d6ffb4b8461fffbd421485d7635b6f3b4e5619c7c7d7c19ba9e10095fe8aa4788e531d727346c2a13e1d3f0391d4ddc5a7bd0c5ce
6
+ metadata.gz: c52b6e8009ca7a4a3b535064a2f26f0c13119db5eefaab16719add91b1517a369f2cf55975c134d4cb6aecff56900603702b41ae741a9add5b4d81e53820fe40
7
+ data.tar.gz: 4fa010ce15c1eada7a86f023c452073b267e0126620673a994d0f52438e66471a7a23a329776057afe157b023cb03a4ba69cb982158e9d2fe1b507704f72a66e
@@ -6,14 +6,14 @@
6
6
  <%= translated_attribute(title) %>
7
7
  </strong>
8
8
  <span class="button tiny success card--list__check card--list__check--disabled">
9
- <%= icon "check", class: "icon--small", role: "img" %>
9
+ <%= icon "check", class: "icon--small", role: "img", aria_label: t("decidim.budgets.budget_list_item.voting_finished") %>
10
10
  </span>
11
11
  <% else %>
12
12
  <%= translated_attribute(title) %>
13
13
 
14
14
  <% if progress? && !voting_finished? %>
15
15
  <span class="button tiny hollow secondary card--list__check card--list__check--disabled">
16
- <%= icon "bookmark", class: "icon--small", role: "img" %>
16
+ <%= icon "bookmark", class: "icon--small", role: "img", aria_label: t("decidim.budgets.budget_list_item.voting_started") %>
17
17
  </span>
18
18
  <% end %>
19
19
  <% end %>
@@ -18,7 +18,7 @@ module Decidim
18
18
 
19
19
  def hint
20
20
  contents = []
21
- contents << icon("check", role: "img")
21
+ contents << icon("check", role: "img", "aria-hidden": true)
22
22
  contents << " "
23
23
  contents << t("decidim.budgets.projects.project.you_voted")
24
24
  end
@@ -46,7 +46,7 @@ module Decidim
46
46
  budget: form.budget,
47
47
  title: original_proposal.title,
48
48
  description: original_proposal.body,
49
- budget_amount: form.default_budget,
49
+ budget_amount: budget_for(original_proposal),
50
50
  category: original_proposal.category,
51
51
  scope: original_proposal.scope
52
52
  }
@@ -59,6 +59,12 @@ module Decidim
59
59
  )
60
60
  end
61
61
 
62
+ def budget_for(original_proposal)
63
+ return form.default_budget if original_proposal.cost.blank?
64
+
65
+ original_proposal.cost
66
+ end
67
+
62
68
  def proposals
63
69
  return all_proposals if form.scope_id.blank?
64
70
 
@@ -6,7 +6,7 @@ module Decidim
6
6
  # This controller allows an admin to manage projects from a Participatory Process
7
7
  class ProjectsController < Admin::ApplicationController
8
8
  include Decidim::ApplicationHelper
9
- include Decidim::Proposals::Admin::Picker
9
+ include Decidim::Proposals::Admin::Picker if Decidim::Budgets.enable_proposal_linking
10
10
 
11
11
  helper_method :projects, :finished_orders, :pending_orders, :present
12
12
 
@@ -12,7 +12,7 @@ module Decidim
12
12
  include Decidim::HasAttachmentCollections
13
13
  include Decidim::HasReference
14
14
  include Decidim::Followable
15
- include Decidim::Comments::Commentable
15
+ include Decidim::Comments::CommentableWithComponent
16
16
  include Decidim::Traceable
17
17
  include Decidim::Loggable
18
18
  include Decidim::Randomable
@@ -26,7 +26,12 @@ module Decidim
26
26
  has_many :line_items, class_name: "Decidim::Budgets::LineItem", foreign_key: "decidim_project_id", dependent: :destroy
27
27
  has_many :orders, through: :line_items, foreign_key: "decidim_project_id", class_name: "Decidim::Budgets::Order"
28
28
 
29
- delegate :organization, :participatory_space, to: :component
29
+ delegate :organization, :participatory_space, :can_participate_in_space?, to: :component
30
+
31
+ alias can_participate? can_participate_in_space?
32
+
33
+ scope :selected, -> { where.not(selected_at: nil) }
34
+ scope :not_selected, -> { where(selected_at: nil) }
30
35
 
31
36
  searchable_fields(
32
37
  scope_id: :decidim_scope_id,
@@ -56,16 +61,6 @@ module Decidim
56
61
  ::Decidim::ResourceLocatorPresenter.new([budget, self]).url(url_params)
57
62
  end
58
63
 
59
- # Public: Overrides the `commentable?` Commentable concern method.
60
- def commentable?
61
- component.settings.comments_enabled?
62
- end
63
-
64
- # Public: Overrides the `accepts_new_comments?` Commentable concern method.
65
- def accepts_new_comments?
66
- commentable? && !component.current_settings.comments_blocked
67
- end
68
-
69
64
  # Public: Overrides the `comments_have_votes?` Commentable concern method.
70
65
  def comments_have_votes?
71
66
  true
@@ -86,11 +81,6 @@ module Decidim
86
81
  component.settings.resources_permissions_enabled
87
82
  end
88
83
 
89
- # Public: Whether the object can have new comments or not.
90
- def user_allowed_to_comment?(user)
91
- component.can_participate_in_space?(user)
92
- end
93
-
94
84
  # Public: Checks if the project has been selected or not.
95
85
  #
96
86
  # Returns Boolean.
@@ -0,0 +1,5 @@
1
+ import "src/decidim/budgets/projects"
2
+ import "src/decidim/budgets/progressFixed"
3
+
4
+ // Images
5
+ require.context("../images", true)
@@ -1,6 +1,3 @@
1
- // = require ./progressFixed
2
- // = require_self
3
-
4
1
  $(() => {
5
2
  const $projects = $("#projects, #project");
6
3
  const $budgetSummaryTotal = $(".budget-summary__total");
@@ -0,0 +1,3 @@
1
+ @import "stylesheets/decidim/budgets/budget/budget-list";
2
+ @import "stylesheets/decidim/budgets/budget/budget-meter";
3
+ @import "stylesheets/decidim/budgets/budget/progress";
@@ -28,7 +28,7 @@
28
28
  flex-shrink: 0;
29
29
  margin-top: $card-padding-small * .7;
30
30
  margin-bottom: $card-padding-small * .7;
31
- margin-left: $card-padding-small / 2;
31
+ margin-left: $card-padding-small * .5;
32
32
 
33
33
  @include breakpoint(medium){
34
34
  width: 6rem;
@@ -47,7 +47,7 @@
47
47
  }
48
48
 
49
49
  &__text{
50
- padding: $card-padding-small / 2;
50
+ padding: $card-padding-small * .5;
51
51
  flex-grow: 1;
52
52
 
53
53
  @include breakpoint(medium){
@@ -72,7 +72,7 @@
72
72
  font-size: 85%;
73
73
  line-height: 1;
74
74
  color: $muted;
75
- padding: $card-padding-small / 2;
75
+ padding: $card-padding-small * .5;
76
76
  background: $card-secondary-bg;
77
77
 
78
78
  @include breakpoint(medium){
@@ -24,6 +24,7 @@ module Decidim
24
24
  private
25
25
 
26
26
  attr_reader :order
27
+ alias resource order
27
28
 
28
29
  def all_projects
29
30
  order.projects.map do |project|
@@ -27,6 +27,12 @@ module Decidim
27
27
  Project.where(id: super.pluck(:id)).includes([:scope, :component, :attachments, :category])
28
28
  end
29
29
 
30
+ def search_status
31
+ return query if status.member?("all")
32
+
33
+ apply_scopes(%w(selected not_selected), status)
34
+ end
35
+
30
36
  private
31
37
 
32
38
  # Private: Since budget is not used by a search method we need
@@ -48,13 +48,13 @@
48
48
  <% if allowed_to? :update, :budget, budget: budget %>
49
49
  <%= icon_link_to "pencil", edit_budget_path(budget), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
50
50
  <% else %>
51
- <%= icon "pencil", class: "action-icon action-icon--disabled", role: "img" %>
51
+ <%= icon "pencil", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.budgets") %>
52
52
  <% end %>
53
53
 
54
54
  <% if allowed_to? :delete, :budget, budget: budget %>
55
55
  <%= 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") } %>
56
56
  <% else %>
57
- <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
57
+ <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.budgets") %>
58
58
  <% end %>
59
59
  </td>
60
60
  </tr>
@@ -28,9 +28,11 @@
28
28
  <%= form.categories_select :decidim_category_id, current_participatory_space.categories, include_blank: true, disable_parents: false %>
29
29
  </div>
30
30
 
31
- <div class="row column">
32
- <%= proposals_picker(form, :proposals, proposals_picker_projects_path) %>
33
- </div>
31
+ <% if Decidim::Budgets.enable_proposal_linking %>
32
+ <div class="row column">
33
+ <%= proposals_picker(form, :proposals, proposals_picker_projects_path) %>
34
+ </div>
35
+ <% end %>
34
36
 
35
37
  <%= render partial: "decidim/admin/shared/gallery", locals: { form: form } %>
36
38
 
@@ -64,7 +64,7 @@
64
64
  <% if allowed_to? :destroy, :project, project: project %>
65
65
  <%= 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") } %>
66
66
  <% else %>
67
- <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
67
+ <%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.budgets") %>
68
68
  <% end %>
69
69
  </td>
70
70
  </tr>
@@ -4,10 +4,10 @@
4
4
  <div class="filters__section">
5
5
  <div class="filters__search">
6
6
  <div class="input-group">
7
- <%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(".search"), title: t(".search"), data: { disable_dynamic_change: true } %>
7
+ <%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(".search"), title: t(".search"), "aria-label": t(".search"), data: { disable_dynamic_change: true } %>
8
8
  <div class="input-group-button">
9
9
  <button type="submit" class="button" aria-controls="projects">
10
- <%= icon "magnifying-glass", aria_label: t(".search"), role: "img", "aria-hidden": true %>
10
+ <%= icon "magnifying-glass", aria_label: t(".search"), role: "img" %>
11
11
  </button>
12
12
  </div>
13
13
  </div>
@@ -30,5 +30,4 @@
30
30
  </div>
31
31
  </div>
32
32
 
33
- <%= javascript_include_tag("decidim/filters") %>
34
- <%= javascript_include_tag("decidim/budgets/projects") %>
33
+ <%= javascript_pack_tag("decidim_budgets") %>
@@ -49,6 +49,7 @@ edit_link(
49
49
  </div>
50
50
  </div>
51
51
  <%= resource_reference(project) %>
52
+ <%= render partial: "decidim/shared/share_modal" %>
52
53
  </div>
53
54
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
54
55
  <div class="section">
@@ -56,6 +57,7 @@ edit_link(
56
57
  <%= decidim_sanitize translated_attribute project.description %>
57
58
  <%= cell "decidim/budgets/project_tags", project, context: { extra_classes: ["tags--project"] } %>
58
59
  </div>
60
+ <%= attachments_for project %>
59
61
  <%= linked_resources_for project, :proposals, "included_proposals" %>
60
62
  <%= linked_resources_for project, :results, "included_projects" %>
61
63
  </div>
@@ -63,5 +65,4 @@ edit_link(
63
65
 
64
66
  <%= comments_for project %>
65
67
 
66
- <%= attachments_for project %>
67
- <%= javascript_include_tag("decidim/budgets/projects") %>
68
+ <%= javascript_pack_tag("decidim_budgets") %>
data/config/assets.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ base_path = File.expand_path("..", __dir__)
4
+
5
+ Decidim::Webpacker.register_path("#{base_path}/app/packs")
6
+ Decidim::Webpacker.register_entrypoints(
7
+ decidim_budgets: "#{base_path}/app/packs/entrypoints/decidim_budgets.js"
8
+ )
9
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/budgets/budgets")
@@ -145,8 +145,5 @@ ar:
145
145
  destroy:
146
146
  error: حدثت مشكلة في إلغاء تصويتك
147
147
  success: تم إلغاء تصويتك بنجاح
148
- resource_links:
149
- included_proposals:
150
- project_proposal: 'المقترحات المدرجة في هذا المشروع:'
151
148
  index:
152
149
  confirmed_orders_count: عدد الأصوات
@@ -6,7 +6,7 @@ ca:
6
6
  description: Descripció
7
7
  title: Títol
8
8
  total_budget: Pressupost total
9
- weight: Pes
9
+ weight: Ordre de posició
10
10
  project:
11
11
  budget_amount: Import del pressupost
12
12
  decidim_category_id: Categoria
@@ -108,6 +108,9 @@ ca:
108
108
  close_modal: Tancar el modal
109
109
  continue: Continuar
110
110
  more_information: Més informació
111
+ budget_list_item:
112
+ voting_finished: Has votat en aquest pressupost
113
+ voting_started: Has començat a votar en aquest pressupost
111
114
  budgets_list:
112
115
  cancel_order:
113
116
  more_than_one: eliminar el teu vot a %{name} i començar de nou
@@ -290,6 +293,9 @@ ca:
290
293
  success: El teu vot ha estat cancel·lat correctament
291
294
  resource_links:
292
295
  included_proposals:
293
- project_proposal: 'Propostes incloses en aquest projecte:'
296
+ project_proposal: Propostes incloses en aquest projecte
297
+ statistics:
298
+ orders_count: Suports
299
+ projects_count: Projectes
294
300
  index:
295
301
  confirmed_orders_count: Recompte de vots
@@ -6,7 +6,7 @@ cs:
6
6
  description: Popis
7
7
  title: Název
8
8
  total_budget: Celkový rozpočet
9
- weight: Váha
9
+ weight: Pozice v řazení
10
10
  project:
11
11
  budget_amount: Částka rozpočtu
12
12
  decidim_category_id: Kategorie
@@ -110,6 +110,9 @@ cs:
110
110
  close_modal: Zavřít okno
111
111
  continue: Pokračovat
112
112
  more_information: Více informací
113
+ budget_list_item:
114
+ voting_finished: Hlasovali jste v tomto rozpočtu
115
+ voting_started: Začali jste hlasovat v tomto rozpočtu
113
116
  budgets_list:
114
117
  cancel_order:
115
118
  more_than_one: smažte svůj hlas na %{name} a začněte znovu
@@ -298,6 +301,9 @@ cs:
298
301
  success: Váš hlas byl úspěšně zrušen
299
302
  resource_links:
300
303
  included_proposals:
301
- project_proposal: 'Návrhy zahrnuté do tohoto projektu:'
304
+ project_proposal: Návrhy zahrnuté do tohoto projektu
305
+ statistics:
306
+ orders_count: Podpory
307
+ projects_count: Projekty
302
308
  index:
303
309
  confirmed_orders_count: Počet hlasů
@@ -6,7 +6,7 @@ de:
6
6
  description: Beschreibung
7
7
  title: Titel
8
8
  total_budget: Gesamtbudget
9
- weight: Gewichtung
9
+ weight: Bestellposition
10
10
  project:
11
11
  budget_amount: Höhe des Budgets
12
12
  decidim_category_id: Kategorie
@@ -108,6 +108,9 @@ de:
108
108
  close_modal: Dialog schließen
109
109
  continue: Weiter
110
110
  more_information: Mehr Informationen
111
+ budget_list_item:
112
+ voting_finished: Sie haben bei diesem Budget abgestimmt
113
+ voting_started: Sie haben damit begonnen, bei diesem Budget abzustimmen
111
114
  budgets_list:
112
115
  cancel_order:
113
116
  more_than_one: lösche deine Stimme am %{name} und beginne neu
@@ -290,6 +293,9 @@ de:
290
293
  success: Ihre Abstimmung wurde erfolgreich abgebrochen
291
294
  resource_links:
292
295
  included_proposals:
293
- project_proposal: 'Vorschläge in diesem Projekt:'
296
+ project_proposal: Vorschläge in diesem Projekt
297
+ statistics:
298
+ orders_count: Projektauswahlen
299
+ projects_count: Projekte
294
300
  index:
295
301
  confirmed_orders_count: Stimmen zählen
@@ -158,8 +158,5 @@ el:
158
158
  destroy:
159
159
  error: Υπήρξε ένα πρόβλημα κατά την ακύρωση της ψήφου σας
160
160
  success: Η ψήφος σας ακυρώθηκε με επιτυχία
161
- resource_links:
162
- included_proposals:
163
- project_proposal: 'Προτάσεις που περιλαμβάνονται σε αυτό το έργο:'
164
161
  index:
165
162
  confirmed_orders_count: Πλήθος ψήφων
@@ -7,7 +7,7 @@ en:
7
7
  description: Description
8
8
  title: Title
9
9
  total_budget: Total budget
10
- weight: Weight
10
+ weight: Order position
11
11
  project:
12
12
  budget_amount: Budget amount
13
13
  decidim_category_id: Category
@@ -109,6 +109,9 @@ en:
109
109
  close_modal: Close modal
110
110
  continue: Continue
111
111
  more_information: More information
112
+ budget_list_item:
113
+ voting_finished: You have voted in this budget
114
+ voting_started: You have started to vote in this budget
112
115
  budgets_list:
113
116
  cancel_order:
114
117
  more_than_one: delete your vote on %{name} and start over
@@ -231,6 +234,7 @@ en:
231
234
  components:
232
235
  budgets:
233
236
  actions:
237
+ comment: Comment
234
238
  vote: Vote
235
239
  name: Budgets
236
240
  settings:
@@ -291,6 +295,9 @@ en:
291
295
  success: Your vote has been successfully canceled
292
296
  resource_links:
293
297
  included_proposals:
294
- project_proposal: 'Proposals included in this project:'
298
+ project_proposal: Proposals included in this project
299
+ statistics:
300
+ orders_count: Supports
301
+ projects_count: Projects
295
302
  index:
296
303
  confirmed_orders_count: Votes count