decidim-accountability 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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/accountability/highlighted_results_for_component/show.erb +1 -1
  3. data/app/cells/decidim/accountability/project/timeline.erb +2 -2
  4. data/app/cells/decidim/accountability/project_cell.rb +17 -5
  5. data/app/cells/decidim/accountability/result_metadata_cell.rb +3 -3
  6. data/app/cells/decidim/accountability/status/status.erb +1 -1
  7. data/app/cells/decidim/accountability/status_cell.rb +3 -1
  8. data/app/controllers/decidim/accountability/results_controller.rb +22 -0
  9. data/app/events/decidim/accountability/base_result_event.rb +29 -0
  10. data/app/events/decidim/accountability/proposal_linked_event.rb +1 -18
  11. data/app/events/decidim/accountability/result_progress_updated_event.rb +2 -18
  12. data/app/views/decidim/accountability/admin/import_results/new.html.erb +2 -2
  13. data/app/views/decidim/accountability/admin/projects_import/new.html.erb +2 -2
  14. data/app/views/decidim/accountability/admin/results/edit.html.erb +2 -2
  15. data/app/views/decidim/accountability/admin/results/index.html.erb +2 -2
  16. data/app/views/decidim/accountability/admin/results/new.html.erb +2 -2
  17. data/app/views/decidim/accountability/admin/statuses/edit.html.erb +2 -2
  18. data/app/views/decidim/accountability/admin/statuses/index.html.erb +2 -2
  19. data/app/views/decidim/accountability/admin/statuses/new.html.erb +2 -2
  20. data/app/views/decidim/accountability/admin/timeline_entries/edit.html.erb +2 -2
  21. data/app/views/decidim/accountability/admin/timeline_entries/index.html.erb +2 -2
  22. data/app/views/decidim/accountability/admin/timeline_entries/new.html.erb +2 -2
  23. data/app/views/decidim/accountability/results/_scope_filters.html.erb +2 -2
  24. data/app/views/decidim/accountability/results/_search.html.erb +4 -4
  25. data/app/views/decidim/accountability/results/home.html.erb +1 -1
  26. data/app/views/decidim/accountability/results/index.html.erb +1 -1
  27. data/config/locales/ar.yml +1 -1
  28. data/config/locales/bg.yml +119 -0
  29. data/config/locales/ca.yml +2 -1
  30. data/config/locales/da.yml +0 -1
  31. data/config/locales/de.yml +2 -1
  32. data/config/locales/en.yml +1 -0
  33. data/config/locales/es-MX.yml +5 -4
  34. data/config/locales/es-PY.yml +5 -4
  35. data/config/locales/es.yml +9 -8
  36. data/config/locales/eu.yml +4 -3
  37. data/config/locales/fi-plain.yml +1 -0
  38. data/config/locales/fi.yml +1 -0
  39. data/config/locales/he-IL.yml +313 -0
  40. data/config/locales/hu.yml +11 -0
  41. data/config/locales/id-ID.yml +0 -1
  42. data/config/locales/it.yml +6 -0
  43. data/config/locales/ja.yml +1 -0
  44. data/config/locales/ko.yml +249 -0
  45. data/config/locales/lb.yml +1 -1
  46. data/config/locales/lv.yml +0 -1
  47. data/config/locales/pl.yml +6 -0
  48. data/config/locales/pt-BR.yml +11 -0
  49. data/config/locales/pt.yml +6 -0
  50. data/config/locales/ro-RO.yml +73 -24
  51. data/config/locales/ru.yml +0 -1
  52. data/config/locales/si-LK.yml +1 -0
  53. data/config/locales/sk.yml +0 -1
  54. data/config/locales/sq-AL.yml +6 -0
  55. data/config/locales/sr-CS.yml +0 -1
  56. data/config/locales/th-TH.yml +214 -0
  57. data/config/locales/tr-TR.yml +80 -0
  58. data/config/locales/uk.yml +0 -1
  59. data/config/locales/zh-CN.yml +0 -1
  60. data/decidim-accountability.gemspec +45 -0
  61. data/lib/decidim/accountability/engine.rb +2 -0
  62. data/lib/decidim/accountability/test/factories.rb +29 -17
  63. data/lib/decidim/accountability/version.rb +1 -1
  64. data/lib/decidim/api/result_type.rb +0 -1
  65. metadata +26 -24
  66. data/config/environment.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c44709e4f0be476fbe736b6aef8085a3d4d36096a6203d040b9b6c7b3f2c231d
