decidim-accountability 0.26.0 → 0.27.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/accountability/highlighted_results_for_component_cell.rb +13 -1
- data/app/commands/decidim/accountability/admin/create_imported_result.rb +1 -1
- data/app/commands/decidim/accountability/admin/create_result.rb +1 -1
- data/app/commands/decidim/accountability/admin/create_status.rb +6 -3
- data/app/commands/decidim/accountability/admin/create_timeline_entry.rb +11 -7
- data/app/commands/decidim/accountability/admin/destroy_result.rb +1 -1
- data/app/commands/decidim/accountability/admin/update_imported_result.rb +1 -1
- data/app/commands/decidim/accountability/admin/update_result.rb +1 -1
- data/app/commands/decidim/accountability/admin/update_status.rb +6 -3
- data/app/commands/decidim/accountability/admin/update_timeline_entry.rb +9 -5
- data/app/controllers/decidim/accountability/admin/statuses_controller.rb +5 -3
- data/app/controllers/decidim/accountability/admin/timeline_entries_controller.rb +5 -3
- data/app/controllers/decidim/accountability/results_controller.rb +12 -12
- data/app/forms/decidim/accountability/admin/result_form.rb +2 -2
- data/app/forms/decidim/accountability/admin/timeline_entry_form.rb +2 -1
- data/app/helpers/decidim/accountability/breadcrumb_helper.rb +2 -2
- data/app/models/decidim/accountability/result.rb +9 -5
- data/app/models/decidim/accountability/status.rb +6 -2
- data/app/models/decidim/accountability/timeline_entry.rb +6 -0
- data/app/packs/images/decidim/accountability/{decidim_accountability_icon.svg → decidim_accountability.svg} +0 -0
- data/app/presenters/decidim/accountability/admin_log/status_presenter.rb +38 -0
- data/app/presenters/decidim/accountability/admin_log/timeline_entry_presenter.rb +37 -0
- data/app/services/decidim/accountability/results_calculator.rb +10 -6
- data/app/views/decidim/accountability/admin/timeline_entries/_form.html.erb +5 -1
- data/app/views/decidim/accountability/admin/timeline_entries/index.html.erb +2 -2
- data/app/views/decidim/accountability/results/_home_categories.html.erb +2 -2
- data/app/views/decidim/accountability/results/_nav_breadcrumb.html.erb +3 -3
- data/app/views/decidim/accountability/results/_results_leaf.html.erb +3 -3
- data/app/views/decidim/accountability/results/_results_parent.html.erb +1 -1
- data/app/views/decidim/accountability/results/_scope_filters.html.erb +3 -3
- data/app/views/decidim/accountability/results/_search.html.erb +1 -1
- data/app/views/decidim/accountability/results/_timeline.html.erb +7 -1
- data/app/views/decidim/accountability/results/home.html.erb +3 -1
- data/app/views/decidim/accountability/versions/show.html.erb +3 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +52 -4
- data/config/locales/bg.yml +1 -1
- data/config/locales/ca.yml +11 -1
- data/config/locales/cs.yml +11 -1
- data/config/locales/da.yml +1 -1
- data/config/locales/de.yml +11 -1
- data/config/locales/el.yml +1 -1
- data/config/locales/en.yml +10 -1
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +11 -1
- data/config/locales/es-PY.yml +11 -1
- data/config/locales/es.yml +11 -1
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +1 -1
- data/config/locales/fi-plain.yml +11 -1
- data/config/locales/fi.yml +12 -2
- data/config/locales/fr-CA.yml +11 -1
- data/config/locales/fr.yml +13 -3
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +1 -1
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +3 -1
- data/config/locales/id-ID.yml +1 -1
- data/config/locales/is-IS.yml +2 -2
- data/config/locales/it.yml +1 -1
- data/config/locales/ja.yml +11 -1
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +1 -1
- data/config/locales/lt.yml +263 -0
- data/config/locales/lv.yml +1 -1
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +1 -1
- data/config/locales/no.yml +1 -1
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +11 -1
- data/config/locales/pt-BR.yml +2 -2
- data/config/locales/pt.yml +1 -1
- data/config/locales/ro-RO.yml +1 -1
- data/config/locales/ru.yml +1 -1
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +1 -1
- data/config/locales/sl.yml +1 -1
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +1 -1
- data/config/locales/sv.yml +3 -1
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +1 -1
- data/config/locales/uk.yml +1 -1
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1 -1
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20220331150008_add_title_to_timeline_entries.rb +7 -0
- data/db/migrate/20220331150155_move_legacy_description_to_title_of_timeline_entries.rb +13 -0
- data/lib/decidim/accountability/component.rb +2 -1
- data/lib/decidim/accountability/test/factories.rb +1 -0
- data/lib/decidim/accountability/version.rb +1 -1
- data/lib/decidim/api/timeline_entry_type.rb +1 -0
- metadata +29 -26
- data/app/services/decidim/accountability/result_search.rb +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c075f66ece3b892202c3936512fe378f3badd528a66d50e27c3b05e0139b330
|
4
|
+
data.tar.gz: 888ec8f73f7b72a36167359670cffb1228bfa30c29ed7f35f73213d30db35864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e9e0be0ac5170614d786e784e310c2f30cc1f7e03ff9b3eb16fe1a3911beee160fcdb2f1f39f87dd3ebfda418325a634199b29ef25250bef55afb9ba7e73897
|
7
|
+
data.tar.gz: 07a0e0128905106e8ac06ffeda3b60ae1c820039637cc32011e7524521d6af0340e4a930f9c04f7f065d3ed7b0f1cd75ecc801889310d5d9f535597c0c4cd723
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
private
|
22
22
|
|
23
23
|
def results
|
24
|
-
@results ||= Decidim::Accountability::Result.where(component: model).order_randomly(rand * 2 - 1)
|
24
|
+
@results ||= Decidim::Accountability::Result.where(component: model).order_randomly((rand * 2) - 1)
|
25
25
|
end
|
26
26
|
|
27
27
|
def results_to_render
|
@@ -31,6 +31,18 @@ module Decidim
|
|
31
31
|
def results_count
|
32
32
|
@results_count ||= results.count
|
33
33
|
end
|
34
|
+
|
35
|
+
def cache_hash
|
36
|
+
hash = []
|
37
|
+
hash << "decidim/accountability/highlighted_results_for_component"
|
38
|
+
hash << results.cache_key_with_version
|
39
|
+
hash << I18n.locale.to_s
|
40
|
+
hash.join(Decidim.cache_key_separator)
|
41
|
+
end
|
42
|
+
|
43
|
+
def cache_expiry_time
|
44
|
+
10.minutes
|
45
|
+
end
|
34
46
|
end
|
35
47
|
end
|
36
48
|
end
|
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user creates a Result from the admin
|
7
7
|
# panel.
|
8
|
-
class CreateImportedResult <
|
8
|
+
class CreateImportedResult < Decidim::Command
|
9
9
|
def initialize(form, parent_id = nil)
|
10
10
|
@form = form
|
11
11
|
@parent_id = parent_id
|
@@ -5,9 +5,10 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user creates a Status from the admin
|
7
7
|
# panel.
|
8
|
-
class CreateStatus <
|
9
|
-
def initialize(form)
|
8
|
+
class CreateStatus < Decidim::Command
|
9
|
+
def initialize(form, user)
|
10
10
|
@form = form
|
11
|
+
@user = user
|
11
12
|
end
|
12
13
|
|
13
14
|
# Creates the status if valid.
|
@@ -28,7 +29,9 @@ module Decidim
|
|
28
29
|
attr_reader :status
|
29
30
|
|
30
31
|
def create_status
|
31
|
-
@status =
|
32
|
+
@status = Decidim.traceability.create!(
|
33
|
+
Status,
|
34
|
+
@user,
|
32
35
|
component: @form.current_component,
|
33
36
|
key: @form.key,
|
34
37
|
name: @form.name,
|
@@ -5,9 +5,10 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user creates a TimelineEntry
|
7
7
|
# for a Result from the admin panel.
|
8
|
-
class CreateTimelineEntry <
|
9
|
-
def initialize(form)
|
8
|
+
class CreateTimelineEntry < Decidim::Command
|
9
|
+
def initialize(form, user)
|
10
10
|
@form = form
|
11
|
+
@user = user
|
11
12
|
end
|
12
13
|
|
13
14
|
# Creates the timeline_entry if valid.
|
@@ -25,13 +26,16 @@ module Decidim
|
|
25
26
|
|
26
27
|
private
|
27
28
|
|
28
|
-
attr_reader :timeline_entry
|
29
|
+
attr_reader :timeline_entry, :form
|
29
30
|
|
30
31
|
def create_timeline_entry
|
31
|
-
@timeline_entry =
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
@timeline_entry = Decidim.traceability.create!(
|
33
|
+
TimelineEntry,
|
34
|
+
@user,
|
35
|
+
decidim_accountability_result_id: form.decidim_accountability_result_id,
|
36
|
+
entry_date: form.entry_date,
|
37
|
+
title: form.title,
|
38
|
+
description: form.description
|
35
39
|
)
|
36
40
|
end
|
37
41
|
end
|
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user destroys a Result from the admin
|
7
7
|
# panel.
|
8
|
-
class DestroyResult <
|
8
|
+
class DestroyResult < Decidim::Command
|
9
9
|
# Initializes an UpdateResult Command.
|
10
10
|
#
|
11
11
|
# result - The current instance of the result to be destroyed.
|
@@ -5,7 +5,7 @@ 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 UpdateImportedResult <
|
8
|
+
class UpdateImportedResult < Decidim::Command
|
9
9
|
# Initializes an UpdateResult Command.
|
10
10
|
#
|
11
11
|
# form - The form from which to get the data.
|
@@ -5,7 +5,7 @@ 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 <
|
8
|
+
class UpdateResult < Decidim::Command
|
9
9
|
# Initializes an UpdateResult Command.
|
10
10
|
#
|
11
11
|
# form - The form from which to get the data.
|
@@ -5,14 +5,15 @@ 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 UpdateStatus <
|
8
|
+
class UpdateStatus < Decidim::Command
|
9
9
|
# Initializes an UpdateStatus Command.
|
10
10
|
#
|
11
11
|
# form - The form from which to get the data.
|
12
12
|
# status - The current instance of the status to be updated.
|
13
|
-
def initialize(form, status)
|
13
|
+
def initialize(form, status, user)
|
14
14
|
@form = form
|
15
15
|
@status = status
|
16
|
+
@user = user
|
16
17
|
end
|
17
18
|
|
18
19
|
# Updates the status if valid.
|
@@ -33,7 +34,9 @@ module Decidim
|
|
33
34
|
attr_reader :status, :form
|
34
35
|
|
35
36
|
def update_status
|
36
|
-
|
37
|
+
Decidim.traceability.update!(
|
38
|
+
status,
|
39
|
+
@user,
|
37
40
|
key: @form.key,
|
38
41
|
name: @form.name,
|
39
42
|
description: @form.description,
|
@@ -5,14 +5,15 @@ 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 UpdateTimelineEntry <
|
8
|
+
class UpdateTimelineEntry < Decidim::Command
|
9
9
|
# Initializes an UpdateTimelineEntry Command.
|
10
10
|
#
|
11
11
|
# form - The form from which to get the data.
|
12
12
|
# timeline_entry - The current instance of the timeline_entry to be updated.
|
13
|
-
def initialize(form, timeline_entry)
|
13
|
+
def initialize(form, timeline_entry, user)
|
14
14
|
@form = form
|
15
15
|
@timeline_entry = timeline_entry
|
16
|
+
@user = user
|
16
17
|
end
|
17
18
|
|
18
19
|
# Updates the timeline_entry if valid.
|
@@ -33,9 +34,12 @@ module Decidim
|
|
33
34
|
attr_reader :timeline_entry, :form
|
34
35
|
|
35
36
|
def update_timeline_entry
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
Decidim.traceability.update!(
|
38
|
+
timeline_entry,
|
39
|
+
@user,
|
40
|
+
entry_date: form.entry_date,
|
41
|
+
title: form.title,
|
42
|
+
description: form.description
|
39
43
|
)
|
40
44
|
end
|
41
45
|
end
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
|
19
19
|
@form = form(StatusForm).from_params(params)
|
20
20
|
|
21
|
-
CreateStatus.call(@form) do
|
21
|
+
CreateStatus.call(@form, current_user) 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) do
|
45
|
+
UpdateStatus.call(@form, status, current_user) 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,7 +58,9 @@ module Decidim
|
|
58
58
|
def destroy
|
59
59
|
enforce_permission_to :destroy, :status, status: status
|
60
60
|
|
61
|
-
|
61
|
+
Decidim.traceability.perform_action!("delete", status, current_user) do
|
62
|
+
status.destroy!
|
63
|
+
end
|
62
64
|
|
63
65
|
flash[:notice] = I18n.t("statuses.destroy.success", scope: "decidim.accountability.admin")
|
64
66
|
|
@@ -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) do
|
22
|
+
CreateTimelineEntry.call(@form, current_user) 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) do
|
46
|
+
UpdateTimelineEntry.call(@form, timeline_entry, current_user) 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,7 +59,9 @@ module Decidim
|
|
59
59
|
def destroy
|
60
60
|
enforce_permission_to :destroy, :timeline_entry, timeline_entry: timeline_entry
|
61
61
|
|
62
|
-
|
62
|
+
Decidim.traceability.perform_action!("delete", timeline_entry, current_user) do
|
63
|
+
timeline_entry.destroy!
|
64
|
+
end
|
63
65
|
|
64
66
|
flash[:notice] = I18n.t("timeline_entries.destroy.success", scope: "decidim.accountability.admin")
|
65
67
|
|
@@ -17,30 +17,30 @@ module Decidim
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def results
|
20
|
-
|
21
|
-
|
20
|
+
@results ||= begin
|
21
|
+
parent_id = params[:parent_id].presence
|
22
|
+
search.result.where(
|
23
|
+
parent_id: [parent_id] + Result.where(parent_id: parent_id).pluck(:id)
|
24
|
+
).page(params[:page]).per(12)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
def result
|
25
|
-
@result ||=
|
29
|
+
@result ||= search_collection.includes(:timeline_entries).find_by(id: params[:id])
|
26
30
|
end
|
27
31
|
|
28
|
-
def
|
29
|
-
|
32
|
+
def search_collection
|
33
|
+
Result.where(component: current_component)
|
30
34
|
end
|
31
35
|
|
32
36
|
def default_filter_params
|
33
37
|
{
|
34
|
-
|
35
|
-
|
36
|
-
|
38
|
+
search_text_cont: "",
|
39
|
+
with_scope: "",
|
40
|
+
with_category: ""
|
37
41
|
}
|
38
42
|
end
|
39
43
|
|
40
|
-
def context_params
|
41
|
-
{ component: current_component, organization: current_organization }
|
42
|
-
end
|
43
|
-
|
44
44
|
def first_class_categories
|
45
45
|
@first_class_categories ||= current_participatory_space.categories.first_class
|
46
46
|
end
|
@@ -59,14 +59,14 @@ module Decidim
|
|
59
59
|
#
|
60
60
|
# Returns a Decidim::Scope
|
61
61
|
def scope
|
62
|
-
@scope ||= @decidim_scope_id ? current_component.scopes.find_by(id: @decidim_scope_id) : current_component.scope
|
62
|
+
@scope ||= @attributes["decidim_scope_id"].value ? current_component.scopes.find_by(id: @attributes["decidim_scope_id"].value) : current_component.scope
|
63
63
|
end
|
64
64
|
|
65
65
|
# Scope identifier
|
66
66
|
#
|
67
67
|
# Returns the scope identifier related to the result
|
68
68
|
def decidim_scope_id
|
69
|
-
|
69
|
+
super || scope&.id
|
70
70
|
end
|
71
71
|
|
72
72
|
def category
|
@@ -10,10 +10,11 @@ module Decidim
|
|
10
10
|
|
11
11
|
attribute :decidim_accountability_result_id, Integer
|
12
12
|
attribute :entry_date, Decidim::Attributes::LocalizedDate
|
13
|
+
translatable_attribute :title, String
|
13
14
|
translatable_attribute :description, String
|
14
15
|
|
15
16
|
validates :entry_date, presence: true
|
16
|
-
validates :
|
17
|
+
validates :title, translatable_presence: true
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
@@ -10,7 +10,7 @@ module Decidim
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def current_scope
|
13
|
-
params[:filter][:
|
13
|
+
params[:filter][:with_scope] if params[:filter]
|
14
14
|
end
|
15
15
|
|
16
16
|
def progress_calculator(scope_id, category_id)
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def category
|
21
|
-
return if (category_id = params.dig(:filter, :
|
21
|
+
return if (category_id = params.dig(:filter, :with_category)).blank?
|
22
22
|
|
23
23
|
@category ||= current_participatory_space.categories.find(category_id.is_a?(Array) ? category_id.first : category_id)
|
24
24
|
end
|
@@ -15,10 +15,11 @@ module Decidim
|
|
15
15
|
include Decidim::Comments::CommentableWithComponent
|
16
16
|
include Decidim::Traceable
|
17
17
|
include Decidim::Loggable
|
18
|
-
include Decidim::
|
18
|
+
include Decidim::DownloadYourData
|
19
19
|
include Decidim::Randomable
|
20
20
|
include Decidim::Searchable
|
21
21
|
include Decidim::TranslatableResource
|
22
|
+
include Decidim::FilterableResource
|
22
23
|
|
23
24
|
component_manifest_name "accountability"
|
24
25
|
|
@@ -81,14 +82,17 @@ module Decidim
|
|
81
82
|
true
|
82
83
|
end
|
83
84
|
|
85
|
+
def self.ransackable_scopes(_auth_object = nil)
|
86
|
+
[:with_category, :with_scope]
|
87
|
+
end
|
88
|
+
|
84
89
|
ransacker :id_string do
|
85
90
|
Arel.sql(%{cast("decidim_accountability_results"."id" as text)})
|
86
91
|
end
|
87
92
|
|
88
|
-
#
|
89
|
-
|
90
|
-
|
91
|
-
end
|
93
|
+
# Create i18n ransackers for :title and :description.
|
94
|
+
# Create the :search_text ransacker alias for searching from both of these.
|
95
|
+
ransacker_i18n_multi :search_text, [:title, :description]
|
92
96
|
|
93
97
|
private
|
94
98
|
|
@@ -7,6 +7,8 @@ module Decidim
|
|
7
7
|
class Status < Accountability::ApplicationRecord
|
8
8
|
include Decidim::HasComponent
|
9
9
|
include Decidim::TranslatableResource
|
10
|
+
include Decidim::FilterableResource
|
11
|
+
include Decidim::Traceable
|
10
12
|
|
11
13
|
component_manifest_name "accountability"
|
12
14
|
|
@@ -18,8 +20,10 @@ module Decidim
|
|
18
20
|
validates :name, presence: true
|
19
21
|
|
20
22
|
# Allow ransacker to search for a key in a hstore column (`name`.`en`)
|
21
|
-
|
22
|
-
|
23
|
+
ransacker_i18n :name
|
24
|
+
|
25
|
+
def self.log_presenter_class_for(_log)
|
26
|
+
Decidim::Accountability::AdminLog::StatusPresenter
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -6,9 +6,15 @@ module Decidim
|
|
6
6
|
# It stores a date, and localized description.
|
7
7
|
class TimelineEntry < Accountability::ApplicationRecord
|
8
8
|
include Decidim::TranslatableResource
|
9
|
+
include Decidim::Traceable
|
9
10
|
|
11
|
+
translatable_fields :title
|
10
12
|
translatable_fields :description
|
11
13
|
belongs_to :result, foreign_key: "decidim_accountability_result_id", class_name: "Decidim::Accountability::Result", inverse_of: :timeline_entries
|
14
|
+
|
15
|
+
def self.log_presenter_class_for(_log)
|
16
|
+
Decidim::Accountability::AdminLog::TimelineEntryPresenter
|
17
|
+
end
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Accountability
|
5
|
+
module AdminLog
|
6
|
+
# This class holds the logic to present a `Decidim::Accountability::Status`
|
7
|
+
# for the `AdminLog` log.
|
8
|
+
#
|
9
|
+
# Usage should be automatic and you shouldn't need to call this class
|
10
|
+
# directly, but here's an example:
|
11
|
+
#
|
12
|
+
# action_log = Decidim::ActionLog.last
|
13
|
+
# view_helpers # => this comes from the views
|
14
|
+
# StatusPresenter.new(action_log, view_helpers).present
|
15
|
+
class StatusPresenter < Decidim::Log::BasePresenter
|
16
|
+
private
|
17
|
+
|
18
|
+
def action_string
|
19
|
+
case action
|
20
|
+
when "create", "delete", "update"
|
21
|
+
"decidim.accountability.admin_log.status.#{action}"
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def diff_fields_mapping
|
28
|
+
{
|
29
|
+
key: :string,
|
30
|
+
name: :i18n,
|
31
|
+
description: :i18n,
|
32
|
+
progress: :integer
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Accountability
|
5
|
+
module AdminLog
|
6
|
+
# This class holds the logic to present a `Decidim::Accountability::TimelineEntry`
|
7
|
+
# for the `AdminLog` log.
|
8
|
+
#
|
9
|
+
# Usage should be automatic and you shouldn't need to call this class
|
10
|
+
# directly, but here's an example:
|
11
|
+
#
|
12
|
+
# action_log = Decidim::ActionLog.last
|
13
|
+
# view_helpers # => this comes from the views
|
14
|
+
# TimelineEntryPresenter.new(action_log, view_helpers).present
|
15
|
+
class TimelineEntryPresenter < Decidim::Log::BasePresenter
|
16
|
+
private
|
17
|
+
|
18
|
+
def action_string
|
19
|
+
case action
|
20
|
+
when "create", "delete", "update"
|
21
|
+
"decidim.accountability.admin_log.timeline_entry.#{action}"
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def diff_fields_mapping
|
28
|
+
{
|
29
|
+
entry_date: :date,
|
30
|
+
description: :i18n,
|
31
|
+
title: :i18n
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -22,12 +22,16 @@ module Decidim
|
|
22
22
|
attr_reader :component, :scope_id, :category_id
|
23
23
|
|
24
24
|
def results
|
25
|
-
@results ||=
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
@results ||= begin
|
26
|
+
query = Result.where(
|
27
|
+
parent_id: nil,
|
28
|
+
component: component
|
29
|
+
)
|
30
|
+
query = query.with_any_scope(scope_id) if scope_id
|
31
|
+
query = query.with_any_category(category_id) if category_id
|
32
|
+
|
33
|
+
query
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -9,7 +9,11 @@
|
|
9
9
|
</div>
|
10
10
|
|
11
11
|
<div class="row column">
|
12
|
-
<%= form.translated :text_field, :
|
12
|
+
<%= form.translated :text_field, :title %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="row column">
|
16
|
+
<%= form.translated :editor, :description %>
|
13
17
|
</div>
|
14
18
|
</div>
|
15
19
|
</div>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<thead>
|
14
14
|
<tr>
|
15
15
|
<th><%= t("models.timeline_entry.fields.entry_date", scope: "decidim.accountability") %></th>
|
16
|
-
<th><%= t("models.timeline_entry.fields.
|
16
|
+
<th><%= t("models.timeline_entry.fields.title", scope: "decidim.accountability") %></th>
|
17
17
|
<th class="actions"><%= t("actions.title", scope: "decidim.accountability") %></th>
|
18
18
|
</tr>
|
19
19
|
</thead>
|
@@ -21,7 +21,7 @@
|
|
21
21
|
<% timeline_entries.each do |timeline_entry| %>
|
22
22
|
<tr data-id="<%= timeline_entry.id %>">
|
23
23
|
<td><%= timeline_entry.entry_date %><br></td>
|
24
|
-
<td><%= translated_attribute(timeline_entry.
|
24
|
+
<td><%= translated_attribute(timeline_entry.title) %></td>
|
25
25
|
<td class="table-list__actions">
|
26
26
|
<% if allowed_to? :update, :timeline_entry, timeline_entry: timeline_entry %>
|
27
27
|
<%= icon_link_to "pencil", edit_result_timeline_entry_path(timeline_entry.result, timeline_entry), t("actions.edit", scope: "decidim.accountability"), class: "action-icon--edit" %>
|
@@ -26,7 +26,7 @@
|
|
26
26
|
<div class="category--section small-12 medium-4 columns">
|
27
27
|
<div class="category--title">
|
28
28
|
<p class="heading3">
|
29
|
-
<%= link_to translated_attribute(category.name),results_path(filter: {
|
29
|
+
<%= link_to translated_attribute(category.name),results_path(filter: { with_category: category, with_scope: current_scope }) %></p>
|
30
30
|
|
31
31
|
<% if component_settings.display_progress_enabled? && progress_calculator(current_scope, category.id).present? %>
|
32
32
|
<div class="progress">
|
@@ -51,7 +51,7 @@
|
|
51
51
|
<div class="row">
|
52
52
|
<% category.subcategories.each do |subcategory| %>
|
53
53
|
<% if (subcategory_results_count = count_calculator(current_scope, subcategory.id)) > 0 %>
|
54
|
-
<%= link_to results_path(filter: {
|
54
|
+
<%= link_to results_path(filter: { with_category: subcategory, with_scope: current_scope }), class: "medium-4 columns end card__link card__link--block" do %>
|
55
55
|
<div class="category--line">
|
56
56
|
<strong><%= translated_attribute(subcategory.name) %></strong>
|
57
57
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<% if category.present? && category.parent.present? %>
|
8
8
|
<span class="breadcrumb--separator">></span>
|
9
9
|
<div>
|
10
|
-
<%= link_to translated_attribute(category.parent.name), results_path(filter: {
|
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
12
|
<span class="percentage"><%= display_percentage progress_calculator(current_scope, category.parent_id) %></span>
|
13
13
|
<% end %>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<% if category.present? %>
|
18
18
|
<span class="breadcrumb--separator">></span>
|
19
19
|
<div>
|
20
|
-
<%= link_to translated_attribute(category.name), results_path(filter: {
|
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
22
|
<span class="percentage"><%= display_percentage progress_calculator(current_scope, category.id) %></span>
|
23
23
|
<% end %>
|
@@ -27,7 +27,7 @@
|
|
27
27
|
<% if result && result.parent.present? %>
|
28
28
|
<span class="breadcrumb--separator">></span>
|
29
29
|
<div>
|
30
|
-
<%= link_to translated_attribute(result.parent.title), result_path(result.parent, filter: {
|
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
32
|
<span class="percentage"><%= display_percentage result.parent.progress %></span>
|
33
33
|
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="title-action">
|
2
|
-
<
|
2
|
+
<h2 id="results-count" class="title-action__title section-heading">
|
3
3
|
<%= heading_leaf_level_results(total_count) %>
|
4
|
-
</
|
4
|
+
</h2>
|
5
5
|
</div>
|
6
6
|
|
7
7
|
<div class="row">
|
@@ -42,6 +42,6 @@
|
|
42
42
|
</div>
|
43
43
|
<% end %>
|
44
44
|
</div>
|
45
|
-
<%= decidim_paginate results, order_start_time: params[:order_start_time],
|
45
|
+
<%= decidim_paginate results, order_start_time: params[:order_start_time], with_scope: params.dig(:filter, :with_scope) %>
|
46
46
|
</div>
|
47
47
|
</div>
|
@@ -27,6 +27,6 @@
|
|
27
27
|
</div>
|
28
28
|
<% end %>
|
29
29
|
</div>
|
30
|
-
<%= decidim_paginate results, order_start_time: params[:order_start_time],
|
30
|
+
<%= decidim_paginate results, order_start_time: params[:order_start_time], with_scope: params.dig(:filter, :with_scope) %>
|
31
31
|
</div>
|
32
32
|
</div>
|