decidim-accountability 0.22.0 → 0.23.3

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/decidim/accountability/results_controller.rb +0 -1
  3. data/app/forms/decidim/accountability/admin/result_form.rb +3 -9
  4. data/app/helpers/decidim/accountability/admin/application_helper.rb +13 -0
  5. data/app/helpers/decidim/accountability/application_helper.rb +1 -1
  6. data/app/models/decidim/accountability/result.rb +4 -1
  7. data/app/models/decidim/accountability/status.rb +3 -0
  8. data/app/models/decidim/accountability/timeline_entry.rb +3 -0
  9. data/app/services/decidim/accountability/result_search.rb +2 -20
  10. data/app/services/decidim/accountability/result_stats_calculator.rb +1 -1
  11. data/app/views/decidim/accountability/admin/results/_form.html.erb +2 -2
  12. data/app/views/decidim/accountability/admin/results/index.html.erb +2 -0
  13. data/app/views/decidim/accountability/results/_scope_filters.html.erb +1 -1
  14. data/app/views/decidim/accountability/results/_stats_box.html.erb +0 -1
  15. data/config/locales/am-ET.yml +1 -0
  16. data/config/locales/bg.yml +226 -0
  17. data/config/locales/ca.yml +16 -13
  18. data/config/locales/cs.yml +22 -19
  19. data/config/locales/da.yml +202 -0
  20. data/config/locales/de.yml +21 -18
  21. data/config/locales/el.yml +1 -0
  22. data/config/locales/en.yml +3 -0
  23. data/config/locales/eo.yml +1 -0
  24. data/config/locales/es-MX.yml +3 -0
  25. data/config/locales/es-PY.yml +3 -0
  26. data/config/locales/es.yml +15 -12
  27. data/config/locales/et.yml +1 -0
  28. data/config/locales/eu.yml +8 -8
  29. data/config/locales/fi-plain.yml +3 -0
  30. data/config/locales/fi.yml +3 -0
  31. data/config/locales/fr-CA.yml +4 -0
  32. data/config/locales/fr.yml +4 -0
  33. data/config/locales/gl.yml +24 -1
  34. data/config/locales/hr.yml +1 -0
  35. data/config/locales/hu.yml +1 -0
  36. data/config/locales/is-IS.yml +29 -0
  37. data/config/locales/is.yml +177 -0
  38. data/config/locales/it.yml +3 -0
  39. data/config/locales/ja-JP.yml +2 -1
  40. data/config/locales/ja.yml +224 -0
  41. data/config/locales/ko-KR.yml +1 -0
  42. data/config/locales/ko.yml +1 -0
  43. data/config/locales/lt.yml +1 -0
  44. data/config/locales/{lv-LV.yml → lv.yml} +0 -0
  45. data/config/locales/mt.yml +1 -0
  46. data/config/locales/nl.yml +12 -9
  47. data/config/locales/no.yml +2 -0
  48. data/config/locales/om-ET.yml +1 -0
  49. data/config/locales/pl.yml +38 -35
  50. data/config/locales/pt.yml +1 -0
  51. data/config/locales/ro-RO.yml +1 -0
  52. data/config/locales/si-LK.yml +28 -0
  53. data/config/locales/sk.yml +16 -0
  54. data/config/locales/sl.yml +1 -0
  55. data/config/locales/so-SO.yml +1 -0
  56. data/config/locales/sv.yml +3 -0
  57. data/config/locales/sw-KE.yml +1 -0
  58. data/config/locales/ti-ER.yml +1 -0
  59. data/config/locales/tr-TR.yml +37 -14
  60. data/config/locales/vi-VN.yml +1 -0
  61. data/config/locales/vi.yml +1 -0
  62. data/config/locales/zh-CN.yml +223 -0
  63. data/config/locales/zh-TW.yml +1 -0
  64. data/db/migrate/20200827154103_add_commentable_counter_cache_to_results.rb +9 -0
  65. data/lib/decidim/accountability/component.rb +6 -1
  66. data/lib/decidim/accountability/engine.rb +0 -1
  67. data/lib/decidim/accountability/test/factories.rb +3 -1
  68. data/lib/decidim/accountability/version.rb +1 -1
  69. metadata +49 -27
  70. data/app/controllers/decidim/accountability/result_widgets_controller.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5aa01ab3845ef9d564662b490d22e56aaf88d857de85adfb06f3a58d8bd827a8
