decidim-accountability 0.30.2 → 0.31.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/project/milestones.erb +22 -0
- data/app/cells/decidim/accountability/project_cell.rb +9 -9
- data/app/commands/decidim/accountability/admin/{create_timeline_entry.rb → create_milestone.rb} +3 -3
- data/app/commands/decidim/accountability/admin/{update_timeline_entry.rb → update_milestone.rb} +2 -2
- data/app/controllers/decidim/accountability/admin/import_components_controller.rb +1 -1
- data/app/controllers/decidim/accountability/admin/import_results_controller.rb +1 -1
- data/app/controllers/decidim/accountability/admin/milestones_controller.rb +87 -0
- data/app/controllers/decidim/accountability/admin/results_controller.rb +2 -2
- data/app/controllers/decidim/accountability/admin/statuses_controller.rb +2 -2
- data/app/controllers/decidim/accountability/results_controller.rb +20 -4
- data/app/controllers/decidim/accountability/versions_controller.rb +1 -1
- data/app/forms/decidim/accountability/admin/{timeline_entry_form.rb → milestone_form.rb} +2 -2
- data/app/models/decidim/accountability/{timeline_entry.rb → milestone.rb} +4 -4
- data/app/models/decidim/accountability/result.rb +2 -2
- data/app/packs/entrypoints/decidim_accountability.js +0 -2
- data/app/packs/entrypoints/decidim_accountability_admin_imports.js +1 -1
- data/app/packs/src/decidim/accountability/admin/index.js +4 -1
- data/app/packs/src/decidim/accountability/admin/result_form.js +1 -1
- data/app/packs/src/decidim/accountability/controllers/.gitkeep +0 -0
- data/app/packs/stylesheets/accountability.scss +35 -5
- data/app/permissions/decidim/accountability/admin/permissions.rb +3 -3
- data/app/presenters/decidim/accountability/admin_log/{timeline_entry_presenter.rb → milestone_presenter.rb} +4 -4
- data/app/presenters/decidim/accountability/result_presenter.rb +2 -5
- data/app/views/decidim/accountability/admin/import_components/_form.html.erb +3 -3
- data/app/views/decidim/accountability/admin/import_results/new.html.erb +1 -1
- data/app/views/decidim/accountability/admin/{timeline_entries → milestones}/edit.html.erb +1 -1
- data/app/views/decidim/accountability/admin/milestones/index.html.erb +66 -0
- data/app/views/decidim/accountability/admin/{timeline_entries → milestones}/new.html.erb +1 -1
- data/app/views/decidim/accountability/admin/results/_actions.html.erb +102 -29
- data/app/views/decidim/accountability/admin/results/_form.html.erb +1 -1
- data/app/views/decidim/accountability/admin/results/_result-tr.html.erb +7 -7
- data/app/views/decidim/accountability/admin/results/bulk_actions/_dropdown.html.erb +25 -29
- data/app/views/decidim/accountability/admin/results/index.html.erb +12 -12
- data/app/views/decidim/accountability/admin/results/manage_trash.html.erb +2 -1
- data/app/views/decidim/accountability/admin/shared/_subnav.html.erb +1 -1
- data/app/views/decidim/accountability/admin/statuses/index.html.erb +40 -12
- data/app/views/decidim/accountability/results/_filters.html.erb +4 -0
- data/app/views/decidim/accountability/results/_home_aside.html.erb +12 -0
- data/app/views/decidim/accountability/results/_home_taxonomies.html.erb +8 -31
- data/app/views/decidim/accountability/results/_one_level_taxonomies.html.erb +17 -0
- data/app/views/decidim/accountability/results/_projects_aside.html.erb +1 -3
- data/app/views/decidim/accountability/results/_root_taxonomies_selector.html.erb +17 -0
- data/app/views/decidim/accountability/results/_two_levels_taxonomies.html.erb +30 -0
- data/app/views/decidim/accountability/results/home.html.erb +11 -25
- data/config/assets.rb +2 -2
- data/config/locales/ar.yml +0 -42
- data/config/locales/bg.yml +0 -41
- data/config/locales/bs-BA.yml +4 -25
- data/config/locales/ca-IT.yml +42 -44
- data/config/locales/ca.yml +42 -44
- data/config/locales/cs.yml +42 -44
- data/config/locales/da.yml +0 -21
- data/config/locales/de.yml +42 -44
- data/config/locales/el.yml +0 -37
- data/config/locales/en.yml +42 -44
- data/config/locales/es-MX.yml +42 -44
- data/config/locales/es-PY.yml +42 -44
- data/config/locales/es.yml +42 -44
- data/config/locales/eu.yml +43 -45
- data/config/locales/fi-plain.yml +42 -44
- data/config/locales/fi.yml +42 -44
- data/config/locales/fr-CA.yml +42 -44
- data/config/locales/fr.yml +42 -44
- data/config/locales/ga-IE.yml +0 -11
- data/config/locales/gl.yml +0 -25
- data/config/locales/gn-PY.yml +0 -2
- data/config/locales/he-IL.yml +0 -41
- data/config/locales/hu.yml +0 -41
- data/config/locales/id-ID.yml +0 -23
- data/config/locales/is-IS.yml +0 -24
- data/config/locales/it.yml +40 -43
- data/config/locales/ja.yml +42 -44
- data/config/locales/kaa.yml +0 -5
- data/config/locales/ko.yml +0 -15
- data/config/locales/lb.yml +0 -25
- data/config/locales/lt.yml +0 -37
- data/config/locales/lv.yml +0 -23
- data/config/locales/nl.yml +0 -29
- data/config/locales/no.yml +0 -29
- data/config/locales/pl.yml +0 -41
- data/config/locales/pt-BR.yml +39 -43
- data/config/locales/pt.yml +0 -26
- data/config/locales/ro-RO.yml +6 -41
- data/config/locales/ru.yml +0 -23
- data/config/locales/si-LK.yml +0 -12
- data/config/locales/sk.yml +0 -23
- data/config/locales/sl.yml +0 -18
- data/config/locales/sq-AL.yml +0 -41
- data/config/locales/sr-CS.yml +0 -23
- data/config/locales/sv.yml +42 -44
- data/config/locales/th-TH.yml +0 -27
- data/config/locales/tr-TR.yml +0 -43
- data/config/locales/uk.yml +0 -21
- data/config/locales/zh-CN.yml +0 -23
- data/config/locales/zh-TW.yml +0 -37
- data/db/migrate/20250606155946_rename_timeline_table_to_milestone.rb +11 -0
- data/lib/decidim/accountability/admin_engine.rb +1 -1
- data/lib/decidim/accountability/api.rb +1 -1
- data/lib/decidim/accountability/component.rb +18 -1
- data/lib/decidim/accountability/engine.rb +5 -13
- data/lib/decidim/accountability/seeds.rb +9 -9
- data/lib/decidim/accountability/test/factories.rb +3 -3
- data/lib/decidim/accountability/version.rb +1 -1
- data/lib/decidim/accountability.rb +0 -7
- data/lib/decidim/api/{timeline_entry_type.rb → milestone_type.rb} +8 -7
- data/lib/decidim/api/result_type.rb +17 -3
- data/lib/decidim/api/status_type.rb +1 -0
- metadata +39 -35
- data/app/cells/decidim/accountability/project/timeline.erb +0 -22
- data/app/controllers/decidim/accountability/admin/timeline_entries_controller.rb +0 -87
- data/app/packs/src/decidim/accountability/index.js +0 -11
- data/app/packs/src/decidim/accountability/version_diff.js +0 -33
- data/app/queries/decidim/accountability/metrics/results_metric_manage.rb +0 -56
- data/app/views/decidim/accountability/admin/timeline_entries/index.html.erb +0 -42
- /data/app/views/decidim/accountability/admin/{timeline_entries → milestones}/_form.html.erb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a2ee9996082681897f97c85dd9cd63f49d3a1eea0848ddaffe00e5d1c175cd4
|
4
|
+
data.tar.gz: 99b059204a785d8bcc0ed7552d2daf5411f4988d930f530a4f92f5d10e34d383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8de11b2a3c742a9c73fc8d0a149992c1df4e18e669a3550305ed186ff4fe33b9160c9a68ad27380d2c23b1614a8d637d53fbb5c55eca551edd343fca75b28c63
|
7
|
+
data.tar.gz: 87f7aaaa1ede0a5d92b3e3f7ac2f16dd4280baa49f63c9edcab0a441ffd1222b8c68caab2e20058c2d398b2a9d49d3e2e4442d9823b461d7b6a493fe49766111
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<ol class="accountability__project-milestones">
|
2
|
+
<% milestones.each_with_index do |milestone, i| %>
|
3
|
+
<li class="accountability__project-milestones-milestone">
|
4
|
+
<div class="accountability__project-milestones-milestone-number">
|
5
|
+
<span><%= i + 1 %></span>
|
6
|
+
</div>
|
7
|
+
<div class="accountability__project-milestones-milestone-attributes">
|
8
|
+
<h3>
|
9
|
+
<%= decidim_sanitize_translated milestone.title %>
|
10
|
+
</h3>
|
11
|
+
<div>
|
12
|
+
<%= l milestone.entry_date, format: :decidim_short %>
|
13
|
+
</div>
|
14
|
+
<% if translated_attribute(milestone.description).present? %>
|
15
|
+
<div>
|
16
|
+
<%= decidim_sanitize_translated(milestone.description) %>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
</li>
|
21
|
+
<% end %>
|
22
|
+
</ol>
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
class ProjectCell < Decidim::ViewModel
|
9
9
|
include Decidim::Accountability::ApplicationHelper
|
10
10
|
include Cell::ViewModel::Partial
|
11
|
-
delegate :children, :
|
11
|
+
delegate :children, :milestones, to: :model
|
12
12
|
|
13
13
|
alias result model
|
14
14
|
|
@@ -18,6 +18,14 @@ module Decidim
|
|
18
18
|
|
19
19
|
def tab_panel_items
|
20
20
|
[
|
21
|
+
{
|
22
|
+
enabled: milestones.any?,
|
23
|
+
id: "milestones",
|
24
|
+
text: t("decidim.accountability.results.milestones.title"),
|
25
|
+
icon: "route-line",
|
26
|
+
method: :cell,
|
27
|
+
args: ["decidim/accountability/project", result, { template: :milestones }]
|
28
|
+
},
|
21
29
|
{
|
22
30
|
enabled: ResultHistoryCell.new(result).render?,
|
23
31
|
id: "included_history",
|
@@ -26,14 +34,6 @@ module Decidim
|
|
26
34
|
method: :cell,
|
27
35
|
args: ["decidim/accountability/result_history", result]
|
28
36
|
},
|
29
|
-
{
|
30
|
-
enabled: timeline_entries.any?,
|
31
|
-
id: "timeline_entries",
|
32
|
-
text: t("decidim.accountability.results.timeline.title"),
|
33
|
-
icon: "route-line",
|
34
|
-
method: :cell,
|
35
|
-
args: ["decidim/accountability/project", result, { template: :timeline }]
|
36
|
-
},
|
37
37
|
{
|
38
38
|
enabled: children.any?,
|
39
39
|
id: "included_results",
|
data/app/commands/decidim/accountability/admin/{create_timeline_entry.rb → create_milestone.rb}
RENAMED
@@ -3,14 +3,14 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
module Admin
|
6
|
-
# This command is executed when the user creates a
|
6
|
+
# This command is executed when the user creates a Milestone
|
7
7
|
# for a Result from the admin panel.
|
8
|
-
class
|
8
|
+
class CreateMilestone < Decidim::Commands::CreateResource
|
9
9
|
fetch_form_attributes :decidim_accountability_result_id, :entry_date, :title, :description
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
-
def resource_class = Decidim::Accountability::
|
13
|
+
def resource_class = Decidim::Accountability::Milestone
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/app/commands/decidim/accountability/admin/{update_timeline_entry.rb → update_milestone.rb}
RENAMED
@@ -3,9 +3,9 @@
|
|
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 Milestone from the admin
|
7
7
|
# panel.
|
8
|
-
class
|
8
|
+
class UpdateMilestone < Decidim::Commands::UpdateResource
|
9
9
|
fetch_form_attributes :entry_date, :title, :description
|
10
10
|
end
|
11
11
|
end
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
redirect_to import_results_path(current_participatory_space, current_component)
|
22
22
|
else
|
23
23
|
flash[:alert] = I18n.t("imports.create.invalid", scope: "decidim.accountability.admin")
|
24
|
-
render action: "new"
|
24
|
+
render action: "new", status: :unprocessable_entity
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Accountability
|
5
|
+
module Admin
|
6
|
+
# This controller allows an admin to manage milestones for a Result
|
7
|
+
class MilestonesController < Admin::ApplicationController
|
8
|
+
helper_method :result, :milestones
|
9
|
+
|
10
|
+
def new
|
11
|
+
enforce_permission_to :create, :milestone
|
12
|
+
|
13
|
+
@form = form(MilestoneForm).instance
|
14
|
+
end
|
15
|
+
|
16
|
+
def create
|
17
|
+
enforce_permission_to :create, :milestone
|
18
|
+
|
19
|
+
@form = form(MilestoneForm).from_params(params)
|
20
|
+
@form.decidim_accountability_result_id = params[:result_id]
|
21
|
+
|
22
|
+
CreateMilestone.call(@form) do
|
23
|
+
on(:ok) do
|
24
|
+
flash[:notice] = I18n.t("milestones.create.success", scope: "decidim.accountability.admin")
|
25
|
+
redirect_to result_milestones_path(params[:result_id])
|
26
|
+
end
|
27
|
+
|
28
|
+
on(:invalid) do
|
29
|
+
flash.now[:alert] = I18n.t("milestones.create.invalid", scope: "decidim.accountability.admin")
|
30
|
+
render action: "new", status: :unprocessable_entity
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def edit
|
36
|
+
enforce_permission_to(:update, :milestone, milestone:)
|
37
|
+
|
38
|
+
@form = form(MilestoneForm).from_model(milestone)
|
39
|
+
end
|
40
|
+
|
41
|
+
def update
|
42
|
+
enforce_permission_to(:update, :milestone, milestone:)
|
43
|
+
|
44
|
+
@form = form(MilestoneForm).from_params(params)
|
45
|
+
|
46
|
+
UpdateMilestone.call(@form, milestone) do
|
47
|
+
on(:ok) do
|
48
|
+
flash[:notice] = I18n.t("milestones.update.success", scope: "decidim.accountability.admin")
|
49
|
+
redirect_to result_milestones_path(params[:result_id])
|
50
|
+
end
|
51
|
+
|
52
|
+
on(:invalid) do
|
53
|
+
flash.now[:alert] = I18n.t("milestones.update.invalid", scope: "decidim.accountability.admin")
|
54
|
+
render action: "edit", status: :unprocessable_entity
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def destroy
|
60
|
+
enforce_permission_to(:destroy, :milestone, milestone:)
|
61
|
+
|
62
|
+
Decidim::Commands::DestroyResource.call(milestone, current_user) do
|
63
|
+
on(:ok) do
|
64
|
+
flash[:notice] = I18n.t("milestones.destroy.success", scope: "decidim.accountability.admin")
|
65
|
+
|
66
|
+
redirect_to result_milestones_path(params[:result_id])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def milestones
|
74
|
+
@milestones ||= result.milestones.page(params[:page]).per(15)
|
75
|
+
end
|
76
|
+
|
77
|
+
def milestone
|
78
|
+
@milestone ||= milestones.find(params[:id])
|
79
|
+
end
|
80
|
+
|
81
|
+
def result
|
82
|
+
@result ||= Result.where(component: current_component).find(params[:result_id])
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -38,7 +38,7 @@ module Decidim
|
|
38
38
|
|
39
39
|
on(:invalid) do
|
40
40
|
flash.now[:alert] = I18n.t("results.create.invalid", scope: "decidim.accountability.admin")
|
41
|
-
render action: "new"
|
41
|
+
render action: "new", status: :unprocessable_entity
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -62,7 +62,7 @@ module Decidim
|
|
62
62
|
|
63
63
|
on(:invalid) do
|
64
64
|
flash.now[:alert] = I18n.t("results.update.invalid", scope: "decidim.accountability.admin")
|
65
|
-
render action: "edit"
|
65
|
+
render action: "edit", status: :unprocessable_entity
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -26,7 +26,7 @@ module Decidim
|
|
26
26
|
|
27
27
|
on(:invalid) do
|
28
28
|
flash.now[:alert] = I18n.t("statuses.create.invalid", scope: "decidim.accountability.admin")
|
29
|
-
render action: "new"
|
29
|
+
render action: "new", status: :unprocessable_entity
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -50,7 +50,7 @@ module Decidim
|
|
50
50
|
|
51
51
|
on(:invalid) do
|
52
52
|
flash.now[:alert] = I18n.t("statuses.update.invalid", scope: "decidim.accountability.admin")
|
53
|
-
render action: "edit"
|
53
|
+
render action: "edit", status: :unprocessable_entity
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
helper Decidim::TraceabilityHelper
|
9
9
|
helper Decidim::Accountability::BreadcrumbHelper
|
10
10
|
|
11
|
-
helper_method :results, :result, :
|
11
|
+
helper_method :results, :result, :count_calculator, :selected_root_taxonomy, :selected_taxonomy_children, :selected_taxonomy_grandchildren?
|
12
12
|
|
13
13
|
before_action :set_controller_breadcrumb
|
14
14
|
|
@@ -32,7 +32,7 @@ module Decidim
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def result
|
35
|
-
@result ||= search_collection.includes(:
|
35
|
+
@result ||= search_collection.includes(:milestones).find_by(id: params[:id])
|
36
36
|
end
|
37
37
|
|
38
38
|
def search_collection
|
@@ -46,8 +46,24 @@ module Decidim
|
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
50
|
-
@
|
49
|
+
def selected_taxonomy_grandchildren?
|
50
|
+
@selected_taxonomy_grandchildren ||= selected_root_taxonomy.all_children.count > selected_taxonomy_children.count
|
51
|
+
end
|
52
|
+
|
53
|
+
def selected_taxonomy_children
|
54
|
+
return [] if selected_root_taxonomy.blank?
|
55
|
+
|
56
|
+
@selected_taxonomy_children ||= current_organization.taxonomies.where(parent_id: selected_root_taxonomy.id, id: current_component.available_taxonomy_ids)
|
57
|
+
end
|
58
|
+
|
59
|
+
def selected_root_taxonomy
|
60
|
+
@selected_root_taxonomy ||= if params[:root_taxonomy_id] == "list"
|
61
|
+
nil
|
62
|
+
elsif params[:root_taxonomy_id].blank?
|
63
|
+
current_component.available_root_taxonomies.find_by(id: component_settings.default_taxonomy)
|
64
|
+
else
|
65
|
+
current_component.available_root_taxonomies.find_by(id: params[:root_taxonomy_id])
|
66
|
+
end
|
51
67
|
end
|
52
68
|
|
53
69
|
def count_calculator(taxonomy_id)
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def result
|
20
|
-
@result ||= Result.includes(:
|
20
|
+
@result ||= Result.includes(:milestones).where(component: current_component).find(params[:result_id])
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
module Admin
|
6
|
-
# This class holds a Form to create/update
|
7
|
-
class
|
6
|
+
# This class holds a Form to create/update milestones from Decidim's admin panel.
|
7
|
+
class MilestoneForm < Decidim::Form
|
8
8
|
include TranslatableAttributes
|
9
9
|
include TranslationsHelper
|
10
10
|
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
|
-
# The data store for a
|
5
|
+
# The data store for a Milestone for a Result in the Decidim::Accountability component.
|
6
6
|
# It stores a date, and localized description.
|
7
|
-
class
|
7
|
+
class Milestone < Accountability::ApplicationRecord
|
8
8
|
include Decidim::TranslatableResource
|
9
9
|
include Decidim::Traceable
|
10
10
|
|
11
11
|
translatable_fields :title
|
12
12
|
translatable_fields :description
|
13
|
-
belongs_to :result, foreign_key: "decidim_accountability_result_id", class_name: "Decidim::Accountability::Result", inverse_of: :
|
13
|
+
belongs_to :result, foreign_key: "decidim_accountability_result_id", class_name: "Decidim::Accountability::Result", inverse_of: :milestones
|
14
14
|
|
15
15
|
def self.log_presenter_class_for(_log)
|
16
|
-
Decidim::Accountability::AdminLog::
|
16
|
+
Decidim::Accountability::AdminLog::MilestonePresenter
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -32,8 +32,8 @@ module Decidim
|
|
32
32
|
|
33
33
|
belongs_to :status, foreign_key: "decidim_accountability_status_id", class_name: "Decidim::Accountability::Status", inverse_of: :results, optional: true
|
34
34
|
|
35
|
-
has_many :
|
36
|
-
|
35
|
+
has_many :milestones, -> { order(:entry_date) }, foreign_key: "decidim_accountability_result_id",
|
36
|
+
class_name: "Decidim::Accountability::Milestone", inverse_of: :result, dependent: :destroy
|
37
37
|
|
38
38
|
scope :order_by_most_recent, -> { order(created_at: :desc) }
|
39
39
|
|
@@ -4,7 +4,7 @@ import ActionForm from "src/decidim/accountability/admin/index/action_form";
|
|
4
4
|
import ActionSelector from "src/decidim/accountability/admin/index/action_selector";
|
5
5
|
import SelectAll from "src/decidim/accountability/admin/index/select_all";
|
6
6
|
|
7
|
-
|
7
|
+
document.addEventListener("turbo:load", () => {
|
8
8
|
const counter = new Counter();
|
9
9
|
const actionButton = new ActionButton(counter);
|
10
10
|
const actionForm = new ActionForm(counter);
|
@@ -17,3 +17,6 @@ $(() => {
|
|
17
17
|
actionSelector.init();
|
18
18
|
selectAll.init();
|
19
19
|
})
|
20
|
+
|
21
|
+
const context = require.context("../controllers", true, /controller\.js$/)
|
22
|
+
window.Stimulus.load(window.definitionsFromContext(context))
|
File without changes
|
@@ -97,10 +97,16 @@
|
|
97
97
|
}
|
98
98
|
|
99
99
|
&__grid {
|
100
|
-
@apply grid md:grid-cols-3 items-start gap-x-
|
100
|
+
@apply grid md:grid-cols-3 items-start gap-x-6 gap-y-6;
|
101
101
|
|
102
|
-
|
103
|
-
@apply grid
|
102
|
+
&--one-level {
|
103
|
+
@apply grid;
|
104
|
+
}
|
105
|
+
|
106
|
+
&--two-levels {
|
107
|
+
& > :nth-child(even) {
|
108
|
+
@apply grid md:col-span-2;
|
109
|
+
}
|
104
110
|
}
|
105
111
|
|
106
112
|
/* display the titles only for the first two rows in desktop */
|
@@ -143,10 +149,10 @@
|
|
143
149
|
}
|
144
150
|
}
|
145
151
|
|
146
|
-
&-
|
152
|
+
&-milestones {
|
147
153
|
@apply flex flex-col gap-6;
|
148
154
|
|
149
|
-
&-
|
155
|
+
&-milestone {
|
150
156
|
@apply flex items-start gap-2 relative before:absolute before:w-px before:-z-10 before:left-3 before:bg-gray-3 before:h-[calc(100%+1.5rem)] last:before:h-6 before:-top-3 first:before:top-3;
|
151
157
|
|
152
158
|
&-number {
|
@@ -171,4 +177,28 @@
|
|
171
177
|
&__filters {
|
172
178
|
@apply w-full space-y-10;
|
173
179
|
}
|
180
|
+
|
181
|
+
&__taxonomies {
|
182
|
+
@apply w-full;
|
183
|
+
|
184
|
+
ul {
|
185
|
+
@apply flex flex-wrap gap-4 mt-4;
|
186
|
+
|
187
|
+
li {
|
188
|
+
@apply bg-white py-1 px-4 rounded;
|
189
|
+
|
190
|
+
a {
|
191
|
+
@apply text-secondary font-semibold text-sm;
|
192
|
+
}
|
193
|
+
|
194
|
+
&.active {
|
195
|
+
@apply bg-secondary text-white;
|
196
|
+
|
197
|
+
a {
|
198
|
+
@apply text-white;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
}
|
174
204
|
}
|
@@ -9,7 +9,7 @@ module Decidim
|
|
9
9
|
|
10
10
|
permission_action.allow! if can_perform_actions_on?(:result, result)
|
11
11
|
permission_action.allow! if can_perform_actions_on?(:status, status)
|
12
|
-
permission_action.allow! if can_perform_actions_on?(:
|
12
|
+
permission_action.allow! if can_perform_actions_on?(:milestone, milestone)
|
13
13
|
permission_action.allow! if can_perform_actions_on?(:bulk_update, nil)
|
14
14
|
permission_action.allow! if can_perform_actions_on?(:import_component, nil)
|
15
15
|
|
@@ -26,8 +26,8 @@ module Decidim
|
|
26
26
|
@status ||= context.fetch(:status, nil)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
@
|
29
|
+
def milestone
|
30
|
+
@milestone ||= context.fetch(:milestone, nil)
|
31
31
|
end
|
32
32
|
|
33
33
|
def can_perform_actions_on?(subject, resource)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Accountability
|
5
5
|
module AdminLog
|
6
|
-
# This class holds the logic to present a `Decidim::Accountability::
|
6
|
+
# This class holds the logic to present a `Decidim::Accountability::Milestone`
|
7
7
|
# for the `AdminLog` log.
|
8
8
|
#
|
9
9
|
# Usage should be automatic and you should not need to call this class
|
@@ -11,14 +11,14 @@ module Decidim
|
|
11
11
|
#
|
12
12
|
# action_log = Decidim::ActionLog.last
|
13
13
|
# view_helpers # => this comes from the views
|
14
|
-
#
|
15
|
-
class
|
14
|
+
# MilestonePresenter.new(action_log, view_helpers).present
|
15
|
+
class MilestonePresenter < Decidim::Log::BasePresenter
|
16
16
|
private
|
17
17
|
|
18
18
|
def action_string
|
19
19
|
case action
|
20
20
|
when "create", "delete", "update"
|
21
|
-
"decidim.accountability.admin_log.
|
21
|
+
"decidim.accountability.admin_log.milestones.#{action}"
|
22
22
|
else
|
23
23
|
super
|
24
24
|
end
|
@@ -16,14 +16,11 @@ module Decidim
|
|
16
16
|
|
17
17
|
# Render the result title
|
18
18
|
#
|
19
|
-
# links - should render hashtags as links?
|
20
|
-
# extras - should include extra hashtags?
|
21
|
-
#
|
22
19
|
# Returns a String.
|
23
|
-
def title(
|
20
|
+
def title(html_escape: false, all_locales: false)
|
24
21
|
return unless result
|
25
22
|
|
26
|
-
super(result.title,
|
23
|
+
super(result.title, html_escape, all_locales)
|
27
24
|
end
|
28
25
|
end
|
29
26
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
|
1
|
+
<%= decidim_form_for(@form, url: import_components_path(@accountability),
|
2
|
+
html: { class: "form form-defaults", id: "new_import_component", data: { form_url: new_import_component_path(@accountability) } },
|
3
|
+
method: :post) do |f| %>
|
4
4
|
<% if @form.origin_components.any? %>
|
5
5
|
<div class="form__wrapper">
|
6
6
|
<div class="card pt-4">
|
@@ -6,7 +6,7 @@
|
|
6
6
|
</div>
|
7
7
|
<div class="item__edit item__edit-1col">
|
8
8
|
<div class="item__edit-form">
|
9
|
-
<%=
|
9
|
+
<%= decidim_form_for(@form, url: import_results_path, html: { class: "form form-defaults import_projects" }) do |form| %>
|
10
10
|
<div class="card py-4">
|
11
11
|
<div class="card-section space-y-4 prose max-w-full">
|
12
12
|
<div class="row column">
|
@@ -6,7 +6,7 @@
|
|
6
6
|
</div>
|
7
7
|
<div class="item__edit item__edit-1col">
|
8
8
|
<div class="item__edit-form">
|
9
|
-
<%= decidim_form_for([result, @form], html: { class: "form-defaults form
|
9
|
+
<%= decidim_form_for([result, @form], html: { class: "form-defaults form edit_milestone" }) do |f| %>
|
10
10
|
<%= render partial: "form", object: f %>
|
11
11
|
<div class="item__edit-sticky">
|
12
12
|
<div class="item__edit-sticky-container">
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<% add_decidim_page_title(t(".title")) %>
|
2
|
+
<% add_decidim_page_title(translated_attribute(result.title)) %>
|
3
|
+
<div class="card">
|
4
|
+
<div class="item_show__header">
|
5
|
+
<h1 class="item_show__header-title">
|
6
|
+
<div>
|
7
|
+
<%= link_to "#{translated_attribute(result.title)} > ", edit_result_path(result) %>
|
8
|
+
<%= t(".title") %>
|
9
|
+
</div>
|
10
|
+
<%= link_to t("actions.new_milestone", scope: "decidim.accountability"), new_result_milestone_path(result), class: "button button__sm button__secondary button--title" if allowed_to? :create, :milestone %>
|
11
|
+
</h1>
|
12
|
+
</div>
|
13
|
+
<div class="table-stacked">
|
14
|
+
<table class="table-list">
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<th><%= t("models.milestone.fields.entry_date", scope: "decidim.accountability") %></th>
|
18
|
+
<th><%= t("models.milestone.fields.title", scope: "decidim.accountability") %></th>
|
19
|
+
<th><%= t("actions.title", scope: "decidim.accountability") %></th>
|
20
|
+
</tr>
|
21
|
+
</thead>
|
22
|
+
<tbody>
|
23
|
+
<% milestones.each do |milestone| %>
|
24
|
+
<tr data-id="<%= milestone.id %>">
|
25
|
+
<td data-label="<%= t("models.milestone.fields.entry_date", scope: "decidim.accountability") %>">
|
26
|
+
<%= l milestone.entry_date, format: :decidim_short %><br>
|
27
|
+
</td>
|
28
|
+
<td data-label="<%= t("models.milestone.fields.title", scope: "decidim.accountability") %>">
|
29
|
+
<%= translated_attribute(milestone.title) %>
|
30
|
+
</td>
|
31
|
+
<td class="table-list__actions" data-label="<%= t("actions.title", scope: "decidim.accountability") %>">
|
32
|
+
<button type="button" data-controller="dropdown" data-target="actions-milestone-<%= milestone.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: translated_attribute(milestone.title)) %>">
|
33
|
+
<%= icon "more-fill", class: "text-secondary" %>
|
34
|
+
</button>
|
35
|
+
|
36
|
+
<div class="inline-block relative">
|
37
|
+
<ul id="actions-milestone-<%= milestone.id %>" class="dropdown dropdown__action" aria-hidden="true">
|
38
|
+
<% if allowed_to? :update, :milestone, milestone: milestone %>
|
39
|
+
<li class="dropdown__item">
|
40
|
+
<%= link_to edit_result_milestone_path(milestone.result, milestone), class: "dropdown__button" do %>
|
41
|
+
<%= icon "pencil-line" %>
|
42
|
+
<%= t("actions.edit", scope: "decidim.accountability") %>
|
43
|
+
<% end %>
|
44
|
+
</li>
|
45
|
+
|
46
|
+
<hr>
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
<% if allowed_to? :destroy, :milestone, milestone: milestone %>
|
50
|
+
<li class="dropdown__item">
|
51
|
+
<%= link_to result_milestone_path(milestone.result, milestone), method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.accountability") }, class: "dropdown__button dropdown__button--danger" do %>
|
52
|
+
<%= icon "delete-bin-line" %>
|
53
|
+
<%= t("actions.destroy", scope: "decidim.accountability") %>
|
54
|
+
<% end %>
|
55
|
+
</li>
|
56
|
+
<% end %>
|
57
|
+
</ul>
|
58
|
+
</div>
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
<% end %>
|
62
|
+
</tbody>
|
63
|
+
</table>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
<%= decidim_paginate milestones %>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
</div>
|
7
7
|
<div class="item__edit item__edit-1col">
|
8
8
|
<div class="item__edit-form">
|
9
|
-
<%= decidim_form_for([result, @form], html: { class: "form-defaults form
|
9
|
+
<%= decidim_form_for([result, @form], html: { class: "form-defaults form new_milestone" }) do |f| %>
|
10
10
|
<%= render partial: "form", object: f %>
|
11
11
|
<div class="item__edit-sticky">
|
12
12
|
<div class="item__edit-sticky-container">
|