decidim-proposals 0.10.1 → 0.11.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +3 -3
- data/app/assets/javascripts/decidim/proposals/admin/proposals.es6 +6 -7
- data/app/assets/javascripts/decidim/proposals/identity_selector_dialog.js.es6 +17 -17
- data/app/assets/javascripts/decidim/proposals/utils.js.es6 +2 -2
- data/app/commands/decidim/proposals/admin/create_proposal.rb +2 -2
- data/app/commands/decidim/proposals/admin/import_proposals.rb +16 -8
- data/app/commands/decidim/proposals/create_proposal.rb +6 -6
- data/app/commands/decidim/proposals/destroy_proposal.rb +33 -0
- data/app/commands/decidim/proposals/update_proposal.rb +4 -4
- data/app/controllers/decidim/proposals/admin/application_controller.rb +2 -2
- data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +1 -1
- data/app/controllers/decidim/proposals/admin/proposal_notes_controller.rb +1 -1
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -2
- data/app/controllers/decidim/proposals/admin/proposals_imports_controller.rb +4 -4
- data/app/controllers/decidim/proposals/application_controller.rb +5 -5
- data/app/controllers/decidim/proposals/proposal_endorsements_controller.rb +1 -1
- data/app/controllers/decidim/proposals/proposal_votes_controller.rb +1 -1
- data/app/controllers/decidim/proposals/proposal_widgets_controller.rb +1 -1
- data/app/controllers/decidim/proposals/proposals_controller.rb +52 -24
- data/app/events/decidim/proposals/proposal_mentioned_event.rb +19 -0
- data/app/forms/decidim/proposals/admin/proposal_form.rb +3 -3
- data/app/forms/decidim/proposals/admin/proposals_import_form.rb +9 -9
- data/app/forms/decidim/proposals/proposal_form.rb +5 -4
- data/app/helpers/decidim/proposals/application_helper.rb +38 -3
- data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +7 -3
- data/app/helpers/decidim/proposals/proposal_votes_helper.rb +9 -9
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +2 -1
- data/app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb +28 -0
- data/app/jobs/decidim/proposals/settings_change_job.rb +4 -4
- data/app/models/decidim/proposals/abilities/admin_ability.rb +4 -4
- data/app/models/decidim/proposals/abilities/current_user_ability.rb +12 -12
- data/app/models/decidim/proposals/abilities/participatory_process_admin_ability.rb +8 -8
- data/app/models/decidim/proposals/abilities/participatory_process_moderator_ability.rb +1 -1
- data/app/models/decidim/proposals/proposal.rb +7 -7
- data/app/models/decidim/proposals/proposal_endorsement.rb +6 -2
- data/app/presenters/decidim/proposals/proposal_presenter.rb +12 -0
- data/app/queries/decidim/proposals/filtered_proposals.rb +9 -9
- data/app/queries/decidim/proposals/similar_proposals.rb +9 -9
- data/app/services/decidim/proposals/proposal_search.rb +1 -1
- data/app/types/decidim/proposals/proposal_type.rb +17 -2
- data/app/types/decidim/proposals/proposals_type.rb +6 -6
- data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_proposals.html.erb +1 -1
- data/app/views/decidim/participatory_processes/participatory_process_groups/_proposal.html.erb +1 -1
- data/app/views/decidim/participatory_spaces/_highlighted_proposals.html.erb +2 -2
- data/app/views/decidim/participatory_spaces/_proposal.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposal_notes/_form.html.erb +2 -2
- data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposal_notes/index.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +2 -2
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/new.html.erb +2 -2
- data/app/views/decidim/proposals/admin/proposals/update_category.js.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +3 -3
- data/app/views/decidim/proposals/admin/shared/_info_proposal.html.erb +1 -1
- data/app/views/decidim/proposals/proposal_endorsements/_identity.html.erb +2 -2
- data/app/views/decidim/proposals/proposal_endorsements/identities.html.erb +2 -2
- data/app/views/decidim/proposals/proposal_endorsements/update_buttons_and_counters.js.erb +19 -8
- data/app/views/decidim/proposals/proposals/_endorsement_button.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_endorsement_identities_cabin.html.erb +3 -3
- data/app/views/decidim/proposals/proposals/_endorsements_card_row.html.erb +4 -4
- data/app/views/decidim/proposals/proposals/_endorsements_count.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_filters.html.erb +10 -10
- data/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_identities_listing.html.erb +30 -0
- data/app/views/decidim/proposals/proposals/{_endorsement_xxs.html.erb → _identity_xxs.html.erb} +1 -2
- data/app/views/decidim/proposals/proposals/_proposal.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_tags.html.erb +25 -0
- data/app/views/decidim/proposals/proposals/_vote_button.html.erb +7 -7
- data/app/views/decidim/proposals/proposals/_votes_count.html.erb +6 -5
- data/app/views/decidim/proposals/proposals/_voting_rules.html.erb +7 -7
- data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +5 -5
- data/app/views/decidim/proposals/proposals/compare.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/complete.html.erb +70 -0
- data/app/views/decidim/proposals/proposals/edit.html.erb +3 -3
- data/app/views/decidim/proposals/proposals/edit_draft.html.erb +5 -3
- data/app/views/decidim/proposals/proposals/index.html.erb +5 -5
- data/app/views/decidim/proposals/proposals/new.html.erb +1 -43
- data/app/views/decidim/proposals/proposals/preview.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/show.html.erb +16 -23
- data/config/locales/ca.yml +69 -55
- data/config/locales/en.yml +64 -50
- data/config/locales/es.yml +73 -59
- data/config/locales/eu.yml +64 -50
- data/config/locales/fi.yml +64 -50
- data/config/locales/fr.yml +75 -61
- data/config/locales/gl.yml +64 -50
- data/config/locales/it.yml +64 -50
- data/config/locales/nl.yml +153 -139
- data/config/locales/pl.yml +64 -50
- data/config/locales/pt-BR.yml +64 -50
- data/config/locales/pt.yml +64 -50
- data/config/locales/ru.yml +0 -9
- data/config/locales/sv.yml +64 -50
- data/config/locales/uk.yml +2 -16
- data/db/migrate/20171212102250_enable_pg_extensions.rb +12 -1
- data/db/migrate/20180305133811_rename_features_to_components_at_proposals.rb +11 -0
- data/db/migrate/20180413135249_fix_nil_threshold_per_proposal.rb +18 -0
- data/lib/decidim/content_parsers/proposal_parser.rb +95 -0
- data/lib/decidim/content_renderers/proposal_renderer.rb +33 -0
- data/lib/decidim/proposals.rb +9 -1
- data/lib/decidim/proposals/commentable_proposal.rb +3 -3
- data/lib/decidim/proposals/{feature.rb → component.rb} +39 -38
- data/lib/decidim/proposals/engine.rb +21 -6
- data/lib/decidim/proposals/proposal_serializer.rb +3 -3
- data/lib/decidim/proposals/test/factories.rb +5 -8
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +32 -23
- data/app/views/decidim/proposals/proposals/_endorsements_listing.html.erb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61f120f1a36e87a9527996ea017a92f0b86b86568238b2f3da8d3a1e71f6f2b8
|
4
|
+
data.tar.gz: 9f16f208205af60021e22ebe63b5de3777257b307bb20df62fe3b21854af8743
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 422a99e81a8365aedcaf35b849878c314fad0175bb2de621b15e64d9764583488c5639a8879b6ffda09b57e21f36474ed29078debdbcfdd0d4d5b500fa942b8b
|
7
|
+
data.tar.gz: dc7f9546a449a83fd9625ae16c8dadb319784e57bdb3ccd7e455a341c9bf9b8442d060c902a2d04ed9de2cb82d4b7888516a1b2ab94f65dc4144bb9de30aa1fa
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Decidim::Proposals
|
2
2
|
|
3
|
-
The Proposals module adds one of the main
|
3
|
+
The Proposals module adds one of the main components of Decidim: allows users to contribute to a participatory process by creating proposals.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
|
-
Proposals will be available as a
|
7
|
+
Proposals will be available as a Component for a Participatory Process.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -2,8 +2,8 @@ $(() => {
|
|
2
2
|
window.DecidimProposals = window.DecidimProposals || {};
|
3
3
|
|
4
4
|
window.DecidimProposals.bindProposalAddress = () => {
|
5
|
-
const $checkbox = $(
|
6
|
-
const $addressInput = $(
|
5
|
+
const $checkbox = $("#proposal_has_address");
|
6
|
+
const $addressInput = $("#address_input");
|
7
7
|
|
8
8
|
if ($checkbox.length > 0) {
|
9
9
|
const toggleInput = () => {
|
@@ -14,7 +14,7 @@ $(() => {
|
|
14
14
|
}
|
15
15
|
}
|
16
16
|
toggleInput();
|
17
|
-
$checkbox.on(
|
17
|
+
$checkbox.on("change", toggleInput);
|
18
18
|
}
|
19
19
|
};
|
20
20
|
|
@@ -4,7 +4,7 @@ $(document).ready(function () {
|
|
4
4
|
return $('.table-list .js-check-all-proposal:checked').length
|
5
5
|
}
|
6
6
|
|
7
|
-
|
7
|
+
window.selectedProposalsCountUpdate = function() {
|
8
8
|
if(selectedProposalsCount() == 0){
|
9
9
|
$("#js-recategorize-proposals-count").text("")
|
10
10
|
} else {
|
@@ -25,7 +25,7 @@ $(document).ready(function () {
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
28
|
-
|
28
|
+
window.showOtherActionsButtons = function() {
|
29
29
|
$("#js-other-actions-wrapper").removeClass('hide');
|
30
30
|
}
|
31
31
|
|
@@ -37,13 +37,12 @@ $(document).ready(function () {
|
|
37
37
|
$("#js-recategorize-proposals-actions").removeClass('hide');
|
38
38
|
}
|
39
39
|
|
40
|
-
|
41
|
-
$("#js-recategorize-proposals-actions").addClass('hide');
|
40
|
+
window.hideRecategorizeProposalActions = function() {
|
41
|
+
return $("#js-recategorize-proposals-actions").addClass('hide');
|
42
42
|
}
|
43
43
|
|
44
|
-
|
45
44
|
if ($('#js-form-recategorize-proposals').length) {
|
46
|
-
hideRecategorizeProposalActions();
|
45
|
+
window.hideRecategorizeProposalActions();
|
47
46
|
$("#js-bulk-actions-button").addClass('hide');
|
48
47
|
|
49
48
|
$("#js-bulk-actions-recategorize").click(function(e){
|
@@ -105,7 +104,7 @@ $(document).ready(function () {
|
|
105
104
|
});
|
106
105
|
|
107
106
|
$('#js-cancel-edit-category').on('click', function (e) {
|
108
|
-
hideRecategorizeProposalActions()
|
107
|
+
window.hideRecategorizeProposalActions()
|
109
108
|
showBulkActionsButton();
|
110
109
|
showOtherActionsButtons();
|
111
110
|
});
|
@@ -5,17 +5,17 @@
|
|
5
5
|
*/
|
6
6
|
$(document).ready(function () {
|
7
7
|
|
8
|
-
let button = $(
|
8
|
+
let button = $("#select-identity-button"),
|
9
9
|
refreshUrl = null,
|
10
|
-
userIdentitiesDialog = $(
|
10
|
+
userIdentitiesDialog = $("#user-identities");
|
11
11
|
|
12
12
|
if (userIdentitiesDialog.length) {
|
13
|
-
refreshUrl = userIdentitiesDialog.data(
|
13
|
+
refreshUrl = userIdentitiesDialog.data("refresh-url");
|
14
14
|
|
15
15
|
button.click(function () {
|
16
16
|
$.ajax(refreshUrl).done(function(response) {
|
17
|
-
userIdentitiesDialog.html(response).foundation(
|
18
|
-
button.trigger(
|
17
|
+
userIdentitiesDialog.html(response).foundation("open");
|
18
|
+
button.trigger("ajax:success")
|
19
19
|
});
|
20
20
|
});
|
21
21
|
}
|
@@ -27,26 +27,26 @@ $(document).ready(function () {
|
|
27
27
|
*
|
28
28
|
*/
|
29
29
|
$(document).ready(function () {
|
30
|
-
$("#select-identity-button").on(
|
30
|
+
$("#select-identity-button").on("ajax:success", function() {
|
31
31
|
// once reveal popup has been rendered register event callbacks
|
32
32
|
$("#user-identities ul.reveal__list li").each(function(index, elem) {
|
33
33
|
let liTag = $(elem)
|
34
|
-
liTag.on(
|
35
|
-
let method = liTag.data(
|
36
|
-
let url = liTag.data(
|
34
|
+
liTag.on("click", function() {
|
35
|
+
let method = liTag.data("method")
|
36
|
+
let url = liTag.data("url")
|
37
37
|
$.ajax({
|
38
38
|
url: url,
|
39
39
|
method: method,
|
40
|
-
dataType:
|
40
|
+
dataType: "script",
|
41
41
|
success: function() {
|
42
|
-
if (liTag.hasClass(
|
43
|
-
liTag.removeClass(
|
44
|
-
liTag.find(
|
45
|
-
liTag.data(
|
42
|
+
if (liTag.hasClass("selected")) {
|
43
|
+
liTag.removeClass("selected")
|
44
|
+
liTag.find(".icon--circle-check").addClass("invisible")
|
45
|
+
liTag.data("method", "post")
|
46
46
|
} else {
|
47
|
-
liTag.addClass(
|
48
|
-
liTag.find(
|
49
|
-
liTag.data(
|
47
|
+
liTag.addClass("selected")
|
48
|
+
liTag.find(".icon--circle-check").removeClass("invisible")
|
49
|
+
liTag.data("method", "delete")
|
50
50
|
}
|
51
51
|
}
|
52
52
|
})
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
(() => {
|
4
4
|
$("#vote_button").mouseover(function () {
|
5
|
-
$(this).text($(this).data(
|
5
|
+
$(this).text($(this).data("replace"));
|
6
6
|
});
|
7
7
|
|
8
8
|
$("#vote_button").mouseout(function () {
|
9
|
-
$(this).text($(this).data(
|
9
|
+
$(this).text($(this).data("original"));
|
10
10
|
});
|
11
11
|
})(this);
|
@@ -53,7 +53,7 @@ module Decidim
|
|
53
53
|
body: form.body,
|
54
54
|
category: form.category,
|
55
55
|
scope: form.scope,
|
56
|
-
|
56
|
+
component: form.component,
|
57
57
|
address: form.address,
|
58
58
|
latitude: form.latitude,
|
59
59
|
longitude: form.longitude,
|
@@ -86,7 +86,7 @@ module Decidim
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def attachments_allowed?
|
89
|
-
form.
|
89
|
+
form.current_component.settings.attachments_allowed?
|
90
90
|
end
|
91
91
|
|
92
92
|
def process_attachments?
|
@@ -31,6 +31,8 @@ module Decidim
|
|
31
31
|
|
32
32
|
def import_proposals
|
33
33
|
proposals.map do |original_proposal|
|
34
|
+
next if proposal_already_copied?(original_proposal, target_component)
|
35
|
+
|
34
36
|
origin_attributes = original_proposal.attributes.except(
|
35
37
|
"id",
|
36
38
|
"created_at",
|
@@ -38,7 +40,7 @@ module Decidim
|
|
38
40
|
"state",
|
39
41
|
"answer",
|
40
42
|
"answered_at",
|
41
|
-
"
|
43
|
+
"decidim_component_id",
|
42
44
|
"reference",
|
43
45
|
"proposal_votes_count",
|
44
46
|
"proposal_notes_count"
|
@@ -46,16 +48,16 @@ module Decidim
|
|
46
48
|
|
47
49
|
proposal = Decidim::Proposals::Proposal.new(origin_attributes)
|
48
50
|
proposal.category = original_proposal.category
|
49
|
-
proposal.
|
51
|
+
proposal.component = target_component
|
50
52
|
proposal.save!
|
51
53
|
|
52
54
|
proposal.link_resources([original_proposal], "copied_from_component")
|
53
|
-
end
|
55
|
+
end.compact
|
54
56
|
end
|
55
57
|
|
56
58
|
def proposals
|
57
59
|
Decidim::Proposals::Proposal
|
58
|
-
.where(
|
60
|
+
.where(component: origin_component)
|
59
61
|
.where(state: proposal_states)
|
60
62
|
end
|
61
63
|
|
@@ -70,12 +72,18 @@ module Decidim
|
|
70
72
|
@proposal_states
|
71
73
|
end
|
72
74
|
|
73
|
-
def
|
74
|
-
@form.
|
75
|
+
def origin_component
|
76
|
+
@form.origin_component
|
75
77
|
end
|
76
78
|
|
77
|
-
def
|
78
|
-
@form.
|
79
|
+
def target_component
|
80
|
+
@form.current_component
|
81
|
+
end
|
82
|
+
|
83
|
+
def proposal_already_copied?(original_proposal, target_component)
|
84
|
+
original_proposal.linked_resources(:proposals, "copied_from_component").any? do |proposal|
|
85
|
+
proposal.component == target_component
|
86
|
+
end
|
79
87
|
end
|
80
88
|
end
|
81
89
|
end
|
@@ -52,7 +52,7 @@ module Decidim
|
|
52
52
|
scope: form.scope,
|
53
53
|
author: @current_user,
|
54
54
|
decidim_user_group_id: form.user_group_id,
|
55
|
-
|
55
|
+
component: form.component,
|
56
56
|
address: form.address,
|
57
57
|
latitude: form.latitude,
|
58
58
|
longitude: form.longitude
|
@@ -84,7 +84,7 @@ module Decidim
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def attachments_allowed?
|
87
|
-
form.
|
87
|
+
form.current_component.settings.attachments_allowed?
|
88
88
|
end
|
89
89
|
|
90
90
|
def process_attachments?
|
@@ -92,7 +92,7 @@ module Decidim
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def proposal_limit_reached?
|
95
|
-
proposal_limit = form.
|
95
|
+
proposal_limit = form.current_component.settings.proposal_limit
|
96
96
|
|
97
97
|
return false if proposal_limit.zero?
|
98
98
|
|
@@ -104,7 +104,7 @@ module Decidim
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def user_group
|
107
|
-
@user_group ||= Decidim::UserGroup.
|
107
|
+
@user_group ||= Decidim::UserGroup.find_by(organization: organization, id: form.user_group_id)
|
108
108
|
end
|
109
109
|
|
110
110
|
def organization
|
@@ -112,11 +112,11 @@ module Decidim
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def current_user_proposals
|
115
|
-
Proposal.where(author: @current_user,
|
115
|
+
Proposal.where(author: @current_user, component: form.current_component).except_withdrawn
|
116
116
|
end
|
117
117
|
|
118
118
|
def user_group_proposals
|
119
|
-
Proposal.where(user_group: @user_group,
|
119
|
+
Proposal.where(user_group: @user_group, component: form.current_component).except_withdrawn
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
# A command with all the business logic when a user destroys a draft proposal.
|
6
|
+
class DestroyProposal < Rectify::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# proposal - The proposal to destroy.
|
10
|
+
# current_user - The current user.
|
11
|
+
def initialize(proposal, current_user)
|
12
|
+
@proposal = proposal
|
13
|
+
@current_user = current_user
|
14
|
+
end
|
15
|
+
|
16
|
+
# Executes the command. Broadcasts these events:
|
17
|
+
#
|
18
|
+
# - :ok when everything is valid and the proposal is deleted.
|
19
|
+
# - :invalid if the proposal is not a draft.
|
20
|
+
# - :invalid if the proposal's author is not the current user.
|
21
|
+
#
|
22
|
+
# Returns nothing.
|
23
|
+
def call
|
24
|
+
return broadcast(:invalid) unless @proposal.draft?
|
25
|
+
return broadcast(:invalid) if @proposal.author != @current_user
|
26
|
+
|
27
|
+
@proposal.destroy!
|
28
|
+
|
29
|
+
broadcast(:ok, @proposal)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -52,7 +52,7 @@ module Decidim
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def proposal_limit_reached?
|
55
|
-
proposal_limit = form.
|
55
|
+
proposal_limit = form.current_component.settings.proposal_limit
|
56
56
|
|
57
57
|
return false if proposal_limit.zero?
|
58
58
|
|
@@ -64,7 +64,7 @@ module Decidim
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def user_group
|
67
|
-
@user_group ||= Decidim::UserGroup.
|
67
|
+
@user_group ||= Decidim::UserGroup.find_by(organization: organization, id: form.user_group_id)
|
68
68
|
end
|
69
69
|
|
70
70
|
def organization
|
@@ -72,11 +72,11 @@ module Decidim
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def current_user_proposals
|
75
|
-
Proposal.where(author: current_user,
|
75
|
+
Proposal.where(author: current_user, component: form.current_component).published.where.not(id: proposal.id)
|
76
76
|
end
|
77
77
|
|
78
78
|
def user_group_proposals
|
79
|
-
Proposal.where(user_group: user_group,
|
79
|
+
Proposal.where(user_group: user_group, component: form.current_component).published.where.not(id: proposal.id)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -6,9 +6,9 @@ module Decidim
|
|
6
6
|
# This controller is the abstract class from which all other controllers of
|
7
7
|
# this engine inherit.
|
8
8
|
#
|
9
|
-
# Note that it inherits from `Decidim::Admin::
|
9
|
+
# Note that it inherits from `Decidim::Admin::Components::BaseController`, which
|
10
10
|
# override its layout and provide all kinds of useful methods.
|
11
|
-
class ApplicationController < Decidim::Admin::
|
11
|
+
class ApplicationController < Decidim::Admin::Components::BaseController
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -64,7 +64,7 @@ module Decidim
|
|
64
64
|
private
|
65
65
|
|
66
66
|
def query
|
67
|
-
@query ||= Proposal.where(
|
67
|
+
@query ||= Proposal.where(component: current_component).published.ransack(params[:q])
|
68
68
|
end
|
69
69
|
|
70
70
|
def proposals
|
@@ -72,7 +72,7 @@ module Decidim
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def proposal
|
75
|
-
@proposal ||= Proposal.where(
|
75
|
+
@proposal ||= Proposal.where(component: current_component).find(params[:id])
|
76
76
|
end
|
77
77
|
|
78
78
|
def update_proposals_category_response_successful(response)
|
@@ -5,22 +5,22 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
class ProposalsImportsController < Admin::ApplicationController
|
7
7
|
def new
|
8
|
-
authorize! :manage,
|
8
|
+
authorize! :manage, current_component
|
9
9
|
|
10
10
|
@form = form(Admin::ProposalsImportForm).instance
|
11
11
|
end
|
12
12
|
|
13
13
|
def create
|
14
|
-
authorize! :manage,
|
14
|
+
authorize! :manage, current_component
|
15
15
|
|
16
16
|
@form = form(Admin::ProposalsImportForm).from_params(params)
|
17
17
|
|
18
|
-
authorize! :manage, @form.
|
18
|
+
authorize! :manage, @form.origin_component
|
19
19
|
|
20
20
|
Admin::ImportProposals.call(@form) do
|
21
21
|
on(:ok) do |proposals|
|
22
22
|
flash[:notice] = I18n.t("proposals_imports.create.success", scope: "decidim.proposals.admin", number: proposals.length)
|
23
|
-
redirect_to EngineRouter.admin_proxy(
|
23
|
+
redirect_to EngineRouter.admin_proxy(current_component).root_path
|
24
24
|
end
|
25
25
|
|
26
26
|
on(:invalid) do
|
@@ -5,9 +5,9 @@ module Decidim
|
|
5
5
|
# This controller is the abstract class from which all other controllers of
|
6
6
|
# this engine inherit.
|
7
7
|
#
|
8
|
-
# Note that it inherits from `Decidim::
|
8
|
+
# Note that it inherits from `Decidim::Components::BaseController`, which
|
9
9
|
# override its layout and provide all kinds of useful methods.
|
10
|
-
class ApplicationController < Decidim::
|
10
|
+
class ApplicationController < Decidim::Components::BaseController
|
11
11
|
helper Decidim::Messaging::ConversationHelper
|
12
12
|
|
13
13
|
helper_method :proposal_limit_reached?
|
@@ -15,8 +15,8 @@ module Decidim
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def proposal_limit
|
18
|
-
return nil if
|
19
|
-
|
18
|
+
return nil if component_settings.proposal_limit.zero?
|
19
|
+
component_settings.proposal_limit
|
20
20
|
end
|
21
21
|
|
22
22
|
def proposal_limit_reached?
|
@@ -26,7 +26,7 @@ module Decidim
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def proposals
|
29
|
-
Proposal.where(
|
29
|
+
Proposal.where(component: current_component)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|