4
- data.tar.gz: 44725f2f514ebc97eb45725e26d067406b24b5d6e71affd3aa5f6978ba92260b
3
+ metadata.gz: 8cd37e0d9df6d52f7f813a03d056210eee28969aa80b787cd301e35e5f5bd465
4
+ data.tar.gz: cd46056322cdb4919559155b5b60b9c3f33fb750e62c86a3c4596accc5432fcf
5
5
  SHA512:
6
- metadata.gz: 591653254ddaa34353fd6f010b51bfa122675f9abae01e027ee0d3dfedae70837e4f230c01549e68d181025d71d36f4d5458030f12857d556b63a3363d684513
7
- data.tar.gz: 66c9eb1f5bbf2b68d4a4ae82d5f49161b83e1cef65a435d4e923d20c7e0dba61060dbae6031b484e6ed1915e9baf834153af075bc259b1ef25ef6cbe3e88722d
6
+ metadata.gz: 184831b8b5647f609156aa43af35b4f1a3aee8242dca6046ba3cedb7c919da7f6a853c027a9225e97d2df1c3b0ef8f9f2a4741cbf7b619d6e494dc2d266e2cc1
7
+ data.tar.gz: 1200ab9f34b844ec8e9596cd0a5fdf90c3429d07fb1ffd4b4a42848384c13bb51fc2e33a46b490cf3d7cb18ff5f7ea1f204cc0870f3be8fefaf3e971debc419c
@@ -5,7 +5,6 @@ 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
- helper Decidim::WidgetUrlsHelper
9
8
  helper Decidim::TraceabilityHelper
10
9
  helper Decidim::Accountability::BreadcrumbHelper
11
10
 
@@ -28,13 +28,13 @@ module Decidim
28
28
  validates :progress, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 100 }, if: ->(form) { form.progress.present? }
29
29
 
30
30
  validates :scope, presence: true, if: ->(form) { form.decidim_scope_id.present? }
31
+ validates :decidim_scope_id, scope_belongs_to_component: true, if: ->(form) { form.decidim_scope_id.present? }
32
+
31
33
  validates :category, presence: true, if: ->(form) { form.decidim_category_id.present? }
32
34
 
33
35
  validates :parent, presence: true, if: ->(form) { form.parent_id.present? }
34
36
  validates :status, presence: true, if: ->(form) { form.decidim_accountability_status_id.present? }
35
37
 
36
- validate :scope_belongs_to_participatory_space_scope
37
-
38
38
  delegate :categories, to: :current_component
39
39
 
40
40
  def map_model(model)
@@ -59,7 +59,7 @@ module Decidim
59
59
  #
60
60
  # Returns a Decidim::Scope
61
61
  def scope
62
- @scope ||= @decidim_scope_id ? current_participatory_space.scopes.find_by(id: @decidim_scope_id) : current_participatory_space.scope
62
+ @scope ||= @decidim_scope_id ? current_component.scopes.find_by(id: @decidim_scope_id) : current_component.scope
63
63
  end
64
64
 
65
65
  # Scope identifier
@@ -80,12 +80,6 @@ module Decidim
80
80
  def status
81
81
  @status ||= Decidim::Accountability::Status.find_by(component: current_component, id: decidim_accountability_status_id)
82
82
  end
83
-
84
- private
85
-
86
- def scope_belongs_to_participatory_space_scope
87
- errors.add(:decidim_scope_id, :invalid) if current_participatory_space.out_of_scope?(scope)
88
- end
89
83
  end
90
84
  end
91
85
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ module Admin
6
+ # Custom helpers, scoped to the accountability admin engine.
7
+ #
8
+ module ApplicationHelper
9
+ include Decidim::Admin::ResourceScopeHelper
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Accountability
5
- # Custom helpers, scoped to the meetings engine.
5
+ # Custom helpers, scoped to the accountability engine.
6
6
  #
