decidim-accountability 0.20.0 → 0.23.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/accountability/admin/accountability_admin.js.es6 +6 -42
- data/app/assets/stylesheets/decidim/accountability/accountability/_categories.scss +8 -1
- data/app/assets/stylesheets/decidim/accountability/accountability/_lines_breadcrumb.scss +8 -0
- data/app/assets/stylesheets/decidim/accountability/accountability/_results.scss +0 -3
- data/app/cells/decidim/accountability/highlighted_results_for_component/show.erb +3 -3
- data/app/cells/decidim/accountability/highlighted_results_for_component_cell.rb +1 -1
- data/app/commands/decidim/accountability/admin/create_imported_result.rb +106 -0
- data/app/commands/decidim/accountability/admin/update_imported_result.rb +110 -0
- data/app/controllers/decidim/accountability/admin/import_results_controller.rb +34 -0
- data/app/controllers/decidim/accountability/admin/results_controller.rb +2 -20
- data/app/controllers/decidim/accountability/results_controller.rb +0 -1
- data/app/controllers/decidim/accountability/versions_controller.rb +7 -8
- data/app/forms/decidim/accountability/admin/result_form.rb +3 -9
- data/app/helpers/decidim/accountability/admin/application_helper.rb +13 -0
- data/app/helpers/decidim/accountability/application_helper.rb +1 -1
- data/app/jobs/application_job.rb +4 -0
- data/app/jobs/decidim/accountability/admin/import_results_csv_job.rb +19 -0
- data/app/mailers/decidim/accountability/import_mailer.rb +26 -0
- data/app/models/decidim/accountability/result.rb +4 -1
- data/app/models/decidim/accountability/status.rb +3 -0
- data/app/models/decidim/accountability/timeline_entry.rb +3 -0
- data/app/queries/decidim/accountability/metrics/results_metric_manage.rb +2 -8
- data/app/services/decidim/accountability/result_search.rb +2 -20
- data/app/services/decidim/accountability/result_stats_calculator.rb +1 -1
- data/app/services/decidim/accountability/results_csv_importer.rb +139 -0
- data/app/types/decidim/accountability/accountability_type.rb +32 -0
- data/app/types/decidim/accountability/result_type.rb +35 -0
- data/app/types/decidim/accountability/status_type.rb +20 -0
- data/app/types/decidim/accountability/timeline_entry_type.rb +18 -0
- data/app/views/decidim/accountability/admin/import_results/new.html.erb +22 -0
- data/app/views/decidim/accountability/admin/results/_form.html.erb +3 -7
- data/app/views/decidim/accountability/admin/results/index.html.erb +3 -0
- data/app/views/decidim/accountability/admin/results/proposals_picker.html.erb +1 -0
- data/app/views/decidim/accountability/import_mailer/import.html.erb +25 -0
- data/app/views/decidim/accountability/results/_linked_results.html.erb +1 -1
- data/app/views/decidim/accountability/results/_results_leaf.html.erb +5 -5
- data/app/views/decidim/accountability/results/_results_parent.html.erb +2 -2
- data/app/views/decidim/accountability/results/_scope_filters.html.erb +17 -4
- data/app/views/decidim/accountability/results/_search.html.erb +3 -3
- data/app/views/decidim/accountability/results/_stats_box.html.erb +11 -5
- data/app/views/decidim/accountability/results/_timeline.html.erb +2 -2
- data/app/views/decidim/accountability/versions/index.html.erb +7 -25
- data/app/views/decidim/accountability/versions/show.html.erb +9 -31
- data/app/views/decidim/participatory_spaces/_result.html.erb +3 -3
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +1 -24
- data/config/locales/bg-BG.yml +220 -0
- data/config/locales/bg.yml +226 -0
- data/config/locales/ca.yml +22 -22
- data/config/locales/cs.yml +48 -48
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +22 -22
- data/config/locales/el-GR.yml +1 -0
- data/config/locales/el.yml +224 -0
- data/config/locales/en.yml +22 -22
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +22 -22
- data/config/locales/es-PY.yml +22 -22
- data/config/locales/es.yml +22 -22
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +1 -24
- data/config/locales/fi-plain.yml +22 -22
- data/config/locales/fi.yml +35 -35
- data/config/locales/fr-CA.yml +226 -0
- data/config/locales/fr.yml +22 -22
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +1 -24
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +19 -22
- data/config/locales/id-ID.yml +1 -24
- data/config/locales/is-IS.yml +177 -0
- data/config/locales/is.yml +177 -0
- data/config/locales/it.yml +40 -40
- data/config/locales/ja-JP.yml +222 -0
- data/config/locales/ja.yml +224 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +218 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +21 -22
- data/config/locales/no.yml +26 -28
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +75 -75
- data/config/locales/pt-BR.yml +2 -25
- data/config/locales/pt.yml +60 -62
- data/config/locales/ro-RO.yml +224 -0
- data/config/locales/ru.yml +1 -24
- data/config/locales/sk-SK.yml +224 -0
- data/config/locales/sk.yml +207 -0
- data/config/locales/sl.yml +130 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +205 -0
- data/config/locales/sv.yml +22 -24
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +1 -24
- data/config/locales/uk.yml +1 -21
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +223 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200320105903_index_foreign_keys_in_decidim_accountability_results.rb +7 -0
- data/db/migrate/20200827154103_add_commentable_counter_cache_to_results.rb +9 -0
- data/lib/decidim/accountability/admin_engine.rb +4 -3
- data/lib/decidim/accountability/component.rb +7 -1
- data/lib/decidim/accountability/engine.rb +0 -1
- data/lib/decidim/accountability/test/factories.rb +3 -1
- data/lib/decidim/accountability/version.rb +1 -1
- metadata +85 -28
- data/app/controllers/decidim/accountability/result_widgets_controller.rb +0 -19
- data/app/views/decidim/accountability/admin/results/_proposals.html.erb +0 -12
- data/app/views/decidim/accountability/versions/_version.html.erb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb033d61df2ae5da6ff56d0124bf0ace65a2288f76a89cc89795bdd7f52e51bf
|
4
|
+
data.tar.gz: 3ec3d80a20393f5fa4c1c5b330c49037716a8794b2a7e49cde58b088e4e0bcc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28ba61333d2aeb51780548372f94ffd7123648c58a1b01f73de84310c169e9d6df01c0c9e4caf5820b8a8a55951113b1a8ac84f26e0f4d4ff5612771f23cae7e
|
7
|
+
data.tar.gz: a21713c1fa2238d9f64851b1ed9afc05d45d850e70e49bda306f072b87af6689ce9995d4e2cbae0a3670c0c4517bdc95ac65b9a7391dd16789a882f7444fa908
|
@@ -1,47 +1,11 @@
|
|
1
1
|
// = require_self
|
2
2
|
|
3
|
-
$("#result_decidim_accountability_status_id").change(function () {
|
4
|
-
/* eslint-disable no-invalid-this */
|
5
|
-
const progress = $(this).find(":selected").data("progress")
|
6
|
-
if (progress || progress === 0) {
|
7
|
-
$("#result_progress").val(progress);
|
8
|
-
}
|
9
|
-
});
|
10
|
-
|
11
3
|
$(function() {
|
12
|
-
$(
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
try {
|
19
|
-
xhr.abort();
|
20
|
-
} catch (exception) { xhr = null}
|
21
|
-
|
22
|
-
let url = $("#proposal-picker-choose").attr("href")
|
23
|
-
xhr = $.getJSON(
|
24
|
-
url,
|
25
|
-
{ term: term },
|
26
|
-
function(data) { response(data); }
|
27
|
-
);
|
28
|
-
},
|
29
|
-
renderItem: function (item, search) {
|
30
|
-
let sanitizedSearch = search.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
31
|
-
let re = new RegExp(`(${sanitizedSearch.split(" ").join("|")})`, "gi");
|
32
|
-
let title = item[0]
|
33
|
-
let modelId = item[1]
|
34
|
-
let val = `#${modelId}- ${title}`;
|
35
|
-
return `<div class="autocomplete-suggestion" data-model-id="${modelId}" data-val ="${title}">${val.replace(re, "<b>$1</b>")}</div>`;
|
36
|
-
},
|
37
|
-
onSelect: function(event, term, item) {
|
38
|
-
let choose = $("#proposal-picker-choose")
|
39
|
-
let modelId = item.data("modelId")
|
40
|
-
let val = `#${modelId}- ${item.data("val")}`;
|
41
|
-
choose.data("picker-value", modelId)
|
42
|
-
choose.data("picker-text", val)
|
43
|
-
choose.data("picker-choose", "")
|
44
|
-
}
|
45
|
-
})
|
4
|
+
$("#result_decidim_accountability_status_id").change(function () {
|
5
|
+
/* eslint-disable no-invalid-this */
|
6
|
+
const progress = $(this).find(":selected").data("progress")
|
7
|
+
if (progress || progress === 0) {
|
8
|
+
$("#result_progress").val(progress);
|
9
|
+
}
|
46
10
|
});
|
47
11
|
})
|
@@ -1,5 +1,13 @@
|
|
1
1
|
.accountability{
|
2
2
|
.categories{
|
3
|
+
a:hover{
|
4
|
+
text-decoration: underline;
|
5
|
+
}
|
6
|
+
|
7
|
+
a:focus{
|
8
|
+
outline: $anchor-outline-focus;
|
9
|
+
}
|
10
|
+
|
3
11
|
.categories--header{
|
4
12
|
border-bottom: 1px solid $medium-gray;
|
5
13
|
padding-bottom: 1rem;
|
@@ -10,7 +18,6 @@
|
|
10
18
|
}
|
11
19
|
|
12
20
|
span{
|
13
|
-
text-transform: uppercase;
|
14
21
|
font-size: 1.15rem;
|
15
22
|
color: lighten($dark-gray, 50);
|
16
23
|
}
|
@@ -10,7 +10,6 @@
|
|
10
10
|
|
11
11
|
p{
|
12
12
|
font-weight: 600;
|
13
|
-
text-transform: uppercase;
|
14
13
|
margin-bottom: .25rem;
|
15
14
|
display: inline-block;
|
16
15
|
margin-right: .5rem;
|
@@ -44,7 +43,6 @@
|
|
44
43
|
.scope-filters{
|
45
44
|
div{
|
46
45
|
color: lighten($dark-gray, 50);
|
47
|
-
text-transform: uppercase;
|
48
46
|
margin-bottom: .15rem;
|
49
47
|
}
|
50
48
|
|
@@ -107,7 +105,6 @@
|
|
107
105
|
margin-bottom: .5rem;
|
108
106
|
|
109
107
|
.progress-text{
|
110
|
-
text-transform: uppercase;
|
111
108
|
color: lighten($dark-gray, 30);
|
112
109
|
}
|
113
110
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<section class="section row collapse highlighted_results">
|
2
|
-
<
|
2
|
+
<h3 class="section-heading">
|
3
3
|
<%= translated_attribute(model.name) %> <a href="<%= main_component_path(model) %>" class="text-small"><%= t("decidim.participatory_spaces.highlighted_results.see_all", count: results_count) %></a>
|
4
|
-
</
|
4
|
+
</h3>
|
5
5
|
|
6
6
|
<div class="row">
|
7
7
|
<div class="columns accountability">
|
@@ -16,6 +16,6 @@
|
|
16
16
|
<%= link_to(
|
17
17
|
t("decidim.participatory_spaces.highlighted_results.see_all", count: results_count),
|
18
18
|
main_component_path(model),
|
19
|
-
class: "button button--sc
|
19
|
+
class: "button button--sc hollow button--right"
|
20
20
|
) %>
|
21
21
|
</section>
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Accountability
|
5
|
+
module Admin
|
6
|
+
# This command is executed when the user creates a Result from the admin
|
7
|
+
# panel.
|
8
|
+
class CreateImportedResult < Rectify::Command
|
9
|
+
def initialize(form, parent_id = nil)
|
10
|
+
@form = form
|
11
|
+
@parent_id = parent_id
|
12
|
+
end
|
13
|
+
|
14
|
+
# Creates the result if valid.
|
15
|
+
#
|
16
|
+
# Broadcasts :ok if successful, :invalid otherwise.
|
17
|
+
def call
|
18
|
+
return broadcast(:invalid) if @form.invalid?
|
19
|
+
|
20
|
+
transaction do
|
21
|
+
create_result
|
22
|
+
link_meetings
|
23
|
+
link_proposals
|
24
|
+
link_projects
|
25
|
+
notify_proposal_followers
|
26
|
+
end
|
27
|
+
|
28
|
+
broadcast(:ok)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
attr_reader :result
|
34
|
+
|
35
|
+
def create_result
|
36
|
+
params = {
|
37
|
+
component: @form.current_component,
|
38
|
+
scope: @form.scope,
|
39
|
+
category: @form.category,
|
40
|
+
parent_id: @parent_id,
|
41
|
+
title: @form.title,
|
42
|
+
description: @form.description,
|
43
|
+
start_date: @form.start_date,
|
44
|
+
end_date: @form.end_date,
|
45
|
+
progress: @form.progress,
|
46
|
+
decidim_accountability_status_id: @form.decidim_accountability_status_id,
|
47
|
+
external_id: @form.external_id.presence,
|
48
|
+
weight: @form.weight
|
49
|
+
}
|
50
|
+
|
51
|
+
@result = Decidim.traceability.create!(
|
52
|
+
Result,
|
53
|
+
@form.current_user,
|
54
|
+
params,
|
55
|
+
visibility: "all"
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
def proposals
|
60
|
+
@proposals ||= result.sibling_scope(:proposals).where(id: @form.proposal_ids)
|
61
|
+
end
|
62
|
+
|
63
|
+
def projects
|
64
|
+
@projects ||= result.sibling_scope(:projects).where(id: @form.project_ids)
|
65
|
+
end
|
66
|
+
|
67
|
+
def meeting_ids
|
68
|
+
@meeting_ids ||= proposals.flat_map do |proposal|
|
69
|
+
proposal.linked_resources(:meetings, "proposals_from_meeting").pluck(:id)
|
70
|
+
end.uniq
|
71
|
+
end
|
72
|
+
|
73
|
+
def meetings
|
74
|
+
@meetings ||= result.sibling_scope(:meetings).where(id: meeting_ids)
|
75
|
+
end
|
76
|
+
|
77
|
+
def link_proposals
|
78
|
+
result.link_resources(proposals, "included_proposals")
|
79
|
+
end
|
80
|
+
|
81
|
+
def link_projects
|
82
|
+
result.link_resources(projects, "included_projects")
|
83
|
+
end
|
84
|
+
|
85
|
+
def link_meetings
|
86
|
+
result.link_resources(meetings, "meetings_through_proposals")
|
87
|
+
end
|
88
|
+
|
89
|
+
def notify_proposal_followers
|
90
|
+
proposals.each do |proposal|
|
91
|
+
Decidim::EventsManager.publish(
|
92
|
+
event: "decidim.events.accountability.proposal_linked",
|
93
|
+
event_class: Decidim::Accountability::ProposalLinkedEvent,
|
94
|
+
resource: result,
|
95
|
+
affected_users: proposal.notifiable_identities,
|
96
|
+
followers: proposal.followers - proposal.notifiable_identities,
|
97
|
+
extra: {
|
98
|
+
proposal_id: proposal.id
|
99
|
+
}
|
100
|
+
)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Accountability
|
5
|
+
module Admin
|
6
|
+
# This command is executed when the user changes a Result from the admin
|
7
|
+
# panel.
|
8
|
+
class UpdateImportedResult < Rectify::Command
|
9
|
+
# Initializes an UpdateResult Command.
|
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, parent_id = nil)
|
14
|
+
@form = form
|
15
|
+
@result = result
|
16
|
+
@parent_id = parent_id
|
17
|
+
end
|
18
|
+
|
19
|
+
# Updates the result 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_result
|
27
|
+
link_proposals
|
28
|
+
link_meetings
|
29
|
+
link_projects
|
30
|
+
send_notifications if should_notify_followers?
|
31
|
+
end
|
32
|
+
|
33
|
+
broadcast(:ok)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
attr_reader :result, :form
|
39
|
+
|
40
|
+
def update_result
|
41
|
+
Decidim.traceability.update!(
|
42
|
+
result,
|
43
|
+
form.current_user,
|
44
|
+
scope: @form.scope,
|
45
|
+
category: @form.category,
|
46
|
+
parent_id: @parent_id,
|
47
|
+
title: @form.title,
|
48
|
+
description: @form.description,
|
49
|
+
start_date: @form.start_date,
|
50
|
+
end_date: @form.end_date,
|
51
|
+
progress: @form.progress,
|
52
|
+
decidim_accountability_status_id: @form.decidim_accountability_status_id,
|
53
|
+
external_id: @form.external_id.presence,
|
54
|
+
weight: @form.weight
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
def proposals
|
59
|
+
@proposals ||= result.sibling_scope(:proposals).where(id: form.proposal_ids)
|
60
|
+
end
|
61
|
+
|
62
|
+
def projects
|
63
|
+
@projects ||= result.sibling_scope(:projects).where(id: form.project_ids)
|
64
|
+
end
|
65
|
+
|
66
|
+
def meeting_ids
|
67
|
+
@meeting_ids ||= proposals.flat_map do |proposal|
|
68
|
+
proposal.linked_resources(:meetings, "proposals_from_meeting").pluck(:id)
|
69
|
+
end.uniq
|
70
|
+
end
|
71
|
+
|
72
|
+
def meetings
|
73
|
+
@meetings ||= result.sibling_scope(:meetings).where(id: meeting_ids)
|
74
|
+
end
|
75
|
+
|
76
|
+
def link_proposals
|
77
|
+
result.link_resources(proposals, "included_proposals")
|
78
|
+
end
|
79
|
+
|
80
|
+
def link_projects
|
81
|
+
result.link_resources(projects, "included_projects")
|
82
|
+
end
|
83
|
+
|
84
|
+
def link_meetings
|
85
|
+
result.link_resources(meetings, "meetings_through_proposals")
|
86
|
+
end
|
87
|
+
|
88
|
+
def send_notifications
|
89
|
+
result.linked_resources(:proposals, "included_proposals").each do |proposal|
|
90
|
+
Decidim::EventsManager.publish(
|
91
|
+
event: "decidim.events.accountability.result_progress_updated",
|
92
|
+
event_class: Decidim::Accountability::ResultProgressUpdatedEvent,
|
93
|
+
resource: result,
|
94
|
+
affected_users: proposal.notifiable_identities,
|
95
|
+
followers: proposal.followers - proposal.notifiable_identities,
|
96
|
+
extra: {
|
97
|
+
progress: result.progress,
|
98
|
+
proposal_id: proposal.id
|
99
|
+
}
|
100
|
+
)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def should_notify_followers?
|
105
|
+
result.previous_changes["progress"].present?
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Accountability
|
5
|
+
module Admin
|
6
|
+
# This controller allows an admin to import results from a csv file for the Accountability component
|
7
|
+
class ImportResultsController < Admin::ApplicationController
|
8
|
+
def new
|
9
|
+
@errors = []
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
@csv_file = params[:csv_file]
|
14
|
+
redirect_to(new_import_path) && return if @csv_file.blank?
|
15
|
+
|
16
|
+
Decidim::Accountability::Admin::ImportResultsCSVJob.perform_later(current_user, current_component, @csv_file.read.force_encoding("utf-8").encode("utf-8"))
|
17
|
+
|
18
|
+
flash[:notice] = I18n.t("imports.create.success", scope: "decidim.accountability.admin")
|
19
|
+
redirect_to import_results_path(current_participatory_process, current_component)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def current_component
|
25
|
+
@current_component ||= current_participatory_process.components.find(params[:component_id])
|
26
|
+
end
|
27
|
+
|
28
|
+
def current_participatory_process
|
29
|
+
@current_participatory_process ||= ParticipatoryProcess.find_by(slug: params[:participatory_process_slug])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -7,6 +7,8 @@ module Decidim
|
|
7
7
|
class ResultsController < Admin::ApplicationController
|
8
8
|
include Decidim::ApplicationHelper
|
9
9
|
include Decidim::SanitizeHelper
|
10
|
+
include Decidim::Proposals::Admin::Picker
|
11
|
+
|
10
12
|
helper_method :results, :parent_result, :parent_results, :statuses, :present
|
11
13
|
|
12
14
|
def new
|
@@ -70,26 +72,6 @@ module Decidim
|
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
73
|
-
def proposals
|
74
|
-
respond_to do |format|
|
75
|
-
format.html do
|
76
|
-
render partial: "proposals"
|
77
|
-
end
|
78
|
-
format.json do
|
79
|
-
query = Decidim.find_resource_manifest(:proposals)
|
80
|
-
.try(:resource_scope, current_component)&.order(title: :asc)
|
81
|
-
term = params[:term]
|
82
|
-
if term&.start_with?("#")
|
83
|
-
term.delete!("#")
|
84
|
-
query = query.where("CAST(id AS TEXT) LIKE ?", "#{term}%")
|
85
|
-
else
|
86
|
-
query = query.where("title ilike ?", "%#{params[:term]}%")
|
87
|
-
end
|
88
|
-
render json: query.all.collect { |p| [decidim_html_escape(present(p).title), p.id] }
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
75
|
private
|
94
76
|
|
95
77
|
def results
|
@@ -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
|
|