decidim-reporting_proposals 0.6.1 → 0.7.3
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/.github/workflows/lint.yml +8 -6
- data/.github/workflows/test_integration.yml +34 -12
- data/.github/workflows/test_unit.yml +27 -7
- data/.rubocop.yml +21 -1
- data/.ruby-version +1 -1
- data/Gemfile +6 -8
- data/Gemfile.lock +418 -427
- data/README.md +10 -0
- data/app/cells/concerns/decidim/reporting_proposals/proposals_picker_cell_override.rb +4 -4
- data/app/commands/concerns/decidim/reporting_proposals/admin/assign_proposals_to_valuator_override.rb +3 -1
- data/app/commands/concerns/decidim/reporting_proposals/admin/create_category_override.rb +5 -11
- data/app/commands/concerns/decidim/reporting_proposals/admin/create_proposal_answer_template_override.rb +24 -0
- data/app/commands/concerns/decidim/reporting_proposals/admin/has_result_command_override.rb +21 -0
- data/app/commands/concerns/decidim/reporting_proposals/admin/update_category_override.rb +8 -11
- data/app/commands/concerns/decidim/reporting_proposals/admin/update_imported_result_override.rb +30 -0
- data/app/commands/concerns/decidim/reporting_proposals/admin/update_result_override.rb +0 -4
- data/app/commands/concerns/decidim/reporting_proposals/create_project_override.rb +1 -1
- data/app/controllers/concerns/decidim/reporting_proposals/admin/proposal_answer_templates_controller_override.rb +4 -5
- data/app/controllers/concerns/decidim/reporting_proposals/admin/valuation_assignments_controller_override.rb +10 -4
- data/app/controllers/concerns/decidim/reporting_proposals/proposals_controller_override.rb +23 -31
- data/app/forms/concerns/decidim/reporting_proposals/admin/category_form_override.rb +1 -1
- data/app/forms/concerns/decidim/reporting_proposals/form_builder_override.rb +4 -1
- data/app/helpers/concerns/decidim/reporting_proposals/admin/proposal_bulk_actions_helper_override.rb +23 -0
- data/app/helpers/concerns/decidim/reporting_proposals/admin/proposals_helper_override.rb +18 -0
- data/app/helpers/concerns/decidim/reporting_proposals/proposal_wizard_helper_override.rb +17 -3
- data/app/jobs/decidim/reporting_proposals/assign_proposal_valuators_job.rb +1 -1
- data/app/overrides/decidim/proposals/admin/proposals/_proposal-tr/add_categories_column.html.erb.deface +8 -0
- data/app/overrides/decidim/proposals/admin/proposals/_proposal-tr/add_id_column.html.erb.deface +3 -0
- data/app/overrides/decidim/proposals/admin/proposals/_proposal-tr/add_valuators_name.html.erb.deface +5 -5
- data/app/overrides/decidim/proposals/admin/proposals/_proposal-tr/replace_td_title.html.erb.deface +1 -1
- data/app/overrides/decidim/proposals/admin/proposals/index/add_categories.html.erb.deface +3 -0
- data/app/overrides/decidim/proposals/admin/proposals/index/add_form_default_class.html.erb.deface +5 -0
- data/app/overrides/decidim/proposals/admin/proposals/index/add_id_column_header.html.erb.deface +3 -0
- data/app/overrides/decidim/proposals/admin/proposals/show/add_valuators_form.html.erb.deface +1 -24
- data/app/overrides/decidim/proposals/proposals/edit_draft/replace_partial_edit_form_fields.html.erb.deface +0 -1
- data/app/overrides/decidim/proposals/proposals/new/replace_partial_edit_form_fields.html.erb.deface +3 -0
- data/app/packs/entrypoints/decidim_reporting_proposals.js +1 -0
- data/app/packs/src/decidim/reporting_proposals/assign_valuators_select.js +25 -0
- data/app/packs/src/decidim/reporting_proposals/user_camera_inputs.js +1 -1
- data/app/packs/stylesheets/decidim/reporting_proposals/list_component_admin.scss +6 -0
- data/app/permissions/concerns/decidim/reporting_proposals/admin/permissions_override.rb +12 -2
- data/app/queries/decidim/reporting_proposals/nearby_proposals.rb +1 -3
- data/app/views/decidim/proposals/admin/proposals/_assign_to_valuator.html.erb +31 -0
- data/app/views/decidim/proposals/proposals/compare.html.erb +34 -0
- data/app/views/decidim/reporting_proposals/admin/categories/_valuators_field.html.erb +1 -1
- data/app/views/decidim/reporting_proposals/admin/proposals/_photo_form.html.erb +2 -2
- data/app/views/decidim/reporting_proposals/admin/proposals/_photo_gallery.html.erb +2 -1
- data/app/views/decidim/reporting_proposals/admin/proposals/_photos.html.erb +4 -1
- data/app/views/decidim/reporting_proposals/admin/proposals/_proposal_td_hide.html.erb +1 -9
- data/app/views/decidim/reporting_proposals/admin/proposals/_proposal_td_title.html.erb +5 -4
- data/app/views/decidim/reporting_proposals/proposals/_camera_button.html.erb +4 -2
- data/app/views/decidim/reporting_proposals/proposals/_reporting_proposal_fields.html.erb +66 -65
- data/bin/bundle +62 -0
- data/bin/rspec +26 -0
- data/bin/test +47 -0
- data/bin/test-legacy +3 -0
- data/config/locales/ca.yml +22 -34
- data/config/locales/de.yml +22 -36
- data/config/locales/en.yml +20 -1
- data/config/locales/es.yml +22 -36
- data/decidim-reporting_proposals.gemspec +1 -2
- data/lib/decidim/reporting_proposals/component.rb +31 -17
- data/lib/decidim/reporting_proposals/engine.rb +16 -12
- data/lib/decidim/reporting_proposals/version.rb +3 -3
- data/lib/tasks/reporting_proposals_statuses.rake +52 -0
- data/package-lock.json +120 -85
- data/package.json +7 -7
- metadata +61 -79
- data/.rubocop-disabled.yml +0 -11
- data/.rubocop_rails.yml +0 -90
- data/.rubocop_ruby.yml +0 -1767
- data/app/commands/concerns/decidim/reporting_proposals/admin/create_answer_override.rb +0 -17
- data/app/commands/concerns/decidim/reporting_proposals/admin/create_result_override.rb +0 -17
- data/app/commands/concerns/decidim/reporting_proposals/create_report_override.rb +0 -19
- data/app/commands/concerns/decidim/reporting_proposals/gallery_methods_override.rb +0 -18
- data/app/overrides/decidim/proposals/proposals/compare/add_css.html.erb.deface +0 -5
- data/app/overrides/decidim/proposals/proposals/compare/add_distance_badge.html.erb.deface +0 -10
- data/app/overrides/decidim/proposals/proposals/edit/add_user_group.html.erb.deface +0 -3
- data/app/overrides/decidim/proposals/proposals/new/remove_body.html.erb.deface +0 -1
- data/app/overrides/decidim/proposals/proposals/new/replace_body.html.erb.deface +0 -3
- data/app/overrides/layouts/decidim/_process_header_steps/always_show_new_proposals.html.erb.deface +0 -3
- data/app/views/decidim/reporting_proposals/proposals/_new_proposal_fields.html.erb +0 -9
- data/app/views/decidim/reporting_proposals/proposals/_user_group.html.erb +0 -5
- data/babel.config.json +0 -25
|
@@ -17,12 +17,14 @@ module Decidim
|
|
|
17
17
|
if valuator_assigned_to_proposal?
|
|
18
18
|
can_create_proposal_note?
|
|
19
19
|
can_create_proposal_answer?
|
|
20
|
+
can_assign_valuator_to_proposal?
|
|
20
21
|
allow! if action_is_show_on_proposal?
|
|
21
22
|
elsif action_is_show_on_proposal?
|
|
22
23
|
disallow!
|
|
23
24
|
end
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
valuator_can_unassign_valuator_from_proposals?
|
|
27
|
+
can_export_proposals?
|
|
26
28
|
|
|
27
29
|
return permission_action
|
|
28
30
|
end
|
|
@@ -59,7 +61,7 @@ module Decidim
|
|
|
59
61
|
allow! if permission_action.subject == :proposals && permission_action.action == :split
|
|
60
62
|
|
|
61
63
|
# Every user allowed by the space can assign proposals to a valuator
|
|
62
|
-
|
|
64
|
+
can_assign_valuator_to_proposal?
|
|
63
65
|
|
|
64
66
|
# Every user allowed by the space can unassign a valuator from proposals
|
|
65
67
|
can_unassign_valuator_from_proposals?
|
|
@@ -72,6 +74,14 @@ module Decidim
|
|
|
72
74
|
allow!
|
|
73
75
|
end
|
|
74
76
|
|
|
77
|
+
if permission_action.subject == :proposal_state
|
|
78
|
+
if permission_action.action == :destroy
|
|
79
|
+
toggle_allow(proposal_state.proposals.empty?)
|
|
80
|
+
else
|
|
81
|
+
allow!
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
75
85
|
permission_action
|
|
76
86
|
end
|
|
77
87
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
@@ -37,9 +37,7 @@ module Decidim
|
|
|
37
37
|
# we won't return directly this query due a problem with the method "count" in the geocoder gem
|
|
38
38
|
# see https://github.com/alexreisner/geocoder#note-on-rails-41-and-greater
|
|
39
39
|
def query_ids
|
|
40
|
-
base_query
|
|
41
|
-
.near([@proposal.latitude, @proposal.longitude], @radius.to_f / 1000, units: :km)
|
|
42
|
-
.limit(Decidim::Proposals.similarity_limit).map(&:id)
|
|
40
|
+
base_query.near([@proposal.latitude, @proposal.longitude], @radius.to_f / 1000, units: :km).map(&:id)
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
def base_query
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<%= append_javascript_pack_tag "decidim_reporting_proposals", defer: true %>
|
|
2
|
+
<%= append_stylesheet_pack_tag "decidim_proposals", media: "all" %>
|
|
3
|
+
|
|
4
|
+
<% if allowed_to?(:assign_to_valuator, :proposals, proposal:) %>
|
|
5
|
+
<div id="js-assign-proposal-to-valuator-actions" class="js-bulk-action-form form-single-proposal" style="max-width:400px">
|
|
6
|
+
<%= form_tag(valuation_assignment_path, method: :post, id: "js-form-assign-proposal-to-valuator", class: "form form-defaults") do %>
|
|
7
|
+
<div class="form__wrapper">
|
|
8
|
+
<div class="card">
|
|
9
|
+
<div class="flex items-center">
|
|
10
|
+
<div class="checkboxes hide">
|
|
11
|
+
<%= check_box_tag "proposal_ids[]", proposal.id, true, class: "js-check-all-proposal js-proposal-id-#{proposal.id}" %>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<select
|
|
15
|
+
id="assign_valuator_role_ids"
|
|
16
|
+
name="valuator_role_ids[]"
|
|
17
|
+
placeholder="<%= t("decidim.proposals.admin.proposals.index.select_valuators") %>"
|
|
18
|
+
class="w-full mt-2 js-valuator-multiselect"
|
|
19
|
+
multiple>
|
|
20
|
+
<%= available_valuators_for_proposal(proposal, current_user).map do |option| %>
|
|
21
|
+
<option value="<%= option[1] %>"><%= option[0] %></option>
|
|
22
|
+
<% end %>
|
|
23
|
+
</select>
|
|
24
|
+
|
|
25
|
+
<%= submit_tag(t("decidim.proposals.admin.proposals.index.assign_to_valuator_button"), id: "js-submit-assign-proposal-to-valuator", class: "button button__sm button__secondary ml-2") %>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
30
|
+
</div>
|
|
31
|
+
<% end %>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<% add_decidim_page_title(proposal_wizard_step_title(action_name)) %>
|
|
2
|
+
|
|
3
|
+
<% append_stylesheet_pack_tag "decidim_proposals", media: "all" %>
|
|
4
|
+
<% if reporting_proposal? %>
|
|
5
|
+
<% append_stylesheet_pack_tag "decidim_reporting_proposals" %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% append_javascript_pack_tag "decidim_proposals" %>
|
|
8
|
+
|
|
9
|
+
<%= render layout: "layouts/decidim/shared/layout_center" do %>
|
|
10
|
+
|
|
11
|
+
<%= render partial: "wizard_header", locals: { callout_step_help_text_class: "warning" } %>
|
|
12
|
+
|
|
13
|
+
<% if @similar_proposals.present? %>
|
|
14
|
+
<div class="proposal__container my-10">
|
|
15
|
+
<% @similar_proposals.each do |proposal| %>
|
|
16
|
+
<% if geocoding_comparison? %>
|
|
17
|
+
<div class="compare-by-distance mb-6">
|
|
18
|
+
<span class="label secondary float-right"><%= icon("map-pin-line") %> <%= t("away", scope: "decidim.reporting_proposals.proposals.compare.geocoding", meters: distance(1000 * @proposal.distance_from([proposal.latitude, proposal.longitude], :km))) %></span>
|
|
19
|
+
<%= card_for proposal %>
|
|
20
|
+
</div>
|
|
21
|
+
<% else %>
|
|
22
|
+
<%= card_for proposal %>
|
|
23
|
+
<% end %>
|
|
24
|
+
<% end %>
|
|
25
|
+
</div>
|
|
26
|
+
<% end %>
|
|
27
|
+
|
|
28
|
+
<div class="form__wrapper-block flex-col-reverse md:flex-row justify-between">
|
|
29
|
+
<%= link_to preview_proposal_path(@proposal), class: "button button__sm md:button__lg button__secondary ml-auto" do %>
|
|
30
|
+
<span><%= t("continue", scope: "decidim.proposals.proposals.compare") %></span>
|
|
31
|
+
<%= icon "arrow-right-line" %>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
34
|
+
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
<div class="row column">
|
|
3
3
|
<%= form.select :valuator_ids,
|
|
4
|
-
find_valuators_for_select(current_participatory_space),
|
|
4
|
+
find_valuators_for_select(current_participatory_space, current_user),
|
|
5
5
|
{ help_text: t("form.valuators_help", scope: "decidim.reporting_proposals.admin.categories") },
|
|
6
6
|
{ multiple: true } %>
|
|
7
7
|
</div>
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
<% end %>
|
|
13
13
|
</div>
|
|
14
14
|
<% end %>
|
|
15
|
-
<div class="row column">
|
|
16
|
-
<%= f.
|
|
15
|
+
<div class="row column mb-2">
|
|
16
|
+
<%= f.upload :add_photos, multiple: true, button_class: "button button__sm button__transparent-secondary" %>
|
|
17
17
|
</div>
|
|
18
18
|
<div class="actions">
|
|
19
19
|
<%= f.submit t(".action"), class: "button button__sm button__secondary" %>
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
<div id="photos" class="gallery grid grid-cols-1 md:grid-cols-4 gap-6 proposal-<%= proposal.id %>">
|
|
4
4
|
<% proposal.photos.each do |photo| %>
|
|
5
5
|
<div class="proposal-photo gallery__item" id="photo-<%= photo.id %>">
|
|
6
|
-
<%= link_to photo.big_url, target: "_blank", rel: "noopener" do %>
|
|
6
|
+
<%= link_to photo.big_url, target: "_blank", rel: "noopener", "data-external-link" => "false" do %>
|
|
7
7
|
<%= image_tag photo.thumbnail_url, class: "thumbnail", alt: strip_tags(translated_attribute(photo.title)) %>
|
|
8
8
|
<% if admin_allowed_to? :edit_photos, :proposals, extra_context = { proposal: proposal }, chain = [::Decidim::ReportingProposals::Admin::Permissions] %>
|
|
9
9
|
<%= icon_link_to "close-line",
|
|
10
10
|
decidim_admin_reporting_proposals.remove_photo_path(id: proposal.id, photo_id: photo.id),
|
|
11
11
|
t(".delete_image"),
|
|
12
12
|
method: :delete,
|
|
13
|
+
data: { confirm: t(".are_you_sure") },
|
|
13
14
|
class: "delete-proposal__button" %>
|
|
14
15
|
<% end %>
|
|
15
16
|
<% end %>
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
</button>
|
|
10
10
|
<div id="panel-photos">
|
|
11
11
|
<%= render partial: "decidim/reporting_proposals/admin/proposals/photo_gallery" %>
|
|
12
|
-
<% if admin_allowed_to? :edit_photos,
|
|
12
|
+
<% if admin_allowed_to? :edit_photos,
|
|
13
|
+
:proposals,
|
|
14
|
+
(extra_context = { proposal: proposal }),
|
|
15
|
+
(chain = [::Decidim::ReportingProposals::Admin::Permissions]) %>
|
|
13
16
|
<%= render partial: "decidim/reporting_proposals/admin/proposals/photo_form" %>
|
|
14
17
|
<% end %>
|
|
15
18
|
</div>
|
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
<%= icon_link_to "delete-bin-line", decidim_admin_reporting_proposals.hide_proposal_path(id: proposal),
|
|
4
4
|
t("actions.hide", scope: "decidim.moderations"), method: :put, class: "action-icon" %>
|
|
5
5
|
<% else %>
|
|
6
|
-
|
|
7
|
-
<button type="button" class="action-icon icon--small action-icon--show-proposal"
|
|
8
|
-
data-dialog-open="flagModal<%= proposal.id %>"
|
|
9
|
-
title="<%= t("report", scope: "decidim.proposals.admin.proposals.show") %>"
|
|
10
|
-
aria-controls="flagModal<%= proposal.id %>"
|
|
11
|
-
aria-haspopup="true"
|
|
12
|
-
tabindex="0">
|
|
13
|
-
<%= icon "flag-line", aria_hidden: true, class: "hide-button icon--small action-icon--show-proposal", role: "img", "aria-hidden": true %>
|
|
14
|
-
</button>
|
|
6
|
+
<%= cell "decidim/report_button", proposal, button_classes: "button__text-secondary", modal_id: "flagModal-#{proposal.id}" %>
|
|
15
7
|
<% end %>
|
|
16
8
|
<% end %>
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
<% end %>
|
|
8
8
|
</span>
|
|
9
9
|
<div class="table__list-title">
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
<% if allowed_to? :edit, :proposal, proposal: proposal %>
|
|
11
|
+
<%= link_to present(proposal).title(html_escape: true), proposal_path(proposal) %><br>
|
|
12
|
+
<% else %>
|
|
13
|
+
<%= present(proposal).title(html_escape: true) %><br>
|
|
14
|
+
<% end %>
|
|
14
15
|
<% if unanswered_proposals_overdue?(proposal) %>
|
|
15
16
|
<div class="help-text-overdue text-alert">
|
|
16
17
|
<%= time_ago_in_words(last_day_to_answer(proposal),
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<div class="field">
|
|
19
|
-
<%= form.
|
|
20
|
-
|
|
19
|
+
<%= form.attachment :add_photos,
|
|
20
|
+
multiple: false,
|
|
21
|
+
label: t("image", scope: "decidim.reporting_proposals.proposals.form"),
|
|
22
|
+
button_class: "button button__lg button__transparent-secondary w-full" %>
|
|
21
23
|
<div class="has_no_image">
|
|
22
24
|
<%= form.check_box :has_no_image %>
|
|
23
25
|
</div>
|
|
@@ -1,76 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<%= form.categories_select :category_id, @form.categories, include_blank: t("decidim.proposals.proposals.edit.select_a_category") %>
|
|
5
|
-
</div>
|
|
6
|
-
<% end %>
|
|
1
|
+
<% if @form.categories&.any? %>
|
|
2
|
+
<%= form.categories_select :category_id, @form.categories, include_blank: t("decidim.proposals.proposals.edit.select_a_category") %>
|
|
3
|
+
<% end %>
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
<%= render "decidim/reporting_proposals/proposals/camera_button", form: form %>
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
<% if @form.geocoding_enabled? %>
|
|
8
|
+
<div id="address_input">
|
|
9
|
+
<div class="address-fill">
|
|
10
|
+
<%= form.geocoding_field(
|
|
11
|
+
:address,
|
|
12
|
+
required: true,
|
|
13
|
+
placeholder: t("decidim.proposals.proposals.placeholder.address"),
|
|
14
|
+
data: {
|
|
15
|
+
screen_reader_announcement: t("decidim.proposals.proposals.edit_form_fields.marker_added")
|
|
16
|
+
}
|
|
17
|
+
) %>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="has_no_address">
|
|
20
|
+
<%= form.check_box :has_no_address %>
|
|
21
|
+
<%= form.hidden_field :has_address, value: "1" %>
|
|
22
|
+
</div>
|
|
23
|
+
<div id="address_map" class="proposal__container">
|
|
24
|
+
<p class="help-text">
|
|
25
|
+
<%= t("instructions", scope: "decidim.proposals.proposals.dynamic_map_instructions") %> <%= t("description", scope: "decidim.proposals.proposals.dynamic_map_instructions") %>
|
|
26
|
+
</p>
|
|
27
|
+
<%= dynamic_map_for proposal_preview_data_for_map(@form.to_h) %>
|
|
25
28
|
</div>
|
|
26
|
-
<% end %>
|
|
27
|
-
|
|
28
|
-
<div class="field hashtags__container">
|
|
29
|
-
<%= form.text_field :title, class: "js-hashtags", value: form_presenter.title %>
|
|
30
29
|
</div>
|
|
30
|
+
<% end %>
|
|
31
|
+
|
|
32
|
+
<%= form.text_field :title, class: "js-hashtags", value: form_presenter.title %>
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
<%= text_editor_for_proposal_body(form) %>
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</div>
|
|
36
|
+
<% if @form.component_automatic_hashtags.any? %>
|
|
37
|
+
<div class="field">
|
|
38
|
+
<%= form.label :automatic_hashtags %>
|
|
39
|
+
<div class="checkboxes hashtags">
|
|
40
|
+
<% @form.component_automatic_hashtags.each do |hashtag| %>
|
|
41
|
+
<label>
|
|
42
|
+
<%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %>
|
|
43
|
+
</label>
|
|
44
|
+
<% end %>
|
|
44
45
|
</div>
|
|
45
|
-
|
|
46
|
+
</div>
|
|
47
|
+
<% end %>
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</div>
|
|
49
|
+
<% if @form.component_suggested_hashtags.any? %>
|
|
50
|
+
<div class="field">
|
|
51
|
+
<%= form.label :suggested_hashtags, nil, for: nil %>
|
|
52
|
+
<div class="checkboxes hashtags">
|
|
53
|
+
<%= form.collection_check_boxes :suggested_hashtags, @form.component_suggested_hashtags.map { |hashtag| [hashtag.downcase, "##{hashtag}"] }, :first, :last do |option|
|
|
54
|
+
option.label { option.check_box(checked: @form.suggested_hashtag_checked?(option.value)) + option.text }
|
|
55
|
+
end %>
|
|
55
56
|
</div>
|
|
56
|
-
|
|
57
|
+
</div>
|
|
58
|
+
<% end %>
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
<% if current_component.has_subscopes? %>
|
|
61
|
+
<%= scopes_select_field form, :scope_id, root: current_component.scope %>
|
|
62
|
+
<% end %>
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</div>
|
|
64
|
+
<% if component_settings.attachments_allowed? && !component_settings.only_photo_attachments? %>
|
|
65
|
+
<%= form.attachment :documents,
|
|
66
|
+
multiple: true,
|
|
67
|
+
label: t("decidim.proposals.proposals.edit.add_documents"),
|
|
68
|
+
button_label: t("decidim.proposals.proposals.edit.add_documents"),
|
|
69
|
+
button_edit_label: t("decidim.proposals.proposals.edit.edit_documents"),
|
|
70
|
+
button_class: "button button__lg button__transparent-secondary w-full",
|
|
71
|
+
help_i18n_scope: "decidim.forms.file_help.file",
|
|
72
|
+
help_text: t("attachment_legend", scope: "decidim.proposals.proposals.edit") %>
|
|
73
|
+
<% end %>
|
|
74
|
+
|
|
75
|
+
<% if current_organization.user_groups_enabled? && Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
|
|
76
|
+
<%= user_group_select_field form, :user_group_id %>
|
|
77
|
+
<% end %>
|
data/bin/bundle
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "rubygems"
|
|
5
|
+
|
|
6
|
+
m = Module.new do
|
|
7
|
+
extend self
|
|
8
|
+
|
|
9
|
+
def invoked_as_script?
|
|
10
|
+
File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def cli_arg_version
|
|
14
|
+
return unless invoked_as_script? # do not want to hijack other binstubs
|
|
15
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
|
16
|
+
|
|
17
|
+
bundler_version = nil
|
|
18
|
+
update_index = nil
|
|
19
|
+
ARGV.each_with_index do |a, i|
|
|
20
|
+
bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
|
21
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
|
22
|
+
|
|
23
|
+
bundler_version = Regexp.last_match(1) || ">= 0.a"
|
|
24
|
+
update_index = i
|
|
25
|
+
end
|
|
26
|
+
bundler_version
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def gemfile
|
|
30
|
+
File.expand_path("../Gemfile", __dir__)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def lockfile
|
|
34
|
+
"#{gemfile}.lock"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def lockfile_version
|
|
38
|
+
return unless File.file?(lockfile)
|
|
39
|
+
|
|
40
|
+
lockfile_contents = File.read(lockfile)
|
|
41
|
+
|
|
42
|
+
regexp = /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
|
43
|
+
|
|
44
|
+
regexp.match(lockfile_contents)[1]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def bundler_version
|
|
48
|
+
@bundler_version ||= cli_arg_version || lockfile_version
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def load_bundler!
|
|
52
|
+
activate_bundler(bundler_version)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def activate_bundler(bundler_version)
|
|
56
|
+
gem "bundler", bundler_version
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
m.load_bundler!
|
|
61
|
+
|
|
62
|
+
load Gem.bin_path("bundler", "bundle") if m.invoked_as_script?
|
data/bin/rspec
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
load File.expand_path("bundle", __dir__)
|
|
5
|
+
|
|
6
|
+
require "rubygems"
|
|
7
|
+
require "bundler/setup"
|
|
8
|
+
|
|
9
|
+
if ARGV[0]
|
|
10
|
+
cleaned_file_path = ARGV[0].split("./").last
|
|
11
|
+
argument_parts = cleaned_file_path.split("/")
|
|
12
|
+
|
|
13
|
+
first_part = argument_parts[0]
|
|
14
|
+
|
|
15
|
+
if first_part =~ /decidim-/ && File.directory?(first_part)
|
|
16
|
+
Dir.chdir(first_part)
|
|
17
|
+
|
|
18
|
+
other_parts = argument_parts[1..-1]
|
|
19
|
+
|
|
20
|
+
new_args = [other_parts.empty? ? nil : other_parts.join("/"), *ARGV[1..-1]].compact
|
|
21
|
+
|
|
22
|
+
ARGV.replace(new_args)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/test
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
version="last"
|
|
4
|
+
prefix=
|
|
5
|
+
if [ "$BUNDLE_GEMFILE" == "Gemfile.legacy" ]; then
|
|
6
|
+
version="legacy"
|
|
7
|
+
prefix="BUNDLE_GEMFILE=$BUNDLE_GEMFILE RBENV_VERSION=$RBENV_VERSION"
|
|
8
|
+
echo "Using legacy version (gemfile: $BUNDLE_GEMFILE, ruby: $RBENV_VERSION)"
|
|
9
|
+
else
|
|
10
|
+
BUNDLE_GEMFILE="Gemfile"
|
|
11
|
+
echo "Using latest version"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
cd spec
|
|
15
|
+
# check if directory exists
|
|
16
|
+
if [ ! -d "decidim_dummy_app_$version" ]; then
|
|
17
|
+
echo "Please generate the test app first:"
|
|
18
|
+
echo -n "$prefix "
|
|
19
|
+
echo "bundle exec rake test_app && mv spec/decidim_dummy_app spec/decidim_dummy_app_$version"
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
# check if directory is a symlink pointing where it should
|
|
23
|
+
if [ ! "decidim_dummy_app_$version" -ef "decidim_dummy_app" ]; then
|
|
24
|
+
# if it is a symlink, delete it
|
|
25
|
+
echo "creating symlink to decidim_dummy_app_$version"
|
|
26
|
+
rm decidim_dummy_app
|
|
27
|
+
ln -s decidim_dummy_app_$version decidim_dummy_app
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [ "$1" == "--reset" ]; then
|
|
31
|
+
echo "Reseting the database"
|
|
32
|
+
cd decidim_dummy_app
|
|
33
|
+
if [ "$BUNDLE_GEMFILE" == "Gemfile.legacy" ]; then
|
|
34
|
+
BUNDLE_GEMFILE="../../Gemfile.legacy" RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load
|
|
35
|
+
else
|
|
36
|
+
RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load
|
|
37
|
+
fi
|
|
38
|
+
else
|
|
39
|
+
echo "Precompiling test assets"
|
|
40
|
+
cd decidim_dummy_app
|
|
41
|
+
if [ -z "$SKIP_PRECOMPILE" ]; then
|
|
42
|
+
BUNDLE_GEMFILE="../../$BUNDLE_GEMFILE" RAILS_ENV=test bundle exec rails assets:precompile
|
|
43
|
+
fi
|
|
44
|
+
cd ../..
|
|
45
|
+
echo bundle exec rspec $@
|
|
46
|
+
bundle exec rspec $@
|
|
47
|
+
fi
|
data/bin/test-legacy
ADDED
data/config/locales/ca.yml
CHANGED
|
@@ -9,6 +9,9 @@ ca:
|
|
|
9
9
|
has_no_image: Sense imatge
|
|
10
10
|
decidim:
|
|
11
11
|
admin:
|
|
12
|
+
actions:
|
|
13
|
+
manage: Gestiona
|
|
14
|
+
new: Nou
|
|
12
15
|
hidden_resource_mailer:
|
|
13
16
|
notify_mail:
|
|
14
17
|
body_1: Un administrador ha esborrat la vostra proposta perquè ha estat denunciada.
|
|
@@ -16,10 +19,6 @@ ca:
|
|
|
16
19
|
hello: Hola,
|
|
17
20
|
reason: 'Motiu: %{reason}'
|
|
18
21
|
subject: La teva proposta ha estat amagada
|
|
19
|
-
templates:
|
|
20
|
-
fetch:
|
|
21
|
-
error: No s'ha trobat aquesta plantilla, potser ha estat esborrada?
|
|
22
|
-
missing_resource: "(recurs absent)"
|
|
23
22
|
application:
|
|
24
23
|
geocoding:
|
|
25
24
|
unconfigured: La geocodificació no està configurada!
|
|
@@ -38,6 +37,14 @@ ca:
|
|
|
38
37
|
unanswered_proposals_overdue: Quants dies després una proposta sense resposta es considera vençuda
|
|
39
38
|
unanswered_proposals_overdue_help: Aquesta regla afegeix una alerta visual a la llista e propostes. Si no ho vols utilitzar, deixa aquest valor a zero.
|
|
40
39
|
reporting_proposals:
|
|
40
|
+
actions:
|
|
41
|
+
amend: Esmena
|
|
42
|
+
comment: Comentar
|
|
43
|
+
create: Crear
|
|
44
|
+
endorse: Adherir-se
|
|
45
|
+
vote: Donar suport
|
|
46
|
+
vote_comment: Votar el comentari
|
|
47
|
+
withdraw: Retirar
|
|
41
48
|
name: Propostes directes
|
|
42
49
|
settings:
|
|
43
50
|
global:
|
|
@@ -166,14 +173,8 @@ ca:
|
|
|
166
173
|
geolocated_at: Geolocalització
|
|
167
174
|
send_email_button:
|
|
168
175
|
send_mail: Envia un correu electrònic a l'usuari
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
admin_panel: panell d'administració
|
|
172
|
-
email_body: Has estat assignat com a avaluador de les propostes llistades a sota. Això significa que s'ha confiat en tu per donar-hi resposta en els propoers dies.
|
|
173
|
-
gratitude: Gràcies per la teva ajuda!
|
|
174
|
-
greeting: Hola %{name},
|
|
175
|
-
public_side: lloc públic
|
|
176
|
-
subject: Nova proposta asignada per la teva avaluació
|
|
176
|
+
show:
|
|
177
|
+
report: Denuncia
|
|
177
178
|
reported_mailer:
|
|
178
179
|
report:
|
|
179
180
|
admin_resource: Administra el recurs
|
|
@@ -339,6 +340,7 @@ ca:
|
|
|
339
340
|
photo_form:
|
|
340
341
|
action: Afageix imatge
|
|
341
342
|
add_images: Afegeix imatges
|
|
343
|
+
edit_images: Editar imatge
|
|
342
344
|
gallery_legend: Afegeix imatges
|
|
343
345
|
title: Fotografies
|
|
344
346
|
upload_msg: Cap arxiu seleccionat
|
|
@@ -352,6 +354,14 @@ ca:
|
|
|
352
354
|
remove_assignment: desfer assignació
|
|
353
355
|
remove_assignment_confirmation: eliminar la confirmació de l'assignació
|
|
354
356
|
valuators: Avaluadores
|
|
357
|
+
proposals_valuator_mailer:
|
|
358
|
+
notify_proposals_valuator:
|
|
359
|
+
admin_panel: panell d'administració
|
|
360
|
+
email_body: Has estat assignat com a avaluador de les propostes llistades a sota. Això significa que s'ha confiat en tu per donar-hi resposta en els propoers dies.
|
|
361
|
+
gratitude: Gràcies per la teva ajuda!
|
|
362
|
+
greeting: Hola %{name},
|
|
363
|
+
public_side: lloc públic
|
|
364
|
+
subject: Nova proposta asignada per la teva avaluació
|
|
355
365
|
resolution_time: Temps de resolució
|
|
356
366
|
time_elapsed:
|
|
357
367
|
datetime:
|
|
@@ -416,25 +426,3 @@ ca:
|
|
|
416
426
|
delete_image: Esborra la imatge
|
|
417
427
|
form:
|
|
418
428
|
image: Imatge/fotografia
|
|
419
|
-
templates:
|
|
420
|
-
admin:
|
|
421
|
-
proposal_answer_templates:
|
|
422
|
-
form:
|
|
423
|
-
answer_template: Plantilla de resposta
|
|
424
|
-
hint: "<strong>Suggeriment:</strong> Pots fer servir aquestes variables a qualsevol lloc a la plantilla de resposta i seran substituïdes pels valors en actiu quan es faci servir"
|
|
425
|
-
hint1: "<strong>%{organization}</strong> se substituirà pel nom de l'organització"
|
|
426
|
-
hint2: "<strong>%{name}</strong> se substituirà pel nom de l'autor"
|
|
427
|
-
hint3: "<strong>%{admin}</strong> se substituirà pel nom de l'administrador (el que està responent a la proposta)"
|
|
428
|
-
save: Desa
|
|
429
|
-
scope_for_availability_help: Noteu que només es llistaran els espais participatius que tinguin components de tipus "propostes".
|
|
430
|
-
template_title: Informació de la plantilla
|
|
431
|
-
index:
|
|
432
|
-
confirm_delete: Està segur que vol suprimir aquesta plantilla?
|
|
433
|
-
global_scope: Global (disponible a tot arreu)
|
|
434
|
-
internal_state: Estat intern
|
|
435
|
-
scope_for_availability: Àmbit
|
|
436
|
-
title: Respostes a la proposta
|
|
437
|
-
template_chooser:
|
|
438
|
-
select_template: Selecciona una plantilla de resposta
|
|
439
|
-
template_types:
|
|
440
|
-
proposal_answer_templates: Respostes a la proposta
|