7
7
  module ApplicationHelper
8
8
  include PaginateHelper
@@ -7,7 +7,7 @@ module Decidim
7
7
  class Result < Accountability::ApplicationRecord
8
8
  include Decidim::Resourceable
9
9
  include Decidim::HasComponent
10
- include Decidim::ScopableComponent
10
+ include Decidim::ScopableResource
11
11
  include Decidim::HasCategory
12
12
  include Decidim::HasReference
13
13
  include Decidim::Comments::Commentable
@@ -16,9 +16,12 @@ module Decidim
16
16
  include Decidim::DataPortability
17
17
  include Decidim::Randomable
18
18
  include Decidim::Searchable
19
+ include Decidim::TranslatableResource
19
20
 
20
21
  component_manifest_name "accountability"
21
22
 
23
+ translatable_fields :title, :description
24
+
22
25
  has_many :children, foreign_key: "parent_id", class_name: "Decidim::Accountability::Result", inverse_of: :parent, dependent: :destroy
23
26
  belongs_to :parent, foreign_key: "parent_id", class_name: "Decidim::Accountability::Result", inverse_of: :children, optional: true, counter_cache: :children_count
24
27
 
@@ -6,9 +6,12 @@ module Decidim
6
6
  # key, a localized name, a localized description and and associated progress number.
7
7
  class Status < Accountability::ApplicationRecord
8
8
  include Decidim::HasComponent
9
+ include Decidim::TranslatableResource
9
10
 
10
11
  component_manifest_name "accountability"
11
12
 
13
+ translatable_fields :name, :description
14
+
12
15
  has_many :results, foreign_key: "decidim_accountability_status_id", class_name: "Decidim::Accountability::Result", inverse_of: :status, dependent: :nullify
13
16
 
14
17
  validates :key, presence: true, uniqueness: { scope: :decidim_component_id }
@@ -5,6 +5,9 @@ module Decidim
5
5
  # The data store for a TimelineEntry for a Result in the Decidim::Accountability component.
6
6
  # It stores a date, and localized description.
7
7
  class TimelineEntry < Accountability::ApplicationRecord
8
+ include Decidim::TranslatableResource
9
+
10
+ translatable_fields :description
8
11
  belongs_to :result, foreign_key: "decidim_accountability_result_id", class_name: "Decidim::Accountability::Result", inverse_of: :timeline_entries
9
12
  end
10
13
  end
@@ -6,6 +6,8 @@ module Decidim
6
6
  # `current_component` param with a `Decidim::Component` in order to
7
7
  # find the results.
8
8
  class ResultSearch < ResourceSearch
9
+ text_search_fields :title, :description
10
+
9
11
  # Public: Initializes the service.
10
12
  #
11
13
  # options - A hash of options to modify the search. These options will be
@@ -24,13 +26,6 @@ module Decidim
24
26
  super(Result.all, options)
25
27
  end
26
28
 
27
- # Handle the search_text filter
28
- def search_search_text
29
- query
30
- .where(localized_search_text_in(:title), text: "%#{search_text}%")
31
- .or(query.where(localized_search_text_in(:description), text: "%#{search_text}%"))
32
- end
33
-
34
29
  # Handle parent_id filter
35
30
  def search_parent_id
36
31
  parent_id = options[:parent_id]
@@ -48,19 +43,6 @@ module Decidim
48
43
  def children_ids(parent_id)
49
44
  Result.where(parent_id: parent_id).pluck(:id)
50
45
  end
51
-
52
- # Internal: builds the needed query to search for a text in the organization's
53
- # available locales. Note that it is intended to be used as follows:
54
- #
55
- # Example:
56
- # Resource.where(localized_search_text_for(:title, text: "my_query"))
57
- #
58
- # The Hash with the `:text` key is required or it won't work.
59
- def localized_search_text_in(field)
60
- options[:organization].available_locales.map do |l|
61
- "#{field} ->> '#{l}' ILIKE :text"
62
- end.join(" OR ")
63
- end
64
46
  end
65
47
  end
66
48
  end
@@ -20,7 +20,7 @@ module Decidim
20
20
  end