4
- data.tar.gz: 2cd9462d29855ea54629141a81a4abc8e7cbbff3bdfadb26c093d1200b5ea3a7
3
+ metadata.gz: ce10e6fa54bd6b83357be2d515ee441397757309e9d8a2e9ab038c7315488650
4
+ data.tar.gz: a16768d26ef1444000da351bd940506b99d540ac3e331cb4f25587e0f38932ee
5
5
  SHA512:
6
- metadata.gz: 50ca660426ef73e3dc827e98aa438b1a94e1e83226e7f70ac5ad8ee79e471430dc2a8be0283727fc97b6dbefa01f75f69be7248a9e9a1be7dcd13cea3058f553
7
- data.tar.gz: 6558d7f669c3c34ef96f8266d0e5cdb323b70311fc00b6a515e0e3adb4ae21779d3867994c2105e4b1a934f8f205a352bfe4cc13c7990246c1401988b8dfa8ad
6
+ metadata.gz: 5c625ff0064c939e7f1b794467958232964b3f841319d0a9c1ef9c39941c73ffd2c66dc382aa05fc3ea9a546b0bc45a888f955bde9947b3e00a03901d505e26d
7
+ data.tar.gz: 9dc2c614406d132403a80047cb87f98d4078097d575aae73b8798a78e95e19b96451e4c8337a755e830b1a78e7f46951ff6b0be46b9b66abfa3997f07fc23559
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="content-block__title">
5
5
  <h2 class="h2 decorator">
6
- <%= single_component? ? translated_attribute(model.name) : t("decidim.accountability.content_blocks.highlighted_results.results") %>
6
+ <%= single_component? ? decidim_escape_translated(model.name) : t("decidim.accountability.content_blocks.highlighted_results.results") %>
7
7
  </h2>
8
8
  <div class="label text-lg"><%= results_count %></div>
9
9
  <% if single_component? %>
@@ -6,14 +6,14 @@
6
6
  </div>
7
7
  <div class="accountability__project-timeline-entry-attributes">
8
8
  <h3>
9
- <%= translated_attribute timeline_entry.title %>
9
+ <%= decidim_sanitize_translated timeline_entry.title %>
10
10
  </h3>
11
11
  <div>
12
12
  <%= l timeline_entry.entry_date, format: :decidim_short %>
13
13
  </div>
14
14
  <% if translated_attribute(timeline_entry.description).present? %>
15
15
  <div>
16
- <%= translated_attribute(timeline_entry.description).html_safe %>
16
+ <%= decidim_sanitize_translated(timeline_entry.description) %>
17
17
  </div>
18
18
  <% end %>
19
19
  </div>
@@ -17,17 +17,21 @@ module Decidim
17
17
  alias result model
18
18
 
19
19
  def show
20
- render
20
+ render template
21
21
  end
22
22
 
23
23
  private
24
24
 
25
+ def template
26
+ @template ||= options[:template] || :show
27
+ end
28
+
25
29
  def title
26
- translated_attribute result.title
30
+ decidim_escape_translated result.title
27
31
  end
28
32
 
29
33
  def description
30
- translated_attribute(result.description).html_safe
34
+ decidim_sanitize_admin translated_attribute(result.description)
31
35
  end
32
36
 
33
37
  def scope
@@ -37,11 +41,19 @@ module Decidim
37
41
  def tab_panel_items
