decidim-proposals 0.19.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/admin/decidim_proposals_manifest.js +1 -0
- data/app/assets/images/decidim/gamification/badges/accepted_proposals.svg +1 -234
- data/app/assets/images/decidim/gamification/badges/proposal_votes.svg +1 -95
- data/app/assets/images/decidim/gamification/badges/proposals.svg +1 -229
- data/app/assets/images/decidim/proposals/icon.svg +1 -3
- data/app/assets/javascripts/decidim/proposals/admin/proposals.es6 +24 -11
- data/app/assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 +0 -5
- data/app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6 +35 -0
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +1 -1
- data/app/cells/decidim/proposals/collaborative_draft_m/footer.erb +1 -1
- data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -1
- data/app/cells/decidim/proposals/cost_report/show.erb +35 -0
- data/app/cells/decidim/proposals/cost_report_cell.rb +42 -0
- data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +3 -3
- data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +1 -1
- data/app/cells/decidim/proposals/irreversible_action_modal/show.erb +2 -2
- data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +1 -1
- data/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb +1 -1
- data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +1 -1
- data/app/cells/decidim/proposals/proposal_m/footer.erb +4 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +37 -9
- data/app/cells/decidim/proposals/proposal_tags/show.erb +18 -10
- data/app/cells/decidim/proposals/proposal_tags_cell.rb +5 -0
- data/app/cells/decidim/proposals/proposals_picker/proposals.erb +12 -0
- data/app/cells/decidim/proposals/proposals_picker/show.erb +14 -0
- data/app/cells/decidim/proposals/proposals_picker_cell.rb +72 -0
- data/app/commands/decidim/proposals/admin/answer_proposal.rb +24 -46
- data/app/commands/decidim/proposals/admin/assign_proposals_to_valuator.rb +61 -0
- data/app/commands/decidim/proposals/admin/create_proposal.rb +6 -1
- data/app/commands/decidim/proposals/admin/create_proposal_note.rb +15 -0
- data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +85 -0
- data/app/commands/decidim/proposals/admin/publish_answers.rb +67 -0
- data/app/commands/decidim/proposals/admin/unassign_proposals_from_valuator.rb +62 -0
- data/app/commands/decidim/proposals/admin/update_proposal.rb +1 -1
- data/app/commands/decidim/proposals/admin/update_proposal_scope.rb +75 -0
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/create_proposal.rb +1 -1
- data/app/commands/decidim/proposals/gallery_methods.rb +2 -51
- data/app/commands/decidim/proposals/update_proposal.rb +1 -1
- data/app/controllers/concerns/decidim/proposals/admin/filterable.rb +82 -0
- data/app/controllers/concerns/decidim/proposals/admin/picker.rb +21 -0
- data/app/controllers/concerns/decidim/proposals/orderable.rb +13 -2
- data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +16 -6
- data/app/controllers/decidim/proposals/admin/proposal_notes_controller.rb +8 -9
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +105 -29
- data/app/controllers/decidim/proposals/admin/valuation_assignments_controller.rb +58 -0
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +19 -3
- data/app/controllers/decidim/proposals/proposals_controller.rb +45 -11
- data/app/controllers/decidim/proposals/versions_controller.rb +9 -16
- data/app/events/decidim/proposals/admin/proposal_note_created_event.rb +27 -0
- data/app/events/decidim/proposals/admin/update_proposal_scope_event.rb +11 -0
- data/app/forms/decidim/proposals/admin/participatory_text_proposal_form.rb +13 -0
- data/app/forms/decidim/proposals/admin/preview_participatory_text_form.rb +2 -2
- data/app/forms/decidim/proposals/admin/proposal_answer_form.rb +27 -2
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +129 -0
- data/app/forms/decidim/proposals/admin/proposal_form.rb +2 -120
- data/app/forms/decidim/proposals/admin/valuation_assignment_form.rb +37 -0
- data/app/forms/decidim/proposals/proposal_form.rb +4 -0
- data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +13 -1
- data/app/helpers/decidim/proposals/admin/filterable_helper.rb +17 -0
- data/app/helpers/decidim/proposals/admin/proposal_bulk_actions_helper.rb +35 -0
- data/app/helpers/decidim/proposals/admin/proposal_rankings_helper.rb +63 -0
- data/app/helpers/decidim/proposals/admin/proposals_helper.rb +122 -0
- data/app/helpers/decidim/proposals/admin/proposals_picker_helper.rb +30 -0
- data/app/helpers/decidim/proposals/application_helper.rb +51 -30
- data/app/helpers/decidim/proposals/collaborative_draft_helper.rb +9 -9
- data/app/helpers/decidim/proposals/control_version_helper.rb +1 -37
- data/app/helpers/decidim/proposals/proposal_cells_helper.rb +1 -1
- data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +0 -145
- data/app/helpers/decidim/proposals/proposal_votes_helper.rb +2 -2
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +24 -7
- data/app/helpers/decidim/proposals/proposals_helper.rb +66 -0
- data/app/models/decidim/proposals/proposal.rb +167 -29
- data/app/models/decidim/proposals/valuation_assignment.rb +24 -0
- data/app/permissions/decidim/proposals/admin/permissions.rb +77 -11
- data/app/permissions/decidim/proposals/permissions.rb +1 -22
- data/app/presenters/decidim/proposals/admin_log/proposal_presenter.rb +1 -1
- data/app/presenters/decidim/proposals/admin_log/valuation_assignment_presenter.rb +51 -0
- data/app/presenters/decidim/proposals/admin_log/value_types/valuator_role_user_presenter.rb +19 -0
- data/app/presenters/decidim/proposals/collaborative_draft_presenter.rb +2 -28
- data/app/presenters/decidim/proposals/log/valuation_assignment_presenter.rb +22 -0
- data/app/presenters/decidim/proposals/proposal_presenter.rb +41 -10
- data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +1 -2
- data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +15 -12
- data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +5 -4
- data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +2 -8
- data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +3 -9
- data/app/services/decidim/proposals/collaborative_draft_search.rb +18 -10
- data/app/services/decidim/proposals/diff_renderer.rb +2 -0
- data/app/services/decidim/proposals/proposal_builder.rb +1 -1
- data/app/services/decidim/proposals/proposal_search.rb +45 -47
- data/app/types/decidim/proposals/proposal_input_filter.rb +29 -0
- data/app/types/decidim/proposals/proposal_input_sort.rb +22 -0
- data/app/types/decidim/proposals/proposal_type.rb +32 -11
- data/app/types/decidim/proposals/proposals_type.rb +22 -15
- data/app/validators/proposal_length_validator.rb +38 -0
- data/app/views/decidim/proposals/admin/participatory_texts/index.html.erb +9 -1
- data/app/views/decidim/proposals/admin/proposal_answers/_form.html.erb +35 -0
- data/app/views/decidim/proposals/admin/proposal_notes/_form.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +3 -3
- data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +8 -2
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +4 -24
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +25 -17
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_assign_to_valuator.html.erb +15 -0
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_dropdown.html.erb +21 -1
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_publish_answers.html.erb +14 -0
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_scope-change.html.erb +25 -0
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_unassign_from_valuator.html.erb +15 -0
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +16 -7
- data/app/views/decidim/proposals/admin/proposals/publish_answers.js.erb +12 -0
- data/app/views/decidim/proposals/admin/proposals/show.html.erb +186 -0
- data/app/views/decidim/proposals/admin/proposals/update_category.js.erb +3 -2
- data/app/views/decidim/proposals/admin/proposals/update_scope.js.erb +27 -0
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +6 -4
- data/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +9 -7
- data/app/views/decidim/proposals/collaborative_drafts/_new_collaborative_draft_button.html.erb +4 -4
- data/app/views/decidim/proposals/collaborative_drafts/_reject_request_access_form.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +4 -2
- data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +2 -0
- data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +2 -0
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +3 -1
- data/app/views/decidim/proposals/collaborative_drafts/index.html.erb +4 -2
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +4 -0
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +29 -30
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +6 -4
- data/app/views/decidim/proposals/proposals/_endorsements_card_row.html.erb +0 -16
- data/app/views/decidim/proposals/proposals/_filters.html.erb +19 -17
- data/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +1 -4
- data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +1 -11
- data/app/views/decidim/proposals/proposals/_proposal_similar.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_proposals.html.erb +14 -0
- data/app/views/decidim/proposals/proposals/_vote_button.html.erb +14 -7
- data/app/views/decidim/proposals/proposals/_wizard_aside.html.erb +4 -2
- data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +4 -3
- data/app/views/decidim/proposals/proposals/compare.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/complete.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/edit.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/edit_draft.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/index.html.erb +7 -12
- data/app/views/decidim/proposals/proposals/new.html.erb +6 -2
- data/app/views/decidim/proposals/proposals/participatory_texts/_index.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +10 -3
- data/app/views/decidim/proposals/proposals/participatory_texts/_view_index.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/preview.html.erb +7 -8
- data/app/views/decidim/proposals/proposals/show.html.erb +62 -71
- data/app/views/decidim/proposals/versions/index.html.erb +14 -32
- data/app/views/decidim/proposals/versions/show.html.erb +16 -34
- data/config/locales/ar.yml +74 -66
- data/config/locales/bg-BG.yml +237 -0
- data/config/locales/ca.yml +173 -65
- data/config/locales/cs.yml +187 -79
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/de.yml +266 -162
- data/config/locales/el-GR.yml +1 -0
- data/config/locales/el.yml +876 -0
- data/config/locales/en.yml +179 -71
- data/config/locales/es-MX.yml +173 -63
- data/config/locales/es-PY.yml +173 -63
- data/config/locales/es.yml +173 -65
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/eu.yml +43 -63
- data/config/locales/fi-plain.yml +173 -65
- data/config/locales/fi.yml +215 -107
- data/config/locales/fr-CA.yml +876 -0
- data/config/locales/fr.yml +151 -65
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +43 -63
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hu.yml +153 -75
- data/config/locales/id-ID.yml +43 -62
- data/config/locales/is-IS.yml +274 -0
- data/config/locales/it.yml +172 -82
- data/config/locales/ja-JP.yml +886 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lv-LV.yml +858 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/nl.yml +274 -188
- data/config/locales/no.yml +786 -0
- data/config/locales/pl.yml +194 -66
- data/config/locales/pt-BR.yml +44 -67
- data/config/locales/pt.yml +437 -331
- data/config/locales/ro-RO.yml +840 -0
- data/config/locales/ru.yml +14 -47
- data/config/locales/sk-SK.yml +896 -0
- data/config/locales/sk.yml +869 -0
- data/config/locales/sl.yml +26 -0
- data/config/locales/sr-CS.yml +126 -0
- data/config/locales/sv.yml +253 -162
- data/config/locales/tr-TR.yml +43 -63
- data/config/locales/uk.yml +14 -47
- data/db/migrate/20181003074440_fix_user_groups_ids_in_proposals_endorsements.rb +4 -0
- data/db/migrate/20191206154128_add_endorsements_counter_cache_to_proposals.rb +7 -0
- data/db/migrate/20200120215928_move_proposal_endorsements_to_core_endorsements.rb +52 -0
- data/db/migrate/20200203111239_add_proposal_valuation_assignments.rb +12 -0
- data/db/migrate/20200210135152_add_costs_to_proposals.rb +9 -0
- data/db/migrate/20200212120110_sync_proposals_state_with_amendments_state.rb +28 -0
- data/db/migrate/20200227175922_add_state_published_at_to_proposals.rb +7 -0
- data/db/migrate/20200306123652_publish_existing_proposals_state.rb +15 -0
- data/db/migrate/20200730131631_move_proposal_endorsed_event_notifications_to_resource_endorsed_event.rb +20 -0
- data/lib/decidim/proposals.rb +1 -0
- data/lib/decidim/proposals/admin_engine.rb +7 -3
- data/lib/decidim/proposals/component.rb +47 -23
- data/lib/decidim/proposals/engine.rb +2 -6
- data/lib/decidim/proposals/test/capybara_proposals_picker.rb +49 -0
- data/lib/decidim/proposals/test/factories.rb +56 -10
- data/lib/decidim/proposals/valuatable.rb +21 -0
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +94 -53
- data/app/assets/javascripts/decidim/proposals/identity_selector_dialog.js.es6 +0 -56
- data/app/cells/decidim/proposals/endorsers_list/show.erb +0 -17
- data/app/cells/decidim/proposals/endorsers_list_cell.rb +0 -31
- data/app/commands/decidim/proposals/attachment_methods.rb +0 -43
- data/app/commands/decidim/proposals/endorse_proposal.rb +0 -59
- data/app/commands/decidim/proposals/unendorse_proposal.rb +0 -40
- data/app/controllers/decidim/proposals/proposal_endorsements_controller.rb +0 -60
- data/app/models/decidim/proposals/proposal_endorsement.rb +0 -37
- data/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +0 -22
- data/app/views/decidim/proposals/admin/proposal_notes/index.html.erb +0 -3
- data/app/views/decidim/proposals/admin/shared/_info_proposal.html.erb +0 -20
- data/app/views/decidim/proposals/proposal_endorsements/_identity.html.erb +0 -9
- data/app/views/decidim/proposals/proposal_endorsements/identities.html.erb +0 -12
- data/app/views/decidim/proposals/proposal_endorsements/update_buttons_and_counters.js.erb +0 -20
- data/app/views/decidim/proposals/proposal_widgets/show.html.erb +0 -4
- data/app/views/decidim/proposals/proposals/_endorsement_button.html.erb +0 -11
- data/app/views/decidim/proposals/proposals/_endorsement_identities_cabin.html.erb +0 -13
- data/app/views/decidim/proposals/versions/_version.html.erb +0 -20
@@ -1,3 +1 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 35">
|
2
|
-
<path d="M17.5 35A17.5 17.5 0 1 1 35 17.5 17.52 17.52 0 0 1 17.5 35zm0-33.06A15.56 15.56 0 1 0 33.06 17.5 15.57 15.57 0 0 0 17.5 1.94zm9.5 13.7H8a1 1 0 0 1 0-1.94h19a1 1 0 0 1 0 1.94zm0 3.68H8a1 1 0 0 1 0-1.94h19a1 1 0 0 1 0 1.94zM22.26 23H8a1 1 0 0 1 0-1.94h14.26a1 1 0 0 1 0 1.94z"/>
|
3
|
-
</svg>
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 35"><path d="M17.5 35A17.5 17.5 0 1 1 35 17.5 17.52 17.52 0 0 1 17.5 35zm0-33.06A15.56 15.56 0 1 0 33.06 17.5 15.57 15.57 0 0 0 17.5 1.94zm9.5 13.7H8a1 1 0 0 1 0-1.94h19a1 1 0 0 1 0 1.94zm0 3.68H8a1 1 0 0 1 0-1.94h19a1 1 0 0 1 0 1.94zM22.26 23H8a1 1 0 0 1 0-1.94h14.26a1 1 0 0 1 0 1.94z"/></svg>
|
@@ -4,18 +4,31 @@ $(document).ready(function () {
|
|
4
4
|
return $('.table-list .js-check-all-proposal:checked').length
|
5
5
|
}
|
6
6
|
|
7
|
+
let selectedProposalsNotPublishedAnswerCount = function() {
|
8
|
+
return $('.table-list [data-published-state=false] .js-check-all-proposal:checked').length
|
9
|
+
}
|
10
|
+
|
7
11
|
window.selectedProposalsCountUpdate = function() {
|
8
|
-
|
12
|
+
const selectedProposals = selectedProposalsCount();
|
13
|
+
const selectedProposalsNotPublishedAnswer = selectedProposalsNotPublishedAnswerCount();
|
14
|
+
if(selectedProposals == 0){
|
9
15
|
$("#js-selected-proposals-count").text("")
|
10
16
|
} else {
|
11
|
-
$("#js-selected-proposals-count").text(
|
17
|
+
$("#js-selected-proposals-count").text(selectedProposals);
|
12
18
|
}
|
13
19
|
|
14
|
-
if(
|
20
|
+
if(selectedProposals >= 2) {
|
15
21
|
$('button[data-action="merge-proposals"]').parent().show();
|
16
22
|
} else {
|
17
23
|
$('button[data-action="merge-proposals"]').parent().hide();
|
18
24
|
}
|
25
|
+
|
26
|
+
if(selectedProposalsNotPublishedAnswer > 0) {
|
27
|
+
$('button[data-action="publish-answers"]').parent().show();
|
28
|
+
$('#js-form-publish-answers-number').text(selectedProposalsNotPublishedAnswer);
|
29
|
+
} else {
|
30
|
+
$('button[data-action="publish-answers"]').parent().hide();
|
31
|
+
}
|
19
32
|
}
|
20
33
|
|
21
34
|
let showBulkActionsButton = function() {
|
@@ -24,7 +37,7 @@ $(document).ready(function () {
|
|
24
37
|
}
|
25
38
|
}
|
26
39
|
|
27
|
-
|
40
|
+
window.hideBulkActionsButton = function(force = false) {
|
28
41
|
if(selectedProposalsCount() == 0 || force == true){
|
29
42
|
$("#js-bulk-actions-button").addClass('hide');
|
30
43
|
$("#js-bulk-actions-dropdown").removeClass('is-open');
|
@@ -35,12 +48,12 @@ $(document).ready(function () {
|
|
35
48
|
$("#js-other-actions-wrapper").removeClass('hide');
|
36
49
|
}
|
37
50
|
|
38
|
-
|
51
|
+
window.hideOtherActionsButtons = function() {
|
39
52
|
$("#js-other-actions-wrapper").addClass('hide');
|
40
53
|
}
|
41
54
|
|
42
55
|
window.hideBulkActionForms = function() {
|
43
|
-
|
56
|
+
$(".js-bulk-action-form").addClass('hide');
|
44
57
|
}
|
45
58
|
|
46
59
|
if ($('.js-bulk-action-form').length) {
|
@@ -57,8 +70,8 @@ $(document).ready(function () {
|
|
57
70
|
})
|
58
71
|
|
59
72
|
$(`#js-${action}-actions`).removeClass('hide');
|
60
|
-
hideBulkActionsButton(true);
|
61
|
-
hideOtherActionsButtons();
|
73
|
+
window.hideBulkActionsButton(true);
|
74
|
+
window.hideOtherActionsButtons();
|
62
75
|
}
|
63
76
|
})
|
64
77
|
|
@@ -71,7 +84,7 @@ $(document).ready(function () {
|
|
71
84
|
showBulkActionsButton();
|
72
85
|
} else {
|
73
86
|
$(".js-check-all-proposal").closest('tr').removeClass('selected');
|
74
|
-
hideBulkActionsButton();
|
87
|
+
window.hideBulkActionsButton();
|
75
88
|
}
|
76
89
|
|
77
90
|
selectedProposalsCountUpdate();
|
@@ -96,12 +109,12 @@ $(document).ready(function () {
|
|
96
109
|
showBulkActionsButton();
|
97
110
|
$(this).closest('tr').addClass('selected');
|
98
111
|
} else {
|
99
|
-
hideBulkActionsButton();
|
112
|
+
window.hideBulkActionsButton();
|
100
113
|
$(this).closest('tr').removeClass('selected');
|
101
114
|
}
|
102
115
|
|
103
116
|
if ($('.js-check-all-proposal:checked').length === 0) {
|
104
|
-
hideBulkActionsButton();
|
117
|
+
window.hideBulkActionsButton();
|
105
118
|
}
|
106
119
|
|
107
120
|
$('.js-bulk-action-form').find(".js-proposal-id-"+proposal_id).prop('checked', checked);
|
@@ -0,0 +1,35 @@
|
|
1
|
+
$(() => {
|
2
|
+
const $content = $(".picker-content"),
|
3
|
+
pickerMore = $content.data("picker-more"),
|
4
|
+
pickerPath = $content.data("picker-path"),
|
5
|
+
toggleNoProposals = () => {
|
6
|
+
const showNoProposals = $("#proposals_list li:visible").length === 0
|
7
|
+
$("#no_proposals").toggle(showNoProposals)
|
8
|
+
}
|
9
|
+
|
10
|
+
let jqxhr = null
|
11
|
+
|
12
|
+
toggleNoProposals()
|
13
|
+
|
14
|
+
$(".data_picker-modal-content").on("change keyup", "#proposals_filter", (event) => {
|
15
|
+
const filter = event.target.value.toLowerCase()
|
16
|
+
|
17
|
+
if (pickerMore) {
|
18
|
+
if (jqxhr !== null) {
|
19
|
+
jqxhr.abort()
|
20
|
+
}
|
21
|
+
|
22
|
+
$content.html("<div class='loading-spinner'></div>")
|
23
|
+
jqxhr = $.get(`${pickerPath}?q=${filter}`, (data) => {
|
24
|
+
$content.html(data)
|
25
|
+
jqxhr = null
|
26
|
+
toggleNoProposals()
|
27
|
+
})
|
28
|
+
} else {
|
29
|
+
$("#proposals_list li").each((index, li) => {
|
30
|
+
$(li).toggle(li.textContent.toLowerCase().indexOf(filter) > -1)
|
31
|
+
})
|
32
|
+
toggleNoProposals()
|
33
|
+
}
|
34
|
+
})
|
35
|
+
})
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="card__footer">
|
2
2
|
<div class="card__support">
|
3
3
|
<div class="card__support__data"></div>
|
4
|
-
<%= link_to t("decidim.proposals.collaborative_drafts.collaborative_draft.view_collaborative_draft"), resource_path, class: "card__button button small
|
4
|
+
<%= link_to t("decidim.proposals.collaborative_drafts.collaborative_draft.view_collaborative_draft"), resource_path, class: "card__button button--sc light button small" %>
|
5
5
|
</div>
|
6
6
|
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<div id="proposal-costs" class="card card--secondary" data-toggler=".expanded-text">
|
2
|
+
<div class="card__content">
|
3
|
+
<div class="mb-s">
|
4
|
+
<div class="data-title">
|
5
|
+
<h3 class="data-title__over">
|
6
|
+
<%= t("decidim.proposals.proposals.show.estimated_cost") %>
|
7
|
+
</h3>
|
8
|
+
<div>
|
9
|
+
<strong class="data-title__main">
|
10
|
+
<%= cost %>
|
11
|
+
</strong>
|
12
|
+
</div>
|
13
|
+
<div class="data-title__sub">
|
14
|
+
<%= execution_period %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<div id="execution-cost-short" class="text-toggle__short">
|
19
|
+
<%= cost_report_short %>
|
20
|
+
<% if needs_text_toggle? %>
|
21
|
+
<button class="muted-link" data-toggle="proposal-costs">
|
22
|
+
<%= t("decidim.proposals.proposals.show.read_more") %>
|
23
|
+
</button>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
<% if needs_text_toggle? %>
|
27
|
+
<div id="execution-cost-long" class="text-toggle__long">
|
28
|
+
<%= cost_report %>
|
29
|
+
<button class="muted-link" data-toggle="proposal-costs">
|
30
|
+
<%= t("decidim.proposals.proposals.show.read_less") %>
|
31
|
+
</button>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
</div>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "cell/partial"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Proposals
|
7
|
+
# This cell renders the cost report for a proposal.
|
8
|
+
class CostReportCell < Decidim::ViewModel
|
9
|
+
include ActionView::Helpers::NumberHelper
|
10
|
+
include Decidim::SanitizeHelper
|
11
|
+
include Decidim::LayoutHelper
|
12
|
+
include ProposalCellsHelper
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def cost
|
17
|
+
number_to_currency(model.cost)
|
18
|
+
end
|
19
|
+
|
20
|
+
def cost_report
|
21
|
+
decidim_sanitize(translated_attribute(model.cost_report).html_safe)
|
22
|
+
end
|
23
|
+
|
24
|
+
def needs_text_toggle?
|
25
|
+
cost_report != cost_report_short
|
26
|
+
end
|
27
|
+
|
28
|
+
def cost_report_short
|
29
|
+
decidim_sanitize(
|
30
|
+
html_truncate(
|
31
|
+
translated_attribute(model.cost_report).html_safe,
|
32
|
+
length: 200
|
33
|
+
)
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def execution_period
|
38
|
+
decidim_sanitize(translated_attribute(model.execution_period).html_safe)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<section class="section row collapse highlighted_proposals">
|
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_proposals.see_all", count: proposals_count) %></a>
|
4
|
-
</
|
4
|
+
</h3>
|
5
5
|
|
6
6
|
<%= cell(
|
7
7
|
"decidim/collapsible_list",
|
@@ -14,6 +14,6 @@
|
|
14
14
|
<%= link_to(
|
15
15
|
t("decidim.participatory_spaces.highlighted_proposals.see_all", count: proposals_count),
|
16
16
|
main_component_path(model),
|
17
|
-
class: "button button--sc
|
17
|
+
class: "button button--sc hollow button--right"
|
18
18
|
) %>
|
19
19
|
</section>
|
@@ -23,7 +23,7 @@ module Decidim
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def proposals_to_render
|
26
|
-
@proposals_to_render ||= proposals.limit(Decidim::Proposals.config.participatory_space_highlighted_proposals_limit)
|
26
|
+
@proposals_to_render ||= proposals.includes([:amendable, :category, :component, :scope]).limit(Decidim::Proposals.config.participatory_space_highlighted_proposals_limit)
|
27
27
|
end
|
28
28
|
|
29
29
|
def proposals_count
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%= button_reveal_modal %>
|
2
2
|
|
3
|
-
<div id="<%= modal_id %>" class="reveal" data-reveal aria-labelledby="<%=
|
3
|
+
<div id="<%= modal_id %>" class="reveal" data-reveal aria-labelledby="<%= modal_id %>-title" aria-hidden="true" role="dialog">
|
4
4
|
<div class="reveal__header">
|
5
|
-
<h3 class="reveal__title">
|
5
|
+
<h3 id="<%= modal_id %>-title" class="reveal__title">
|
6
6
|
<%= modal_title %>
|
7
7
|
</h3>
|
8
8
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<% if component_settings.comments_enabled? %>
|
15
15
|
<div class="button-group button-group--collapse row collapse comment-buttons">
|
16
16
|
<% if current_settings.comments_blocked? %>
|
17
|
-
<%= content_tag :button, class: "column medium-4 button light secondary"
|
17
|
+
<%= content_tag :button, class: "column medium-4 button light secondary" do %>
|
18
18
|
<%= icon "comment-square", class: "icon--small", aria_label: t("comments", scope: "decidim.proposals.participatory_text_proposal.buttons"), role: "img" %>
|
19
19
|
<%= model.comments.count %>
|
20
20
|
<% end %>
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
def title
|
22
22
|
case model.participatory_text_level
|
23
23
|
when "section"
|
24
|
-
"<h5><strong
|
24
|
+
"<h5><strong>#{section_title}</strong></h5>"
|
25
25
|
else
|
26
26
|
"<h6><strong>#{section_title}</strong></h6>"
|
27
27
|
end
|
@@ -16,7 +16,10 @@
|
|
16
16
|
<%= render partial: "decidim/proposals/proposals/vote_button.html", locals: { proposal: model, from_proposals_list: true } %>
|
17
17
|
<% elsif has_footer? %>
|
18
18
|
<div class="card__support__data"></div>
|
19
|
-
<%= link_to
|
19
|
+
<%= link_to resource_path, class: "card__button button--sc light button small" do %>
|
20
|
+
<%= t("decidim.proposals.proposals.proposal.view_proposal") %>
|
21
|
+
<span class="show-for-sr"><%= title %></span>
|
22
|
+
<% end %>
|
20
23
|
<% end %>
|
21
24
|
</div>
|
22
25
|
</div>
|
@@ -14,12 +14,16 @@ module Decidim
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
+
def preview?
|
18
|
+
options[:preview]
|
19
|
+
end
|
20
|
+
|
17
21
|
def title
|
18
22
|
decidim_html_escape(present(model).title)
|
19
23
|
end
|
20
24
|
|
21
25
|
def body
|
22
|
-
present(model).body
|
26
|
+
decidim_sanitize(present(model).body)
|
23
27
|
end
|
24
28
|
|
25
29
|
def has_state?
|
@@ -27,7 +31,7 @@ module Decidim
|
|
27
31
|
end
|
28
32
|
|
29
33
|
def has_badge?
|
30
|
-
|
34
|
+
published_state? || withdrawn?
|
31
35
|
end
|
32
36
|
|
33
37
|
def has_link_to_resource?
|
@@ -50,28 +54,40 @@ module Decidim
|
|
50
54
|
state_classes.concat(["label", "proposal-status"]).join(" ")
|
51
55
|
end
|
52
56
|
|
57
|
+
def base_statuses
|
58
|
+
@base_statuses ||= begin
|
59
|
+
if endorsements_visible?
|
60
|
+
[:endorsements_count, :comments_count]
|
61
|
+
else
|
62
|
+
[:comments_count]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
53
67
|
def statuses
|
54
|
-
return [
|
55
|
-
return
|
68
|
+
return [] if preview?
|
69
|
+
return base_statuses if model.draft?
|
70
|
+
return [:creation_date] + base_statuses if !has_link_to_resource? || !can_be_followed?
|
56
71
|
|
57
|
-
[:creation_date, :follow
|
72
|
+
[:creation_date, :follow] + base_statuses
|
58
73
|
end
|
59
74
|
|
60
75
|
def creation_date_status
|
61
|
-
|
76
|
+
explanation = content_tag(:strong, t("activemodel.attributes.common.created_at"))
|
77
|
+
"#{explanation}<br>#{l(model.published_at.to_date, format: :decidim_short)}"
|
62
78
|
end
|
63
79
|
|
64
80
|
def endorsements_count_status
|
65
81
|
return endorsements_count unless has_link_to_resource?
|
66
82
|
|
67
|
-
link_to resource_path do
|
83
|
+
link_to resource_path, "aria-label" => "#{t("decidim.endorsable.endorsements_count")}: #{model.endorsements_count}", title: t("decidim.endorsable.endorsements_count") do
|
68
84
|
endorsements_count
|
69
85
|
end
|
70
86
|
end
|
71
87
|
|
72
88
|
def endorsements_count
|
73
|
-
with_tooltip t("decidim.
|
74
|
-
icon("bullhorn", class: "icon--small") + " " + model.
|
89
|
+
with_tooltip t("decidim.endorsable.endorsements") do
|
90
|
+
icon("bullhorn", class: "icon--small") + " " + model.endorsements_count.to_s
|
75
91
|
end
|
76
92
|
end
|
77
93
|
|
@@ -94,6 +110,18 @@ module Decidim
|
|
94
110
|
def can_be_followed?
|
95
111
|
!model.withdrawn?
|
96
112
|
end
|
113
|
+
|
114
|
+
def endorsements_visible?
|
115
|
+
model.component.current_settings.endorsements_enabled?
|
116
|
+
end
|
117
|
+
|
118
|
+
def has_image?
|
119
|
+
model.attachments.first.present? && model.attachments.first.file.content_type.start_with?("image") && model.component.settings.allow_card_image
|
120
|
+
end
|
121
|
+
|
122
|
+
def resource_image_path
|
123
|
+
model.attachments.first.url if has_image?
|
124
|
+
end
|
97
125
|
end
|
98
126
|
end
|
99
127
|
end
|
@@ -1,25 +1,33 @@
|
|
1
1
|
<figure>
|
2
|
-
<
|
3
|
-
<strong>
|
4
|
-
<%= t("filed_as", scope: "decidim.proposals.proposals.tags") %>
|
5
|
-
</strong>
|
6
|
-
</figcaption>
|
7
|
-
|
8
|
-
<ul>
|
2
|
+
<ul class="tags tags--proposal tags--list">
|
9
3
|
<% if category.present? %>
|
10
4
|
<li>
|
11
|
-
<%= link_to
|
5
|
+
<%= link_to resource_locator(model).index(filter: { category_id: [category.id.to_s] }), title: t("decidim.tags.filter_results_for_category", resource: translated_attribute(category.name)) do %>
|
6
|
+
<span class="show-for-sr"><%= t "decidim.tags.filter_results_for_category", resource: translated_attribute(category.name) %></span>
|
7
|
+
<span aria-hidden="true"><%= translated_attribute(category.name) %></span>
|
8
|
+
<% end %>
|
12
9
|
<% if previous_category.present? && show_previous_category? %>
|
13
10
|
|
14
11
|
<small class="text-small">
|
15
|
-
<%= t("changed_from", scope: "decidim.proposals.proposals.tags",
|
12
|
+
<%= t("changed_from", scope: "decidim.proposals.proposals.tags", previous_name: "#{previous_category.translated_name}").html_safe %>
|
16
13
|
</small>
|
17
14
|
<% end %>
|
18
15
|
</li>
|
19
16
|
<% end %>
|
20
17
|
|
21
18
|
<% if has_visible_scopes?(model) %>
|
22
|
-
<li
|
19
|
+
<li>
|
20
|
+
<%= link_to resource_locator(model).index(filter: { scope_id: [scope.id] }), title: t("decidim.tags.filter_results_for_scope", resource: translated_attribute(scope.name)) do %>
|
21
|
+
<span class="show-for-sr"><%= t "decidim.tags.filter_results_for_scope", resource: translated_attribute(scope.name) %></span>
|
22
|
+
<span aria-hidden="true"><%= translated_attribute(scope.name) %></span>
|
23
|
+
<% end %>
|
24
|
+
<% if previous_scope.present? && show_previous_scope? %>
|
25
|
+
|
26
|
+
<small class="text-small">
|
27
|
+
<%= t("changed_from", scope: "decidim.proposals.proposals.tags", previous_name: "#{translated_attribute(previous_scope.name)}").html_safe %>
|
28
|
+
</small>
|
29
|
+
<% end %>
|
30
|
+
</li>
|
23
31
|
<% end %>
|
24
32
|
</ul>
|
25
33
|
</figure>
|