21
21
 
22
22
  def comments_count
23
- Decidim::Comments::Comment.where(commentable: proposals.to_a).count
23
+ proposals.sum(:comments_count)
24
24
  end
25
25
 
26
26
  def attendees_count
@@ -20,9 +20,9 @@
20
20
 
21
21
  <% else %>
22
22
 
23
- <% if current_participatory_space.has_subscopes? %>
23
+ <% if current_component.has_subscopes? %>
24
24
  <div class="row column">
25
- <%= scopes_picker_field form, :decidim_scope_id %>
25
+ <%= scopes_picker_field form, :decidim_scope_id, root: current_component.scope %>
26
26
  </div>
27
27
  <% end %>
28
28
 
@@ -18,6 +18,7 @@
18
18
  <thead>
19
19
  <tr>
20
20
  <th><%= t("models.result.fields.title", scope: "decidim.accountability") %></th>
21
+ <%= th_resource_scope_label %>
21
22
  <th class="actions"><%= t("actions.title", scope: "decidim.accountability") %></th>
22
23
  </tr>
23
24
  </thead>
@@ -27,6 +28,7 @@
27
28
  <td>
28
29
  <%= link_to translated_attribute(result.title), results_path(parent_id: result.id) %><br>
29
30
  </td>
31
+ <%= td_resource_scope_for(result.scope) %>
30
32
  <td class="table-list__actions">
31
33
  <%= icon_link_to "eye", resource_locator(result).path, t("actions.preview", scope: "decidim.accountability"), class: "action-icon--preview", target: :blank %>
32
34
 
@@ -1,5 +1,5 @@
1
1
  <div class="scope-filters section">
2
- <% if current_participatory_space.has_subscopes? %>
2
+ <% if current_component.has_subscopes? %>
3
3
  <div><%= t("results.filters.scopes", scope: "decidim.accountability") %></div>
4
4
 
5
5
  <ul class="tags tags--action">
@@ -76,5 +76,4 @@
76
76
 
77
77
  <%= resource_reference(result) %>
78
78
  <%= render partial: "decidim/shared/share_modal" %>
79
- <%= embed_modal_for result_result_widget_url(result, format: :js) %>
80
79
  </div>