38
42
  [
39
43
  {
40
- enabled: children.any?,
41
- id: "list",
44
+ enabled: timeline_entries.any?,
45
+ id: "timeline_entries",
42
46
  text: t("decidim.accountability.results.timeline.title"),
43
47
  icon: "route-line",
44
48
  method: :cell,
49
+ args: ["decidim/accountability/project", result, { template: :timeline }]
50
+ },
51
+ {
52
+ enabled: children.any?,
53
+ id: "included_results",
54
+ text: t("activemodel.attributes.result.subresults"),
55
+ icon: "briefcase-2-line",
56
+ method: :cell,
45
57
  args: ["decidim/accountability/results", result.children]
46
58
  },
47
59
  {
@@ -75,7 +75,7 @@ module Decidim
75
75
  return if status.blank?
76
76
 
77
77
  {
78
- text: translated_attribute(status.name),
78
+ text: decidim_escape_translated(status.name),
79
79
  icon: "focus-2-line"
80
80
  }
81
81
  end
@@ -114,12 +114,12 @@ module Decidim
114
114
  {
115
115
  text: t("models.result.fields.status", scope: "decidim.accountability"),
116
116
  icon: "focus-2-line",
117
- value: translated_attribute(status.name)
117
+ value: decidim_escape_translated(status.name)
118
118
  }
119
119
  end
120
120
 
121
121
  def status_description
122
- return unless status.present? && (description = translated_attribute(status.description)).present?
122
+ return unless status.present? && (description = decidim_escape_translated(status.description)).present?
123
123
 
124
124
  {
125
125
  text: t("models.status.fields.description", scope: "decidim.accountability"),
@@ -1,7 +1,7 @@
1
1
  <p class="accountability__status-title"><%= title %></p>
2
2
 
3
3
  <% if component_settings.display_progress_enabled? && progress.present? %>
4
- <div class="accountability__status-progress">
4
+ <div class="accountability__status-progress" role="progressbar" aria-label="<%= t("decidim.shared.progress") %>" aria-valuenow="<%= number_with_precision(progress, separator: ".", precision: 1) %>" aria-valuemin="0" aria-valuemax="100" aria-valuetext="<%= number_to_percentage(progress, precision: 1) %>">
5
5
  <div style="width:<%= progress %>%"></div>
6
6
  </div>
7
7
  <% end %>
@@ -8,8 +8,10 @@ module Decidim
8
8
  class StatusCell < Decidim::ViewModel
9
9
  include ApplicationHelper
10
10
  include BreadcrumbHelper
11
+ include Decidim::SanitizeHelper
11
12
  include Decidim::TranslationsHelper
12
13
  include ActiveSupport::NumberHelper
14
+ include ActionView::Helpers::NumberHelper
13
15
 
14
16
  delegate :current_component, :component_settings, to: :controller
15
17
 
@@ -39,7 +41,7 @@ module Decidim
39
41
 
40
42
  def title
41
43
  if model.is_a? Decidim::Category
42
- translated_attribute(model.name)
44
+ decidim_html_escape translated_attribute(model.name)
43
45
  else
44
46
  options[:title]
45
47
  end
@@ -5,11 +5,15 @@ module Decidim
5
5
  # Exposes the result resource so users can view them
6
6
  class ResultsController < Decidim::Accountability::ApplicationController
7
7
  include FilterResource
8
+ include Decidim::TranslatableAttributes
9
+
8
10
  helper Decidim::TraceabilityHelper
9
11
  helper Decidim::Accountability::BreadcrumbHelper
10
12
 
11
13
  helper_method :results, :result, :first_class_categories, :count_calculator, :nav_paths
12
14
 
15
+ before_action :set_controller_breadcrumb
16
+
13
17
  def show
14
18
  raise ActionController::RoutingError, "Not Found" unless result
15
19
  end
@@ -66,6 +70,24 @@ module Decidim
66
70
  def count_calculator(scope_id, category_id)
67
71
  Decidim::Accountability::ResultsCalculator.new(current_component, scope_id, category_id).count
68
72
  end
73
+
74
+ def controller_breadcrumb_items
75
+ @controller_breadcrumb_items ||= []
76
+ end
77
+
78
+ def set_controller_breadcrumb
79
+ controller_breadcrumb_items << breadcrumb_item
80
+ end
81
+
82
+ def breadcrumb_item
83
+ return {} if result&.parent.blank?
84
+
85
+ {
86
+ label: translated_attribute(result.parent.title),
87
+ url: result_path(result.parent),
88
+ active: true
89
+ }
90
+ end
69
91
  end
70
92
  end
71
93
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ class BaseResultEvent < Decidim::Events::SimpleEvent
6
+ i18n_attributes :proposal_title, :proposal_path
7
+
8
+ def resource_text
9
+ translated_attribute(resource.description)
10
+ end
11
+
12
+ def proposal_title
13
+ @proposal_title ||= decidim_sanitize_translated(proposal.title)
14
+ end
15
+
16
+ def proposal_path
17
+ @proposal_path ||= Decidim::ResourceLocatorPresenter.new(proposal).path
18
+ end
19
+
20
+ def proposal
21
+ @proposal ||= resource.linked_resources(:proposals, "included_proposals").find_by(id: extra[:proposal_id])
22
+ end
23
+
24
+ def hidden_resource?
25
+ super || (proposal.respond_to?(:hidden?) && proposal.hidden?)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -2,24 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Accountability
5
- class ProposalLinkedEvent < Decidim::Events::SimpleEvent
6
- i18n_attributes :proposal_title, :proposal_path
7
-
8
- def proposal_path
9
- @proposal_path ||= Decidim::ResourceLocatorPresenter.new(proposal).path
10
- end
11
-
12
- def proposal_title
13
- @proposal_title ||= translated_attribute(proposal.title)
14
- end
15
-
16
- def proposal
17
- @proposal ||= resource.linked_resources(:proposals, "included_proposals").find_by(id: extra[:proposal_id])
18
- end
19
-
20
- def resource_text
21
- translated_attribute(resource.description)
22
- end
5
+ class ProposalLinkedEvent < BaseResultEvent
23
6
  end
24
7
  end
25
8
  end
@@ -2,28 +2,12 @@
2
2
 
3
3
  module Decidim
4
4
  module Accountability
5
- class ResultProgressUpdatedEvent < Decidim::Events::SimpleEvent
6
- i18n_attributes :proposal_title, :proposal_path, :progress
7
-
8
- def proposal_path
9
- @proposal_path ||= Decidim::ResourceLocatorPresenter.new(proposal).path
10
- end
11
-
12
- def proposal_title
13
- @proposal_title ||= translated_attribute(proposal.title)
14
- end
15
-
16
- def proposal
17
- @proposal ||= resource.linked_resources(:proposals, "included_proposals").find_by(id: extra[:proposal_id])
18
- end
5
+ class ResultProgressUpdatedEvent < BaseResultEvent
6
+ i18n_attributes :progress
19
7
 
20
8
  def progress
21
9
  extra[:progress]
22
10
  end
23
-
24
- def resource_text
25
- translated_attribute(resource.description)
26
- end
27
11
  end
28
12
  end
29
13
  end
@@ -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,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
 
8
8
  <div class="item__edit item__edit-1col">
@@ -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
 
8
8
  <div class="item__edit item__edit-1col">
@@ -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
  <% if parent_result %>
6
6
  <%= "#{translated_attribute(parent_result.title)} > " %>
7
7
  <% end %>
@@ -19,7 +19,7 @@
19
19
  <%= render partial: "decidim/accountability/admin/shared/subnav" unless parent_result %>
20
20
  <%= link_to t("actions.new_result", scope: "decidim.accountability"), new_result_path(parent_id: parent_result), class: "button button__sm button__secondary" if allowed_to? :create, :result %>
21
21
  <%= render partial: "decidim/admin/components/resource_action" %>
22
- </h2>
22
+ </h1>
23
23
  </div>
24
24
 
25
25
  <%= admin_filter_selector(:results) %>
@@ -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
 
8
8
  <div class="item__edit item__edit-1col">
@@ -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,10 +1,10 @@
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
  <%= link_to t("actions.new_status", scope: "decidim.accountability"), new_status_path, class: "button button__sm button__secondary" if allowed_to? :create, :status %>
7
- </h2>
7
+ </h1>
8
8
  </div>
9
9
  <div class="table-scroll">
10
10
  <table class="table-list">
@@ -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,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">
@@ -2,13 +2,13 @@
2
2
  <% add_decidim_page_title(translated_attribute(result.title)) %>
3
3
  <div class="card">
4
4
  <div class="item_show__header">
5
- <h2 class="item_show__header-title">
5
+ <h1 class="item_show__header-title">
6
6
  <div>
7
7
  <%= link_to "#{translated_attribute(result.title)} > ", edit_result_path(result) %>
8
8
  <%= t(".title") %>
9
9
  </div>
10
10
  <%= link_to t("actions.new_timeline_entry", scope: "decidim.accountability"), new_result_timeline_entry_path(result), class: "button button__sm button__secondary button--title" if allowed_to? :create, :timeline_entry %>
11
- </h2>
11
+ </h1>
12
12
  </div>
13
13
  <div class="table-scroll">
14
14
  <table class="table-list">
@@ -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">
@@ -4,7 +4,7 @@
4
4
 
5
5
  <% if current_component.has_subscopes? %>
6
6
  <div class="filter-container">
7
- <button id="dropdown-trigger-accountability" data-component="dropdown" data-target="dropdown-menu-accountability" data-auto-close="true" data-disabled-md="true">
7
+ <button id="dropdown-trigger-accountability" data-component="dropdown" data-target="dropdown-menu-accountability" data-auto-close="true">
8
8
  <% items.each do |item| %>
9
9
  <%= content_tag :span, class: "#{"is-active" if item[:active]}" do %>
10
10
  <span class="sr-only"><%= item[:sr_text] %></span>
@@ -15,7 +15,7 @@
15
15
  <%= icon "arrow-down-s-line", class: "w-8 h-8 flex-none text-secondary fill-current" %>
16
16
  <%= icon "arrow-up-s-line", class: "w-8 h-8 flex-none text-secondary fill-current" %>
17
17
  </button>
18
- <ul id="dropdown-menu-accountability" data-scope-filters>
18
+ <ul id="dropdown-menu-accountability" data-scope-filters aria-hidden="true">
19
19
  <% items.each do |item| %>
20
20
  <li>
21
21
  <%= link_to item[:url], class: "filter#{" is-active" if item[:active]}" do %>
@@ -1,5 +1,5 @@
1
1
  <%= form_tag results_path, method: :get do %>
2
- <div class="filter-search">
2
+ <div class="filter-search filter-container">
3
3
  <label>
4
4
  <span class="sr-only"><%= t("search", scope: "decidim.accountability.results.search") %></span>
5
5
  <%= search_field_tag(
@@ -10,9 +10,9 @@
10
10
  value: "",
11
11
  title: t("search", scope: "decidim.accountability.results.search")
12
12
  ) %>
13
- <button type="submit" aria-label="<%= t("search", scope: "decidim.accountability.results.search") %>">
14
- <%= icon "search-line" %>
15
- </button>
16
13
  </label>
14
+ <button type="submit" aria-label="<%= t("search", scope: "decidim.accountability.results.search") %>">
15
+ <%= icon "search-line" %>
16
+ </button>
17
17
  </div>
18
18
  <% end %>
@@ -21,7 +21,7 @@
21
21
  <%= render layout: "layouts/decidim/shared/layout_two_col" do %>
22
22
 
23
23
  <section class="layout-main__section">
24
- <div class="editor-content"><%== translated_attribute component_settings.intro %></div>
24
+ <div class="editor-content"><%= decidim_sanitize_admin translated_attribute(component_settings.intro) %></div>
25
25
  </section>
26
26
 
27
27
  <section class="layout-main__section">
@@ -7,7 +7,7 @@
7
7
 
8
8
  <%= render layout: "layouts/decidim/shared/layout_two_col" do %>
9
9
  <section class="layout-main__section">
10
- <h2 class="h4"><%= category.present? ? translated_attribute(category.name) : t("decidim.accountability.results.home_header.global_status") %></h2>
10
+ <h2 class="h4"><%= category.present? ? decidim_escape_translated(category.name) : t("decidim.accountability.results.home_header.global_status") %></h2>
11
11
  </section>
12
12
 
13
13
  <section id="results" class="layout-main__section">
@@ -183,7 +183,7 @@ ar:
183
183
  stats:
184
184
  attendees: الحضور
185
185
  back_to_resource: العودة إلى النتيجة
186
- comments: تعليقات
186
+ comments: التعليقات
187
187
  contributions: مساهمات
188
188
  last_edited_by: التعديل الأخير تم بواسطة
189
189
  last_updated_at: آخر تحديث في