decidim-accountability 0.28.6 → 0.29.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.
- checksums.yaml +4 -4
- data/app/cells/decidim/accountability/highlighted_results_for_component_cell.rb +0 -3
- data/app/cells/decidim/accountability/project_cell.rb +1 -6
- data/app/cells/decidim/accountability/result_l_cell.rb +1 -2
- data/app/cells/decidim/accountability/result_metadata_cell.rb +0 -6
- data/app/cells/decidim/accountability/results_cell.rb +0 -2
- data/app/cells/decidim/accountability/status_cell.rb +11 -8
- data/app/commands/decidim/accountability/admin/create_imported_result.rb +18 -85
- data/app/commands/decidim/accountability/admin/create_result.rb +12 -86
- data/app/commands/decidim/accountability/admin/create_status.rb +3 -31
- data/app/commands/decidim/accountability/admin/create_timeline_entry.rb +3 -30
- data/app/commands/decidim/accountability/admin/has_result_command.rb +54 -0
- data/app/commands/decidim/accountability/admin/update_imported_result.rb +16 -70
- data/app/commands/decidim/accountability/admin/update_result.rb +10 -72
- data/app/commands/decidim/accountability/admin/update_status.rb +3 -39
- data/app/commands/decidim/accountability/admin/update_timeline_entry.rb +3 -38
- data/app/controllers/decidim/accountability/admin/results_controller.rb +1 -1
- data/app/controllers/decidim/accountability/admin/statuses_controller.rb +7 -8
- data/app/controllers/decidim/accountability/admin/timeline_entries_controller.rb +8 -8
- data/app/controllers/decidim/accountability/results_controller.rb +1 -21
- data/app/forms/decidim/accountability/admin/result_form.rb +1 -1
- data/app/forms/decidim/accountability/admin/timeline_entry_form.rb +1 -1
- data/app/helpers/decidim/accountability/application_helper.rb +0 -34
- data/app/helpers/decidim/accountability/breadcrumb_helper.rb +0 -4
- data/app/mailers/decidim/accountability/import_projects_mailer.rb +0 -3
- data/app/models/decidim/accountability/result.rb +1 -1
- data/app/models/decidim/accountability/status.rb +1 -1
- data/app/packs/src/decidim/accountability/index.js +1 -1
- data/app/services/decidim/accountability/results_csv_importer.rb +1 -1
- data/app/views/decidim/accountability/admin/results/index.html.erb +7 -15
- data/app/views/decidim/accountability/admin/statuses/index.html.erb +2 -2
- data/app/views/decidim/accountability/admin/timeline_entries/index.html.erb +1 -1
- data/app/views/decidim/accountability/import_projects_mailer/import.html.erb +1 -1
- data/app/views/decidim/accountability/results/_home_categories.html.erb +2 -2
- data/app/views/decidim/accountability/results/_nav_breadcrumb.html.erb +8 -8
- data/app/views/decidim/accountability/results/_project.html.erb +1 -1
- data/app/views/decidim/accountability/results/_scope_filters.html.erb +3 -3
- data/app/views/decidim/participatory_spaces/_result.html.erb +3 -3
- data/config/locales/ar.yml +13 -90
- data/config/locales/bg.yml +10 -15
- data/config/locales/ca.yml +0 -12
- data/config/locales/cs.yml +0 -13
- data/config/locales/da.yml +4 -27
- data/config/locales/de.yml +3 -15
- data/config/locales/el.yml +8 -12
- data/config/locales/en.yml +0 -12
- data/config/locales/es-MX.yml +0 -12
- data/config/locales/es-PY.yml +0 -12
- data/config/locales/es.yml +0 -12
- data/config/locales/eu.yml +34 -46
- data/config/locales/fi-plain.yml +4 -16
- data/config/locales/fi.yml +15 -27
- data/config/locales/fr-CA.yml +8 -21
- data/config/locales/fr.yml +5 -18
- data/config/locales/ga-IE.yml +3 -11
- data/config/locales/gl.yml +6 -18
- data/config/locales/gn-PY.yml +0 -11
- data/config/locales/he-IL.yml +8 -14
- data/config/locales/hu.yml +11 -16
- data/config/locales/id-ID.yml +3 -21
- data/config/locales/is-IS.yml +6 -18
- data/config/locales/it.yml +3 -72
- data/config/locales/ja.yml +1 -13
- data/config/locales/kaa.yml +2 -2
- data/config/locales/ko.yml +6 -12
- data/config/locales/lb.yml +7 -19
- data/config/locales/lt.yml +10 -12
- data/config/locales/lv.yml +3 -24
- data/config/locales/nl.yml +3 -15
- data/config/locales/no.yml +3 -15
- data/config/locales/pl.yml +9 -12
- data/config/locales/pt-BR.yml +10 -16
- data/config/locales/pt.yml +0 -18
- data/config/locales/ro-RO.yml +16 -22
- data/config/locales/ru.yml +4 -22
- data/config/locales/si-LK.yml +0 -19
- data/config/locales/sk.yml +3 -24
- data/config/locales/sl.yml +3 -17
- data/config/locales/sq-AL.yml +7 -12
- data/config/locales/sr-CS.yml +3 -21
- data/config/locales/sv.yml +29 -80
- data/config/locales/th-TH.yml +6 -6
- data/config/locales/tr-TR.yml +6 -19
- data/config/locales/uk.yml +3 -24
- data/config/locales/zh-CN.yml +3 -23
- data/config/locales/zh-TW.yml +7 -12
- data/decidim-accountability.gemspec +2 -2
- data/lib/decidim/accountability/component.rb +0 -4
- data/lib/decidim/accountability/seeds.rb +76 -67
- data/lib/decidim/accountability/test/factories.rb +0 -4
- data/lib/decidim/accountability/version.rb +1 -1
- data/lib/decidim/api/accountability_type.rb +3 -1
- data/lib/decidim/api/result_type.rb +1 -1
- metadata +26 -31
- data/app/commands/decidim/accountability/admin/destroy_result.rb +0 -43
- data/app/services/decidim/accountability/result_stats_calculator.rb +0 -49
- data/app/views/decidim/accountability/results/_stats_box.html.erb +0 -79
- data/config/locales/bn-BD.yml +0 -1
- data/config/locales/bs-BA.yml +0 -175
- data/config/locales/ca-IT.yml +0 -304
@@ -5,83 +5,21 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user changes a Result from the admin
|
7
7
|
# panel.
|
8
|
-
class UpdateResult < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - The form from which to get the data.
|
12
|
-
# result - The current instance of the result to be updated.
|
13
|
-
def initialize(form, result)
|
14
|
-
@form = form
|
15
|
-
@result = result
|
16
|
-
end
|
17
|
-
|
18
|
-
# Updates the result if valid.
|
19
|
-
#
|
20
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
21
|
-
def call
|
22
|
-
return broadcast(:invalid) if form.invalid?
|
8
|
+
class UpdateResult < Decidim::Commands::UpdateResource
|
9
|
+
include Decidim::Accountability::Admin::HasResultCommand
|
23
10
|
|
24
|
-
|
25
|
-
|
26
|
-
link_proposals
|
27
|
-
link_meetings
|
28
|
-
link_projects
|
29
|
-
send_notifications if should_notify_followers?
|
30
|
-
end
|
31
|
-
|
32
|
-
broadcast(:ok)
|
33
|
-
end
|
11
|
+
fetch_form_attributes :scope, :category, :parent_id, :title, :description, :start_date, :end_date,
|
12
|
+
:progress, :decidim_accountability_status_id, :external_id, :weight
|
34
13
|
|
35
14
|
private
|
36
15
|
|
37
|
-
|
38
|
-
|
39
|
-
def update_result
|
40
|
-
Decidim.traceability.update!(
|
41
|
-
result,
|
42
|
-
form.current_user,
|
43
|
-
scope: @form.scope,
|
44
|
-
category: @form.category,
|
45
|
-
parent_id: @form.parent_id,
|
46
|
-
title: @form.title,
|
47
|
-
description: @form.description,
|
48
|
-
start_date: @form.start_date,
|
49
|
-
end_date: @form.end_date,
|
50
|
-
progress: @form.progress,
|
51
|
-
decidim_accountability_status_id: @form.decidim_accountability_status_id,
|
52
|
-
external_id: @form.external_id.presence,
|
53
|
-
weight: @form.weight
|
54
|
-
)
|
55
|
-
end
|
56
|
-
|
57
|
-
def proposals
|
58
|
-
@proposals ||= result.sibling_scope(:proposals).where(id: form.proposal_ids)
|
59
|
-
end
|
60
|
-
|
61
|
-
def projects
|
62
|
-
@projects ||= result.sibling_scope(:projects).where(id: form.project_ids)
|
63
|
-
end
|
64
|
-
|
65
|
-
def meeting_ids
|
66
|
-
@meeting_ids ||= proposals.flat_map do |proposal|
|
67
|
-
proposal.linked_resources(:meetings, "proposals_from_meeting").pluck(:id)
|
68
|
-
end.uniq
|
69
|
-
end
|
70
|
-
|
71
|
-
def meetings
|
72
|
-
@meetings ||= result.sibling_scope(:meetings).where(id: meeting_ids)
|
73
|
-
end
|
74
|
-
|
75
|
-
def link_proposals
|
76
|
-
result.link_resources(proposals, "included_proposals")
|
77
|
-
end
|
78
|
-
|
79
|
-
def link_projects
|
80
|
-
result.link_resources(projects, "included_projects")
|
81
|
-
end
|
16
|
+
alias result resource
|
82
17
|
|
83
|
-
def
|
84
|
-
|
18
|
+
def run_after_hooks
|
19
|
+
link_proposals
|
20
|
+
link_meetings
|
21
|
+
link_projects
|
22
|
+
send_notifications if should_notify_followers?
|
85
23
|
end
|
86
24
|
|
87
25
|
def send_notifications
|
@@ -3,46 +3,10 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
module Admin
|
6
|
-
# This command is executed when the user changes a
|
6
|
+
# This command is executed when the user changes a Status from the admin
|
7
7
|
# panel.
|
8
|
-
class UpdateStatus < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - The form from which to get the data.
|
12
|
-
# status - The current instance of the status to be updated.
|
13
|
-
def initialize(form, status, user)
|
14
|
-
@form = form
|
15
|
-
@status = status
|
16
|
-
@user = user
|
17
|
-
end
|
18
|
-
|
19
|
-
# Updates the status if valid.
|
20
|
-
#
|
21
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
22
|
-
def call
|
23
|
-
return broadcast(:invalid) if form.invalid?
|
24
|
-
|
25
|
-
transaction do
|
26
|
-
update_status
|
27
|
-
end
|
28
|
-
|
29
|
-
broadcast(:ok)
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
attr_reader :status, :form
|
35
|
-
|
36
|
-
def update_status
|
37
|
-
Decidim.traceability.update!(
|
38
|
-
status,
|
39
|
-
@user,
|
40
|
-
key: @form.key,
|
41
|
-
name: @form.name,
|
42
|
-
description: @form.description,
|
43
|
-
progress: @form.progress
|
44
|
-
)
|
45
|
-
end
|
8
|
+
class UpdateStatus < Decidim::Commands::UpdateResource
|
9
|
+
fetch_form_attributes :key, :name, :description, :progress
|
46
10
|
end
|
47
11
|
end
|
48
12
|
end
|
@@ -3,45 +3,10 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
module Admin
|
6
|
-
# This command is executed when the user changes a
|
6
|
+
# This command is executed when the user changes a TimelineEntry from the admin
|
7
7
|
# panel.
|
8
|
-
class UpdateTimelineEntry < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - The form from which to get the data.
|
12
|
-
# timeline_entry - The current instance of the timeline_entry to be updated.
|
13
|
-
def initialize(form, timeline_entry, user)
|
14
|
-
@form = form
|
15
|
-
@timeline_entry = timeline_entry
|
16
|
-
@user = user
|
17
|
-
end
|
18
|
-
|
19
|
-
# Updates the timeline_entry if valid.
|
20
|
-
#
|
21
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
22
|
-
def call
|
23
|
-
return broadcast(:invalid) if form.invalid?
|
24
|
-
|
25
|
-
transaction do
|
26
|
-
update_timeline_entry
|
27
|
-
end
|
28
|
-
|
29
|
-
broadcast(:ok)
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
attr_reader :timeline_entry, :form
|
35
|
-
|
36
|
-
def update_timeline_entry
|
37
|
-
Decidim.traceability.update!(
|
38
|
-
timeline_entry,
|
39
|
-
@user,
|
40
|
-
entry_date: form.entry_date,
|
41
|
-
title: form.title,
|
42
|
-
description: form.description
|
43
|
-
)
|
44
|
-
end
|
8
|
+
class UpdateTimelineEntry < Decidim::Commands::UpdateResource
|
9
|
+
fetch_form_attributes :entry_date, :title, :description
|
45
10
|
end
|
46
11
|
end
|
47
12
|
end
|
@@ -68,7 +68,7 @@ module Decidim
|
|
68
68
|
def destroy
|
69
69
|
enforce_permission_to(:destroy, :result, result:)
|
70
70
|
|
71
|
-
|
71
|
+
Decidim::Commands::DestroyResource.call(result, current_user) do
|
72
72
|
on(:ok) do
|
73
73
|
flash[:notice] = I18n.t("results.destroy.success", scope: "decidim.accountability.admin")
|
74
74
|
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
|
19
19
|
@form = form(StatusForm).from_params(params)
|
20
20
|
|
21
|
-
CreateStatus.call(@form
|
21
|
+
CreateStatus.call(@form) do
|
22
22
|
on(:ok) do
|
23
23
|
flash[:notice] = I18n.t("statuses.create.success", scope: "decidim.accountability.admin")
|
24
24
|
redirect_to statuses_path
|
@@ -42,7 +42,7 @@ module Decidim
|
|
42
42
|
|
43
43
|
@form = form(StatusForm).from_params(params)
|
44
44
|
|
45
|
-
UpdateStatus.call(@form, status
|
45
|
+
UpdateStatus.call(@form, status) do
|
46
46
|
on(:ok) do
|
47
47
|
flash[:notice] = I18n.t("statuses.update.success", scope: "decidim.accountability.admin")
|
48
48
|
redirect_to statuses_path
|
@@ -58,13 +58,12 @@ module Decidim
|
|
58
58
|
def destroy
|
59
59
|
enforce_permission_to(:destroy, :status, status:)
|
60
60
|
|
61
|
-
Decidim.
|
62
|
-
|
61
|
+
Decidim::Commands::DestroyResource.call(status, current_user) do
|
62
|
+
on(:ok) do
|
63
|
+
flash[:notice] = I18n.t("statuses.destroy.success", scope: "decidim.accountability.admin")
|
64
|
+
redirect_to statuses_path
|
65
|
+
end
|
63
66
|
end
|
64
|
-
|
65
|
-
flash[:notice] = I18n.t("statuses.destroy.success", scope: "decidim.accountability.admin")
|
66
|
-
|
67
|
-
redirect_to statuses_path
|
68
67
|
end
|
69
68
|
|
70
69
|
private
|
@@ -19,7 +19,7 @@ module Decidim
|
|
19
19
|
@form = form(TimelineEntryForm).from_params(params)
|
20
20
|
@form.decidim_accountability_result_id = params[:result_id]
|
21
21
|
|
22
|
-
CreateTimelineEntry.call(@form
|
22
|
+
CreateTimelineEntry.call(@form) do
|
23
23
|
on(:ok) do
|
24
24
|
flash[:notice] = I18n.t("timeline_entries.create.success", scope: "decidim.accountability.admin")
|
25
25
|
redirect_to result_timeline_entries_path(params[:result_id])
|
@@ -43,7 +43,7 @@ module Decidim
|
|
43
43
|
|
44
44
|
@form = form(TimelineEntryForm).from_params(params)
|
45
45
|
|
46
|
-
UpdateTimelineEntry.call(@form, timeline_entry
|
46
|
+
UpdateTimelineEntry.call(@form, timeline_entry) do
|
47
47
|
on(:ok) do
|
48
48
|
flash[:notice] = I18n.t("timeline_entries.update.success", scope: "decidim.accountability.admin")
|
49
49
|
redirect_to result_timeline_entries_path(params[:result_id])
|
@@ -59,13 +59,13 @@ module Decidim
|
|
59
59
|
def destroy
|
60
60
|
enforce_permission_to(:destroy, :timeline_entry, timeline_entry:)
|
61
61
|
|
62
|
-
Decidim.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
flash[:notice] = I18n.t("timeline_entries.destroy.success", scope: "decidim.accountability.admin")
|
62
|
+
Decidim::Commands::DestroyResource.call(timeline_entry, current_user) do
|
63
|
+
on(:ok) do
|
64
|
+
flash[:notice] = I18n.t("timeline_entries.destroy.success", scope: "decidim.accountability.admin")
|
67
65
|
|
68
|
-
|
66
|
+
redirect_to result_timeline_entries_path(params[:result_id])
|
67
|
+
end
|
68
|
+
end
|
69
69
|
end
|
70
70
|
|
71
71
|
private
|
@@ -5,12 +5,10 @@ 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
|
-
|
10
8
|
helper Decidim::TraceabilityHelper
|
11
9
|
helper Decidim::Accountability::BreadcrumbHelper
|
12
10
|
|
13
|
-
helper_method :results, :result, :first_class_categories, :count_calculator
|
11
|
+
helper_method :results, :result, :first_class_categories, :count_calculator
|
14
12
|
|
15
13
|
before_action :set_controller_breadcrumb
|
16
14
|
|
@@ -33,24 +31,6 @@ module Decidim
|
|
33
31
|
@result ||= search_collection.includes(:timeline_entries).find_by(id: params[:id])
|
34
32
|
end
|
35
33
|
|
36
|
-
def next_result
|
37
|
-
return if search_collection.size < 2
|
38
|
-
|
39
|
-
search_collection.order(:start_date, :id).where(Decidim::Accountability::Result.arel_table[:id].gt(result.id)).first
|
40
|
-
end
|
41
|
-
|
42
|
-
def prev_result
|
43
|
-
return if search_collection.size < 2
|
44
|
-
|
45
|
-
search_collection.order(:start_date, :id).where(Decidim::Accountability::Result.arel_table[:id].lt(result.id)).last
|
46
|
-
end
|
47
|
-
|
48
|
-
def nav_paths
|
49
|
-
return {} if result.blank?
|
50
|
-
|
51
|
-
{ prev_path: prev_result, next_path: next_result }.compact_blank.transform_values { |result| result_path(result) }
|
52
|
-
end
|
53
|
-
|
54
34
|
def search_collection
|
55
35
|
Result.where(component: current_component)
|
56
36
|
end
|
@@ -9,7 +9,7 @@ module Decidim
|
|
9
9
|
include TranslationsHelper
|
10
10
|
|
11
11
|
translatable_attribute :title, String
|
12
|
-
translatable_attribute :description,
|
12
|
+
translatable_attribute :description, String
|
13
13
|
|
14
14
|
attribute :decidim_scope_id, Integer
|
15
15
|
attribute :decidim_category_id, Integer
|
@@ -11,7 +11,7 @@ module Decidim
|
|
11
11
|
attribute :decidim_accountability_result_id, Integer
|
12
12
|
attribute :entry_date, Decidim::Attributes::LocalizedDate
|
13
13
|
translatable_attribute :title, String
|
14
|
-
translatable_attribute :description,
|
14
|
+
translatable_attribute :description, String
|
15
15
|
|
16
16
|
validates :entry_date, presence: true
|
17
17
|
validates :title, translatable_presence: true
|
@@ -14,44 +14,10 @@ module Decidim
|
|
14
14
|
number_to_percentage(number, precision: 1, strip_insignificant_zeros: true, locale: I18n.locale)
|
15
15
|
end
|
16
16
|
|
17
|
-
def display_count(count)
|
18
|
-
heading_parent_level_results(count)
|
19
|
-
end
|
20
|
-
|
21
|
-
def active_class_if_current(scope)
|
22
|
-
"class=active" if scope.to_s == current_scope.to_s
|
23
|
-
end
|
24
|
-
|
25
17
|
def component_name
|
26
18
|
(defined?(current_component) && translated_attribute(current_component&.name).presence) || t("decidim.components.accountability.name")
|
27
19
|
end
|
28
20
|
|
29
|
-
def categories_label
|
30
|
-
translated_attribute(component_settings.categories_label).presence || t("results.home.categories_label", scope: "decidim.accountability")
|
31
|
-
end
|
32
|
-
|
33
|
-
def subcategories_label
|
34
|
-
translated_attribute(component_settings.subcategories_label).presence || t("results.home.subcategories_label", scope: "decidim.accountability")
|
35
|
-
end
|
36
|
-
|
37
|
-
def heading_parent_level_results(count)
|
38
|
-
text = translated_attribute(component_settings.heading_parent_level_results).presence
|
39
|
-
if text
|
40
|
-
pluralize(count, text)
|
41
|
-
else
|
42
|
-
t("results.count.results_count", scope: "decidim.accountability", count:)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def heading_leaf_level_results(count)
|
47
|
-
text = translated_attribute(component_settings.heading_leaf_level_results).presence
|
48
|
-
if text
|
49
|
-
pluralize(count, text)
|
50
|
-
else
|
51
|
-
t("results.count.results_count", scope: "decidim.accountability", count:)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
21
|
def filter_items_for(participatory_space:, category:)
|
56
22
|
[
|
57
23
|
{
|
@@ -5,10 +5,6 @@ module Decidim
|
|
5
5
|
# Helpers needed to render the navigation breadcrumbs in results.
|
6
6
|
#
|
7
7
|
module BreadcrumbHelper
|
8
|
-
def stats_calculator
|
9
|
-
@stats_calculator ||= ResultStatsCalculator.new(result)
|
10
|
-
end
|
11
|
-
|
12
8
|
def current_scope
|
13
9
|
params[:filter][:with_scope] if params[:filter]
|
14
10
|
end
|
@@ -5,9 +5,6 @@ module Decidim
|
|
5
5
|
# This mailer sends a notification email containing the result of importing
|
6
6
|
# Cprojects to the results.
|
7
7
|
class ImportProjectsMailer < Decidim::ApplicationMailer
|
8
|
-
include Decidim::TranslatableAttributes
|
9
|
-
helper Decidim::TranslationsHelper
|
10
|
-
|
11
8
|
# Public: Sends a notification email with the result of projects import selected projects to Accountability
|
12
9
|
#
|
13
10
|
# user - The user to be notified.
|
@@ -56,7 +56,7 @@ module Decidim
|
|
56
56
|
end
|
57
57
|
|
58
58
|
# Public: There are two ways to update parent's progress:
|
59
|
-
# - using weights, in which case each progress is multiplied by the
|
59
|
+
# - using weights, in which case each progress is multiplied by the weight and them summed
|
60
60
|
# - not using weights, and using the average of progress of each children
|
61
61
|
def update_progress!
|
62
62
|
self.progress = if children_use_weighted_progress?
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
# The data store for a Status in the Decidim::Accountability component. It stores a
|
6
|
-
# key, a localized name, a localized description and
|
6
|
+
# key, a localized name, a localized description and associated progress number.
|
7
7
|
class Status < Accountability::ApplicationRecord
|
8
8
|
include Decidim::HasComponent
|
9
9
|
include Decidim::TranslatableResource
|
@@ -2,7 +2,7 @@ import "diff"
|
|
2
2
|
import "src/decidim/accountability/version_diff"
|
3
3
|
|
4
4
|
$(() => {
|
5
|
-
// Show category list on click when we are on a small
|
5
|
+
// Show category list on click when we are on a small screen
|
6
6
|
if ($(window).width() < 768) {
|
7
7
|
$(".category--section").click((event) => {
|
8
8
|
$(event.currentTarget).next(".category--elements").toggleClass("active");
|
@@ -131,7 +131,7 @@ module Decidim
|
|
131
131
|
Decidim::Accountability::Result.includes(:parent).references(:parent)
|
132
132
|
.where(parents_decidim_accountability_results: { id: nil })
|
133
133
|
.where.not(parent_id: nil).each do |result|
|
134
|
-
|
134
|
+
Decidim::Commands::DestroyResource.call(result, @extra_context[:current_user])
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
@@ -9,20 +9,12 @@
|
|
9
9
|
|
10
10
|
<%= export_dropdowns(query) %>
|
11
11
|
<%= import_dropdown do %>
|
12
|
-
|
13
|
-
<%= link_to new_projects_import_path
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<% end %>
|
19
|
-
<% if allowed_to? :create, :result %>
|
20
|
-
<%= link_to import_results_path do %>
|
21
|
-
<li class="imports--component imports--results">
|
22
|
-
<%= t("actions.import_csv", scope: "decidim.accountability") %>
|
23
|
-
</li>
|
24
|
-
<% end %>
|
25
|
-
<% end %>
|
12
|
+
<li class="imports--component imports--results">
|
13
|
+
<%= link_to t("actions.import", scope: "decidim.accountability", name: t("models.result.name", scope: "decidim.accountability.admin")), new_projects_import_path if allowed_to?(:create, :result) && parent_result.nil? %>
|
14
|
+
</li>
|
15
|
+
<li class="imports--component imports--results">
|
16
|
+
<%= link_to t("actions.import_csv", scope: "decidim.accountability"), import_results_path if allowed_to? :create, :result %>
|
17
|
+
</li>
|
26
18
|
<% end %>
|
27
19
|
<%= render partial: "decidim/accountability/admin/shared/subnav" unless parent_result %>
|
28
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 %>
|
@@ -58,7 +50,7 @@
|
|
58
50
|
<th>
|
59
51
|
<%= sort_link(query, :created_at, t("models.result.fields.created_at", scope: "decidim.accountability") ) %>
|
60
52
|
</th>
|
61
|
-
<th
|
53
|
+
<th><%= t("actions.title", scope: "decidim.accountability") %></th>
|
62
54
|
</tr>
|
63
55
|
</thead>
|
64
56
|
<tbody>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<th><%= t("models.status.fields.name", scope: "decidim.accountability") %></th>
|
15
15
|
<th><%= t("models.status.fields.description", scope: "decidim.accountability") %></th>
|
16
16
|
<th><%= t("models.status.fields.progress", scope: "decidim.accountability") %></th>
|
17
|
-
<th
|
17
|
+
<th><%= t("actions.title", scope: "decidim.accountability") %></th>
|
18
18
|
</tr>
|
19
19
|
</thead>
|
20
20
|
<tbody>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<tr data-id="<%= status.id %>">
|
23
23
|
<td><%= status.key %><br></td>
|
24
24
|
<td><%= translated_attribute(status.name) %></td>
|
25
|
-
<td><%= truncate translated_attribute(status.description),
|
25
|
+
<td><%= truncate translated_attribute(status.description), length: 50 %></td>
|
26
26
|
<td><%= status.progress %></td>
|
27
27
|
<td class="table-list__actions">
|
28
28
|
<% if allowed_to? :update, :status, status: status %>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<tr>
|
17
17
|
<th><%= t("models.timeline_entry.fields.entry_date", scope: "decidim.accountability") %></th>
|
18
18
|
<th><%= t("models.timeline_entry.fields.title", scope: "decidim.accountability") %></th>
|
19
|
-
<th
|
19
|
+
<th><%= t("actions.title", scope: "decidim.accountability") %></th>
|
20
20
|
</tr>
|
21
21
|
</thead>
|
22
22
|
<tbody>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<p><%= t(".success", component_name:
|
1
|
+
<p><%= t(".success", component_name: @component.name["en"]) %></p>
|
2
2
|
<p> <%= t(".added_projects", count: @projects) %></p>
|
@@ -9,12 +9,12 @@
|
|
9
9
|
) %>
|
10
10
|
|
11
11
|
<div>
|
12
|
-
<span class="accountability__grid-title"><%= categories_label %></span>
|
12
|
+
<span class="accountability__grid-title"><%= t("results.home.categories_label", scope: "decidim.accountability") %></span>
|
13
13
|
<%= subelements.call %>
|
14
14
|
</div>
|
15
15
|
|
16
16
|
<div>
|
17
|
-
<span class="accountability__grid-title"><%= subcategories_label %></span>
|
17
|
+
<span class="accountability__grid-title"><%= t("results.home.subcategories_label", scope: "decidim.accountability") %></span>
|
18
18
|
<% if subelements.has_results? %>
|
19
19
|
<div class="accountability__subgrid">
|
20
20
|
<% category.subcategories.each do |subcategory| %>
|
@@ -1,35 +1,35 @@
|
|
1
|
-
<div
|
1
|
+
<div>
|
2
2
|
<%= link_to t(".global"), root_path %>
|
3
3
|
<% if component_settings.display_progress_enabled? %>
|
4
|
-
<span
|
4
|
+
<span><%= display_percentage progress_calculator(current_scope, nil) %></span>
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<% if category.present? && category.parent.present? %>
|
8
|
-
<span
|
8
|
+
<span>></span>
|
9
9
|
<div>
|
10
10
|
<%= link_to translated_attribute(category.parent.name), results_path(filter: { with_category: category.parent_id, with_scope: current_scope }) %>
|
11
11
|
<% if component_settings.display_progress_enabled? %>
|
12
|
-
<span
|
12
|
+
<span><%= display_percentage progress_calculator(current_scope, category.parent_id) %></span>
|
13
13
|
<% end %>
|
14
14
|
</div>
|
15
15
|
<% end %>
|
16
16
|
|
17
17
|
<% if category.present? %>
|
18
|
-
<span
|
18
|
+
<span>></span>
|
19
19
|
<div>
|
20
20
|
<%= link_to translated_attribute(category.name), results_path(filter: { with_category: category.id, with_scope: current_scope }) %>
|
21
21
|
<% if component_settings.display_progress_enabled? %>
|
22
|
-
<span
|
22
|
+
<span><%= display_percentage progress_calculator(current_scope, category.id) %></span>
|
23
23
|
<% end %>
|
24
24
|
</div>
|
25
25
|
<% end %>
|
26
26
|
|
27
27
|
<% if result && result.parent.present? %>
|
28
|
-
<span
|
28
|
+
<span>></span>
|
29
29
|
<div>
|
30
30
|
<%= link_to translated_attribute(result.parent.title), result_path(result.parent, filter: { with_category: current_scope }) %>
|
31
31
|
<% if component_settings.display_progress_enabled? %>
|
32
|
-
<span
|
32
|
+
<span><%= display_percentage result.parent.progress %></span>
|
33
33
|
<% end %>
|
34
34
|
</div>
|
35
35
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render layout: "layouts/decidim/shared/layout_item"
|
1
|
+
<%= render layout: "layouts/decidim/shared/layout_item" do %>
|
2
2
|
<%= cell("decidim/accountability/project", result) %>
|
3
3
|
|
4
4
|
<section class="layout-main__section layout-main__buttons" data-buttons>
|
@@ -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-
|
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,9 +15,9 @@
|
|
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
|
-
<li
|
20
|
+
<li>
|
21
21
|
<%= link_to item[:url], class: "filter#{" is-active" if item[:active]}" do %>
|
22
22
|
<span class="sr-only"><%= item[:sr_text] %></span>
|
23
23
|
<%= icon item[:icon] %>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= translated_attribute(result.title) %>
|
7
7
|
</h4>
|
8
8
|
|
9
|
-
<div
|
9
|
+
<div>
|
10
10
|
<% if result.start_date %>
|
11
11
|
<strong><%= t("models.result.fields.start_date", scope: "decidim.accountability") %></strong>
|
12
12
|
<span><%= l result.start_date, format: :short %></span>
|
@@ -25,8 +25,8 @@
|
|
25
25
|
<% end %>
|
26
26
|
|
27
27
|
<% if result.progress.present? %>
|
28
|
-
<div
|
29
|
-
<span
|
28
|
+
<div>
|
29
|
+
<span><%= display_percentage result.progress %></span>
|
30
30
|
</div>
|
31
31
|
<% end %>
|
32
32
|
</div>
|