@@ -0,0 +1 @@
1
+ am:
@@ -0,0 +1,226 @@
1
+ bg:
2
+ activemodel:
3
+ attributes:
4
+ result:
5
+ decidim_accountability_status_id: Статус
6
+ decidim_category_id: Категория
7
+ decidim_scope_id: Сфера
8
+ description: Описание
9
+ end_date: Крайна дата
10
+ progress: Напредък
11
+ project_ids: Включени проекти
12
+ proposals: Включени предложения
13
+ start_date: Начална дата
14
+ title: Заглавие
15
+ updated_at: Обновен на
16
+ status:
17
+ description: Описание
18
+ key: Ключ
19
+ name: Име
20
+ progress: Напредък
21
+ timeline_entry:
22
+ description: Описание
23
+ entry_date: Дата
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Предложение, включено в резултата
26
+ decidim/accountability/result_progress_updated_event: Напредъкът на резултатите е актуализиран
27
+ activerecord:
28
+ models:
29
+ decidim/accountability/result:
30
+ one: Резултат
31
+ other: Резултати
32
+ decidim:
33
+ accountability:
34
+ actions:
35
+ confirm_destroy: Сигурни ли сте, че искате да изтриете това %{name}?
36
+ destroy: Изтрий
37
+ edit: Редактирай
38
+ import_csv: Импорт CVS
39
+ new: Ново %{name}
40
+ preview: Преглед
41
+ timeline_entries: Развитие на проекта
42
+ title: Действия
43
+ admin:
44
+ exports:
45
+ results: Резултати
46
+ import_results:
47
+ new:
48
+ import: Внасяне
49
+ info: "<p>Препоръчваме ви да изпълните следните стъпки:</p><ol><li>Създайте статусите на резултатите, които искате да добавите (<a href='%{link_new_status}' target='_blank'>връзка</a>)</li><li>Създайте поне един Резултат ръчно чрез администраторския панел (<a href='%{link_new_result}' target='_blank'>връзка</a>), преди да използвате Импортиране, за с по-добро разбиране на формата и това, което ще трябва да попълните.</li><li>Изтеглете експортиране с CSV формат (%{link_export_csv})</li><li> Направете промените локално. Можете да промените само следните колони от CSV:</li></ol><ul><li><b>категория/id:</b> ID за категорията</li><li><b>обхват/id:</b>ИД за обхвата</li><li><b> родител / id: </b> ID на родителя (за свързани резултати). Незадължително </li><li><b>заглавие/I18N:</b>Заглавие на езика X</li><li><b>описание/I18N </b>Описание на X език</li>< li><b>начало_дата:</b>дата, когато резултатът стартира изпълнението (формат ГГГГ-ММ-DD)</li><li><b>край_ дата:</b>дата, когато резултатът приключи изпълнението (формат ГГГГ-MM-DD)</li><li><b>status/id:</b>ID на състоянието за този резултат</li><li><b>прогрес:</b>Процент (от 0 до 100) на изпълнението</li><li><b>offers_ids:</b>вътрешен ID на свързаните предложения (разделени със запетая). Той автоматично се преобразува в <span class='attribute-name'>предложение_url</span></li></ul>"
50
+ link: връзка
51
+ title: Импортирай резултати от CSV
52
+ imports:
53
+ create:
54
+ success: Файлът започна да се импортира. В следващите минути ще получите ел. поща с резултата от импортирането
55
+ models:
56
+ result:
57
+ name: Резултат
58
+ status:
59
+ name: Статус
60
+ timeline_entry:
61
+ name: Запис във времевата линия
62
+ results:
63
+ create:
64
+ invalid: Възникна проблем при създаване на резултата
65
+ success: Резултата е създаден успешно
66
+ destroy:
67
+ success: Резултата е изтрит успешно
68
+ edit:
69
+ title: Редактирай резултат
70
+ update: Обнови резултат
71
+ index:
72
+ title: Резултати
73
+ new:
74
+ create: Създай резултат
75
+ title: Нови резултати
76
+ update:
77
+ invalid: Възникна проблем при обновяването на резултата
78
+ success: Резултата е обновен успешно
79
+ shared:
80
+ subnav:
81
+ statuses: Статуси
82
+ statuses:
83
+ create:
84
+ invalid: Възникна проблем при създаване на статуса
85
+ success: Статуса е създаден успешно
86
+ destroy:
87
+ success: Статуса е изтрит успешно
88
+ edit:
89
+ title: Редактирай на статуса
90
+ update: Обнови на статус
91
+ index:
92
+ title: Статуси
93
+ new:
94
+ create: Създай статус
95
+ title: Нов статус
96
+ update:
97
+ invalid: Възникна проблем при обновяване на статуса
98
+ success: Статуса е обновен успешно
99
+ timeline_entries:
100
+ create:
101
+ invalid: Възникна проблем при създаване на записа
102
+ success: Записа е създаден успешно
103
+ destroy:
104
+ success: Записа е изтрит успешно
105
+ edit:
106
+ title: Редактирай на запис
107
+ update: Обнови на запис
108
+ index:
109
+ title: Запис във времевата линия
110
+ new:
111
+ create: Създай запис
112
+ title: Нов запис
113
+ update:
114
+ invalid: Възникна проблем при обновяване на записа
115
+ success: Записа е обновен успешно
116
+ admin_log:
117
+ result:
118
+ create: "%{user_name} създаде резултата %{resource_name} в %{space_name}"
119
+ delete: "%{user_name} изтри резултата %{resource_name} в %{space_name}"
120
+ update: "%{user_name} обнови резултата %{resource_name} в %{space_name}"
121
+ value_types:
122
+ parent_presenter:
123
+ not_found: 'Родителя липсва в базата данни (ID: %{id})'
124
+ import_mailer:
125
+ import:
126
+ errors: Грешки
127
+ errors_present: Възникна проблем при внасяне на резултата
128
+ row_number: Редове
129
+ subject: Успешно внасяне на резултати
130
+ success: Успешно внасяне на резултати. Може да ги прегледате в администраторския интерфейс.
131
+ last_activity:
132
+ new_result_at_html: "<span>Нов резултат в %{link}</span>"
133
+ models:
134
+ result:
135
+ fields:
136
+ end_date: Крайна дата
137
+ progress: Напредък
138
+ start_date: Начална дата
139
+ status: Статус
140
+ title: Заглавие
141
+ status:
142
+ fields:
143
+ description: Описание
144
+ key: Ключ
145
+ name: Име
146
+ progress: Напредък
147
+ timeline_entry:
148
+ fields:
149
+ description: Описание
150
+ entry_date: Дата
151
+ results:
152
+ count:
153
+ results_count:
154
+ one: 1 резултат
155
+ other: "%{count} резултата"
156
+ filters:
157
+ all: Всички
158
+ scopes: Сфери
159
+ home:
160
+ categories_label: Категории
161
+ subcategories_label: Подкатегории
162
+ home_header:
163
+ global_status: Общо състояние на изпълнение
164
+ nav_breadcrumb:
165
+ global: Общо изпълнение
166
+ search:
167
+ search: Търсене на действия
168
+ show:
169
+ stats:
170
+ attendees: Присъстващи
171
+ back_to_resource: Върни се към резултата
172
+ comments: Коментари
173
+ contributions: Предложения
174
+ last_edited_by: Последна промяна на
175
+ last_updated_at: Последно обновен на
176
+ meetings: Срещи
177
+ proposals: Предложения
178
+ votes: Поддръжки
179
+ timeline:
180
+ title: Развитие на проекта
181
+ components:
182
+ accountability:
183
+ name: Отговорност
184
+ settings:
185
+ global:
186
+ categories_label: Име за "категории"
187
+ comments_enabled: Коментарите са разрешени
188
+ comments_max_length: Максимална дължина на коментарите (Оставете 0 за стойност по подразбиране)
189
+ display_progress_enabled: Показвай развитието
190
+ heading_leaf_level_results: Име за "Проекти"
191
+ heading_parent_level_results: Име за "Резултати"
192
+ intro: Въведение
193
+ scope_id: Сфера
194
+ scopes_enabled: Сферите са разрешени
195
+ subcategories_label: Име за "подкатегории"
196
+ step:
197
+ comments_blocked: Коментарите са блокирани
198
+ events:
199
+ accountability:
200
+ proposal_linked:
201
+ email_intro: 'Предложението "%{proposal_title}" е включено в резултата. Можете да го видите на страницата:'
202
+ email_outro: Получавате това известие, защото следвате "%{proposal_title}". Може да прекратите известията чрез предната връзка.
203
+ email_subject: Обновление в %{proposal_title}
204
+ notification_title: Предложението <a href="%{proposal_path}">%{proposal_title}</a> е включено в резултата <a href="%{resource_path}">%{resource_title}</a>.
205
+ result_progress_updated:
206
+ email_intro: 'Резултата "%{resource_title}", който включва предложението "%{proposal_title}", е завършен на %{progress}%. Можете да го видите на тази страница:'
207
+ email_outro: Получавате това известие, защото следвате "%{proposal_title}" и това предложение е включено в резултата %{resource_title}. Може да прекратите известията чрез предната връзка.
208
+ email_subject: Напредък в обновлението на %{resource_title}
209
+ notification_title: Резултатът <a href="%{resource_path}">%{resource_title}</a>, който включва предложението <a href="%{proposal_path}">%{proposal_title}</a>, е завършен %{progress}%.
210
+ metrics:
211
+ results:
212
+ description: Брой генерирани резултати
213
+ object: резултати
214
+ title: Резултати
215
+ participatory_processes:
216
+ participatory_process_groups:
217
+ highlighted_results:
218
+ results: Резултати
219
+ participatory_spaces:
220
+ highlighted_results:
221
+ see_all: Виж всички резултати (%{count})
222
+ resource_links:
223
+ included_projects:
224
+ result_project: Проекти, включени в резултата
225
+ included_proposals:
226
+ result_proposal: Предложения, включени в резултата