decidim-action_delegator 0.8.2 → 0.9.0
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/README.md +104 -58
- data/Rakefile +2 -2
- data/app/commands/decidim/action_delegator/admin/create_delegation.rb +1 -3
- data/app/commands/decidim/action_delegator/admin/create_setting.rb +5 -2
- data/app/commands/decidim/action_delegator/admin/update_setting.rb +4 -2
- data/app/controllers/concerns/decidim/action_delegator/devise/sessions_controller_override.rb +1 -1
- data/app/controllers/concerns/decidim/action_delegator/election_per_question_votes_controller_override.rb +65 -0
- data/app/controllers/concerns/decidim/action_delegator/election_votes_controller_override.rb +38 -0
- data/app/controllers/concerns/decidim/action_delegator/votes_controller_methods.rb +46 -0
- data/app/controllers/decidim/action_delegator/admin/application_controller.rb +11 -5
- data/app/controllers/decidim/action_delegator/admin/delegations_controller.rb +2 -10
- data/app/controllers/decidim/action_delegator/admin/invite_participants_controller.rb +0 -8
- data/app/controllers/decidim/action_delegator/admin/manage_delegations_controller.rb +13 -20
- data/app/controllers/decidim/action_delegator/admin/manage_participants_controller.rb +11 -19
- data/app/controllers/decidim/action_delegator/admin/participants_controller.rb +1 -9
- data/app/controllers/decidim/action_delegator/admin/permissions_controller.rb +1 -24
- data/app/controllers/decidim/action_delegator/admin/ponderations_controller.rb +0 -8
- data/app/controllers/decidim/action_delegator/admin/settings_controller.rb +12 -12
- data/app/controllers/decidim/action_delegator/application_controller.rb +3 -3
- data/app/controllers/decidim/action_delegator/elections/admin/results_controller.rb +58 -0
- data/app/controllers/decidim/action_delegator/elections/results_controller.rb +36 -0
- data/app/controllers/decidim/action_delegator/user_delegations_controller.rb +1 -1
- data/app/controllers/decidim/action_delegator/verifications/delegations_verifier/authorizations_controller.rb +14 -18
- data/app/forms/decidim/action_delegator/admin/action_delegator_census_form.rb +44 -0
- data/app/forms/decidim/action_delegator/admin/csv_import_form.rb +17 -0
- data/app/forms/decidim/action_delegator/admin/ponderation_form.rb +2 -1
- data/app/forms/decidim/action_delegator/admin/setting_form.rb +16 -10
- data/app/forms/decidim/action_delegator/censuses/internal_users_form.rb +32 -0
- data/app/forms/decidim/action_delegator/verifications/delegations_verifier_form.rb +41 -25
- data/app/helpers/decidim/action_delegator/admin/{delegation_helper.rb → settings_helper.rb} +3 -16
- data/app/helpers/decidim/action_delegator/settings_helper.rb +124 -0
- data/app/jobs/decidim/action_delegator/admin/invite_participants_job.rb +1 -1
- data/app/jobs/decidim/action_delegator/send_sms_job.rb +2 -2
- data/app/jobs/decidim/action_delegator/twilio_send_sms_job.rb +2 -2
- data/app/models/decidim/action_delegator/delegation.rb +15 -14
- data/app/models/decidim/action_delegator/participant.rb +7 -10
- data/app/models/decidim/action_delegator/ponderation.rb +0 -2
- data/app/models/decidim/action_delegator/setting.rb +14 -32
- data/app/overrides/decidim/elections/admin/dashboard/_results/_add_results_contents.html.erb.deface +10 -0
- data/app/overrides/decidim/elections/admin/dashboard/_results/_add_results_tabs.html.erb.deface +3 -0
- data/app/overrides/decidim/elections/elections/_election_aside/add_delegation_buttons.html.erb.deface +3 -0
- data/app/overrides/decidim/elections/elections/_vote_results/replace_results_div.html.erb.deface +8 -0
- data/app/overrides/decidim/elections/per_question_votes/show/add_delegation_hidden_input.html.erb.deface +3 -0
- data/app/overrides/decidim/elections/per_question_votes/show/add_delegation_id_to_links.html.erb.deface +3 -0
- data/app/overrides/decidim/elections/per_question_votes/waiting/add_delegation_buttons.html.erb.deface +3 -0
- data/app/overrides/decidim/elections/votes/receipt/add_delegation_buttons.html.erb.deface +3 -0
- data/app/packs/entrypoints/decidim_action_delegator_elections.js +1 -0
- data/app/packs/src/decidim/action_delegator/elections_live_results.js +160 -0
- data/app/permissions/decidim/action_delegator/admin/permissions.rb +29 -0
- data/app/permissions/decidim/action_delegator/permissions.rb +6 -30
- data/app/presenters/decidim/action_delegator/setting_presenter.rb +33 -0
- data/app/queries/decidim/action_delegator/action_delegator_census_users.rb +51 -0
- data/app/queries/decidim/action_delegator/authorized_resources.rb +28 -0
- data/app/queries/decidim/action_delegator/election_settings.rb +23 -0
- data/app/queries/decidim/action_delegator/{delegated_votes_versions.rb → elections_delegated_votes_versions.rb} +8 -8
- data/app/queries/decidim/action_delegator/elections_question_responses_by_type.rb +33 -0
- data/app/queries/decidim/action_delegator/elections_question_weighted_responses.rb +28 -0
- data/app/queries/decidim/action_delegator/elections_votes_with_ponderations.rb +62 -0
- data/app/services/decidim/action_delegator/participants_csv_importer.rb +1 -1
- data/app/services/decidim/action_delegator/sms_gateway.rb +2 -2
- data/app/views/decidim/action_delegator/admin/censuses/_action_delegator_census_form.html.erb +44 -0
- data/app/views/decidim/action_delegator/admin/censuses/_action_delegator_census_options_form.html.erb +25 -0
- data/app/views/decidim/action_delegator/admin/delegations/index.html.erb +12 -13
- data/app/views/decidim/action_delegator/admin/delegations/new.html.erb +29 -27
- data/app/views/decidim/action_delegator/admin/manage_delegations/new.html.erb +36 -24
- data/app/views/decidim/action_delegator/admin/manage_participants/new.html.erb +47 -33
- data/app/views/decidim/action_delegator/admin/participants/_form.html.erb +14 -8
- data/app/views/decidim/action_delegator/admin/participants/edit.html.erb +11 -13
- data/app/views/decidim/action_delegator/admin/participants/index.html.erb +20 -25
- data/app/views/decidim/action_delegator/admin/participants/new.html.erb +11 -13
- data/app/views/decidim/action_delegator/admin/ponderations/_form.html.erb +13 -7
- data/app/views/decidim/action_delegator/admin/ponderations/edit.html.erb +11 -13
- data/app/views/decidim/action_delegator/admin/ponderations/index.html.erb +8 -11
- data/app/views/decidim/action_delegator/admin/ponderations/new.html.erb +11 -13
- data/app/views/decidim/action_delegator/admin/settings/_form.html.erb +26 -12
- data/app/views/decidim/action_delegator/admin/settings/_participants_sync_check.html.erb +1 -1
- data/app/views/decidim/action_delegator/admin/settings/_setting_checks.html.erb +11 -16
- data/app/views/decidim/action_delegator/admin/settings/edit.html.erb +11 -12
- data/app/views/decidim/action_delegator/admin/settings/index.html.erb +22 -19
- data/app/views/decidim/action_delegator/admin/settings/new.html.erb +11 -12
- data/app/views/decidim/action_delegator/admin/shared/_tabs_menu.html.erb +15 -0
- data/app/views/decidim/action_delegator/censuses/_internal_users_form.html.erb +61 -0
- data/app/views/decidim/action_delegator/elections/_delegation_buttons.html.erb +10 -0
- data/app/views/decidim/action_delegator/elections/_normal_election_buttons.html.erb +13 -0
- data/app/views/decidim/action_delegator/elections/_per_question_buttons.html.erb +9 -0
- data/app/views/decidim/action_delegator/elections/_per_question_waiting_buttons.html.erb +19 -0
- data/app/views/decidim/action_delegator/elections/_vote_results.html.erb +10 -0
- data/app/views/decidim/action_delegator/elections/_vote_results_question.html.erb +13 -0
- data/app/views/decidim/action_delegator/elections/admin/dashboard/_by_type_and_weight.html.erb +45 -0
- data/app/views/decidim/action_delegator/elections/admin/dashboard/_results_tabs.html.erb +5 -0
- data/app/views/decidim/action_delegator/elections/admin/dashboard/_results_type_info.html.erb +4 -0
- data/app/views/decidim/action_delegator/elections/admin/dashboard/_sum_of_weights.html.erb +43 -0
- data/app/views/decidim/action_delegator/elections/admin/dashboard/_totals.html.erb +27 -0
- data/app/views/decidim/action_delegator/user_delegations/index.html.erb +13 -14
- data/app/views/decidim/action_delegator/verifications/delegations_verifier/authorizations/edit.html.erb +19 -29
- data/app/views/decidim/action_delegator/verifications/delegations_verifier/authorizations/new.html.erb +42 -40
- data/config/assets.rb +3 -36
- data/config/i18n-tasks.yml +27 -5
- data/config/locales/ca.yml +103 -146
- data/config/locales/cs.yml +161 -145
- data/config/locales/en.yml +110 -75
- data/config/locales/es.yml +108 -154
- data/db/migrate/20200824113801_create_settings.rb +1 -1
- data/db/migrate/20250729104037_add_title_to_action_delegator_settings.rb +31 -0
- data/lib/decidim/action_delegator/admin_engine.rb +72 -45
- data/lib/decidim/action_delegator/common_rake.rb +13 -0
- data/lib/decidim/action_delegator/engine.rb +48 -19
- data/lib/decidim/action_delegator/test/delegation_examples.rb +144 -0
- data/lib/decidim/action_delegator/test/factories.rb +11 -6
- data/lib/decidim/action_delegator/verifications/delegations_authorizer.rb +80 -47
- data/lib/decidim/action_delegator/version.rb +3 -3
- data/lib/decidim/action_delegator.rb +8 -26
- data/lib/tasks/migrate_consultations.rake +382 -0
- data/lib/tasks/upgrade_tasks.rake +5 -0
- data/package.json +10 -27
- metadata +72 -122
- data/app/commands/concerns/decidim/action_delegator/consultations/multiple_vote_question_override.rb +0 -31
- data/app/commands/concerns/decidim/action_delegator/consultations/vote_question_override.rb +0 -44
- data/app/commands/decidim/action_delegator/admin/fix_resource_permissions.rb +0 -46
- data/app/commands/decidim/action_delegator/vote_delegation.rb +0 -28
- data/app/controllers/concerns/decidim/action_delegator/consultations/consultations_controller_override.rb +0 -16
- data/app/controllers/concerns/decidim/action_delegator/consultations/question_multiple_votes_controller_override.rb +0 -29
- data/app/controllers/concerns/decidim/action_delegator/consultations/question_votes_controller_override.rb +0 -57
- data/app/controllers/concerns/decidim/action_delegator/consultations/questions_controller_override.rb +0 -16
- data/app/controllers/concerns/decidim/action_delegator/needs_consultation_styles.rb +0 -24
- data/app/controllers/decidim/action_delegator/admin/consultations/exports_controller.rb +0 -27
- data/app/controllers/decidim/action_delegator/admin/consultations_controller.rb +0 -47
- data/app/controllers/decidim/action_delegator/admin/exports/_sum_of_weights_controller.rb +0 -15
- data/app/controllers/decidim/action_delegator/questions_summary_controller.rb +0 -14
- data/app/forms/concerns/decidim/action_delegator/consultations/vote_form_override.rb +0 -15
- data/app/helpers/decidim/action_delegator/delegation_helper.rb +0 -13
- data/app/jobs/decidim/action_delegator/export_consultation_results_job.rb +0 -51
- data/app/models/concerns/decidim/action_delegator/consultations/question_override.rb +0 -36
- data/app/models/concerns/decidim/action_delegator/consultations/vote_override.rb +0 -15
- data/app/models/decidim/action_delegator/unversioned_vote.rb +0 -19
- data/app/models/decidim/action_delegator/whodunnit_vote.rb +0 -28
- data/app/overrides/decidim/consultations/admin/consultations/results/add_ongoing_warning.html.erb.deface +0 -3
- data/app/overrides/decidim/consultations/consultations/_question/add_delegation_link.html.erb.deface +0 -3
- data/app/overrides/decidim/consultations/consultations/_question/replace_vote_info.html.erb.deface +0 -4
- data/app/overrides/decidim/consultations/consultations/_regular_questions/prevent_empty_questions.html.erb.deface +0 -10
- data/app/overrides/decidim/consultations/consultations/_regular_questions/remove_highlighted_scopes.html.erb.deface +0 -5
- data/app/overrides/decidim/consultations/question_multiple_votes/_form/add_delegation_notice.html.erb.deface +0 -8
- data/app/overrides/decidim/consultations/questions/_results/replace_results.html.erb.deface +0 -3
- data/app/overrides/decidim/consultations/questions/_vote_button/add_delegations_link.html.erb.deface +0 -3
- data/app/overrides/decidim/consultations/questions/_vote_button/add_modal.html.erb.deface +0 -3
- data/app/overrides/decidim/consultations/questions/_vote_button/add_modal_javascript.html.erb.deface +0 -3
- data/app/overrides/decidim/consultations/questions/_vote_button/replace_delegation_to_multivote_link.html.erb.deface +0 -8
- data/app/overrides/decidim/consultations/questions/_vote_modal/add_delegation_callout.html.erb.deface +0 -3
- data/app/overrides/decidim/consultations/questions/_vote_modal_confirm/add_delegation_callout.html.erb.deface +0 -3
- data/app/overrides/decidim/consultations/questions/_vote_modal_confirm/add_hidden_field.html.erb.deface +0 -3
- data/app/overrides/layouts/decidim/_consultation_header/add_consultation_callout.html.erb.deface +0 -9
- data/app/overrides/layouts/decidim/_question_header/add_consultation_callout.html.erb.deface +0 -9
- data/app/overrides/layouts/decidim/admin/remove_deprecation.rb +0 -10
- data/app/packs/entrypoints/decidim_action_delegator.scss +0 -1
- data/app/packs/entrypoints/decidim_action_delegator_questions.js +0 -5
- data/app/packs/entrypoints/decidim_action_delegator_questions_summary.js +0 -1
- data/app/packs/src/decidim/action_delegator/questions.js +0 -33
- data/app/packs/src/decidim/action_delegator/summary.js +0 -24
- data/app/packs/stylesheets/decidim/action_delegator/questions.scss +0 -26
- data/app/permissions/concerns/decidim/action_delegator/consultations/permissions_override.rb +0 -35
- data/app/presenters/decidim/action_delegator/question_with_totals.rb +0 -24
- data/app/queries/decidim/action_delegator/consultation_delegations.rb +0 -25
- data/app/queries/decidim/action_delegator/delegates_votes_by_consultation.rb +0 -24
- data/app/queries/decidim/action_delegator/delegates_votes_by_question.rb +0 -26
- data/app/queries/decidim/action_delegator/delegation_votes.rb +0 -30
- data/app/queries/decidim/action_delegator/grantee_delegations.rb +0 -24
- data/app/queries/decidim/action_delegator/organization_delegations.rb +0 -26
- data/app/queries/decidim/action_delegator/organization_settings.rb +0 -31
- data/app/queries/decidim/action_delegator/responses.rb +0 -24
- data/app/queries/decidim/action_delegator/responses_by_membership.rb +0 -58
- data/app/queries/decidim/action_delegator/scrutiny.rb +0 -87
- data/app/queries/decidim/action_delegator/setting_delegations.rb +0 -19
- data/app/queries/decidim/action_delegator/sum_of_membership_weight.rb +0 -44
- data/app/queries/decidim/action_delegator/sum_of_weights.rb +0 -25
- data/app/queries/decidim/action_delegator/type_and_weight.rb +0 -26
- data/app/queries/decidim/action_delegator/voted_with_ponderations.rb +0 -30
- data/app/queries/decidim/action_delegator/votes_count_aggregation.rb +0 -34
- data/app/serializers/decidim/action_delegator/consultation_results_serializer.rb +0 -19
- data/app/views/decidim/action_delegator/admin/consultations/_ongoing_consultation_warning.html.erb +0 -3
- data/app/views/decidim/action_delegator/admin/consultations/results.html.erb +0 -65
- data/app/views/decidim/action_delegator/admin/consultations/weighted_results.html.erb +0 -66
- data/app/views/decidim/action_delegator/consultations/_link_to_question.html.erb +0 -11
- data/app/views/decidim/action_delegator/consultations/_link_with_results.html.erb +0 -11
- data/app/views/decidim/action_delegator/consultations/questions/_callout.html.erb +0 -5
- data/app/views/decidim/action_delegator/consultations/questions/_delegations_modal.html.erb +0 -34
- data/app/views/decidim/action_delegator/consultations/questions/_link_to_delegations.html.erb +0 -15
- data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_active.html.erb +0 -32
- data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_finished.html.erb +0 -9
- data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_upcoming.html.erb +0 -8
- data/app/views/decidim/action_delegator/consultations/questions/_weight_results.html.erb +0 -8
- data/app/views/decidim/consultations/question_votes/_callout.html.erb +0 -47
- data/app/views/decidim/consultations/question_votes/update_vote_button.js.erb +0 -82
- data/lib/tasks/import_direct_verification.rake +0 -30
@@ -1,34 +0,0 @@
|
|
1
|
-
<div class="reveal" data-reveal id="delegations-modal">
|
2
|
-
<div class="reveal__header">
|
3
|
-
<h3 class="reveal__title">
|
4
|
-
<%= t "action_delegator.delegations_modal.title", scope: "decidim" %>
|
5
|
-
</h3>
|
6
|
-
<button class="close-button" data-close aria-label="Close modal" type="button">
|
7
|
-
<span aria-hidden="true">×</span>
|
8
|
-
</button>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<p><%= t "action_delegator.delegations_modal.contextual_help", scope: "decidim" %></p>
|
12
|
-
<div class="card card--secondary">
|
13
|
-
<div class="card__content">
|
14
|
-
|
15
|
-
<% signed_in? && Decidim::ActionDelegator::GranteeDelegations.for(question.consultation, current_user).each do |delegation| %>
|
16
|
-
<div class="row">
|
17
|
-
<div class="columns medium-5 medium-offset-1">
|
18
|
-
<%= delegation.granter.name %>
|
19
|
-
</div>
|
20
|
-
<div class="columns medium-5 medium-offset-1">
|
21
|
-
<%# Copied from decidim-consultation's _vote_button.html.erb %>
|
22
|
-
<% if question.consultation.upcoming? %>
|
23
|
-
<%= render "decidim/action_delegator/consultations/questions/vote_delegated_upcoming", question: question %>
|
24
|
-
<% elsif question.consultation.finished? && question.voted_by?(delegation.granter) %>
|
25
|
-
<%= render "decidim/action_delegator/consultations/questions/vote_delegated_finished", question: question %>
|
26
|
-
<% elsif question.consultation.active? %>
|
27
|
-
<%= render "decidim/action_delegator/consultations/questions/vote_delegated_active", question: question, delegation: delegation %>
|
28
|
-
<% end %>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
<% end %>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
</div>
|
data/app/views/decidim/action_delegator/consultations/questions/_link_to_delegations.html.erb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
<% if Decidim::ActionDelegator::Delegation.granted_to?(current_user, question.consultation) %>
|
2
|
-
<% if has_any_delegate_vote?(question) %>
|
3
|
-
<div class="delegations-notice flex--cc" style="margin-top:1rem;">
|
4
|
-
<button id="delegations-button" class="card__button hollow button small expanded text-white">
|
5
|
-
<%= t("action_delegator.delegations.has_delegations", scope: "decidim") %>
|
6
|
-
</button>
|
7
|
-
</div>
|
8
|
-
<% else %>
|
9
|
-
<div class="delegations-notice flex--cc" style="margin-top:1rem; width: 100%;">
|
10
|
-
<button id="delegations-button" class="card__button button small expanded secondary hollow">
|
11
|
-
<%= t("action_delegator.delegations.link", scope: "decidim") %>
|
12
|
-
</button>
|
13
|
-
</div>
|
14
|
-
<% end %>
|
15
|
-
<% end %>
|
data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_active.html.erb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
<% if allowed_to? :unvote_delegation, :question, { question: question, delegation: delegation }, [Decidim::ActionDelegator::Permissions, Decidim::Admin::Permissions, Decidim::Permissions] %>
|
2
|
-
<%= button_to decidim_consultations.question_question_votes_path(question),
|
3
|
-
method: :delete,
|
4
|
-
remote: true,
|
5
|
-
data: { disable: true },
|
6
|
-
class: "button expanded success delegation_unvote_button" do %>
|
7
|
-
<%= hidden_field_tag "decidim_consultations_delegation_id", delegation.id, id: "decidim_consultations_delegation_id_delete_#{delegation.id}" %>
|
8
|
-
<div class="vote-button-caption"
|
9
|
-
data-original="<%= t("questions.vote_button.already_voted", scope: "decidim") %>"
|
10
|
-
data-replace="<%= t("questions.vote_button.already_voted_hover", scope: "decidim") %>">
|
11
|
-
<%= t("questions.vote_button.already_voted", scope: "decidim") %>
|
12
|
-
</div>
|
13
|
-
<% end %>
|
14
|
-
<% elsif allowed_to? :vote_delegation, :question, { question: question, delegation: delegation }, [Decidim::ActionDelegator::Permissions, Decidim::Admin::Permissions, Decidim::Permissions] %>
|
15
|
-
<% if question.multiple? %>
|
16
|
-
<%= link_to decidim_consultations.question_question_multiple_votes_path(question, delegation: delegation.id),
|
17
|
-
class: "button expanded",
|
18
|
-
id: "multivote_button" do %>
|
19
|
-
<div class="vote-button-caption"><%= t "questions.vote_button.vote", scope: "decidim" %></div>
|
20
|
-
<% end %>
|
21
|
-
<% else %>
|
22
|
-
<%# This link is slightly modified from _vote_button to add stuff needed by delegations %>
|
23
|
-
<%= link_to "#", class: "button expanded delegation-vote-button", data: { "delegation-id" => delegation.id, "delegation-granter-name" => delegation.granter.name } do %>
|
24
|
-
<div class="vote-button-caption"><%= t "questions.vote_button.vote", scope: "decidim" %></div>
|
25
|
-
<% end %>
|
26
|
-
|
27
|
-
<% end %>
|
28
|
-
<% else %>
|
29
|
-
<%= authorized_vote_modal_button(question, remote: true, class: "button expanded light button--sc") do %>
|
30
|
-
<%= t("questions.vote_button.verification_required", scope: "decidim") %>
|
31
|
-
<% end %>
|
32
|
-
<% end %>
|
data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_finished.html.erb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
<%= button_to decidim_consultations.question_question_votes_path(question),
|
2
|
-
method: :delete,
|
3
|
-
remote: true,
|
4
|
-
data: { disable: true },
|
5
|
-
class: "button expanded success disabled delegation_unvote_button" do %>
|
6
|
-
<div class="vote-button-caption">
|
7
|
-
<%= t("questions.vote_button.already_voted", scope: "decidim") %>
|
8
|
-
</div>
|
9
|
-
<% end %>
|
data/app/views/decidim/action_delegator/consultations/questions/_vote_delegated_upcoming.html.erb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
<div class="button expanded disabled">
|
2
|
-
<div class="vote-button-caption"><%= t("questions.vote_button.vote", scope: "decidim") %></div>
|
3
|
-
<div>
|
4
|
-
<%= t "questions.vote_button.starting_from",
|
5
|
-
scope: "decidim",
|
6
|
-
date: l(question.start_voting_date) %>
|
7
|
-
</div>
|
8
|
-
</div>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<% question.responses_sorted_by_weighted_votes[question.id].each do |response| %>
|
2
|
-
<div class=card--list__item>
|
3
|
-
<div class="card--list__text"><%= translated_attribute response.title %></div>
|
4
|
-
<div class="card--list__data">
|
5
|
-
<span class="card--list__data__number"><%= response.votes_count %></span>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
<% end %>
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<% total_published_questions = consultation.questions.published.count %>
|
2
|
-
<% voted_questions = consultation.questions.published.joins(:votes).where(votes: { author: current_user }).distinct.count(:id) %>
|
3
|
-
|
4
|
-
<% alert_class = total_published_questions != voted_questions ? "warning" : "success" %>
|
5
|
-
|
6
|
-
<div class="callout <%= alert_class %>">
|
7
|
-
<p>
|
8
|
-
<%= t("action_delegator.questions.callout_text", scope: "decidim", voted: voted_questions, total: total_published_questions) %>
|
9
|
-
<a href="#" class="text-primary" id="consultations-questions-summary-button"><%= t("action_delegator.questions.callout_link_text", scope: "decidim") %></a>
|
10
|
-
</p>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
<div class="reveal" id="consultations-questions-summary-modal" data-reveal>
|
14
|
-
<h4><%= t("action_delegator.questions.modal.modal_votes_title", scope: "decidim", title: translated_attribute(consultation.title)) %></h4>
|
15
|
-
<p class="lead">
|
16
|
-
<table class="table-list">
|
17
|
-
<thead>
|
18
|
-
<tr>
|
19
|
-
<th width="200"><%= t("action_delegator.questions.modal.modal_table_header_question", scope: "decidim") %></th>
|
20
|
-
<th width="150"><%= t("action_delegator.questions.modal.modal_table_header_answer", scope: "decidim") %></th>
|
21
|
-
</tr>
|
22
|
-
</thead>
|
23
|
-
<tbody>
|
24
|
-
<% consultation.questions.each do |question| %>
|
25
|
-
<tr>
|
26
|
-
<td><%= strip_tags(translated_attribute(question.title)).truncate(200, separator: /\s/) %></td>
|
27
|
-
<td>
|
28
|
-
<% if question.votes.where(author: current_user).any? %>
|
29
|
-
<% user_response = question.responses.joins(:votes).find_by(votes: { author: current_user }) %>
|
30
|
-
<% if user_response %>
|
31
|
-
<p title="<%= translated_attribute(user_response.title) %>"><%= t("booleans.true") %></p>
|
32
|
-
<% else %>
|
33
|
-
<%= link_to t("action_delegator.questions.question_not_answered", scope: "decidim"), decidim_consultations.question_path(question), class: "text-primary" %>
|
34
|
-
<% end %>
|
35
|
-
<% else %>
|
36
|
-
<%= link_to t("action_delegator.questions.question_not_answered", scope: "decidim"), decidim_consultations.question_path(question), class: "text-primary" %>
|
37
|
-
<% end %>
|
38
|
-
</td>
|
39
|
-
</tr>
|
40
|
-
<% end %>
|
41
|
-
</tbody>
|
42
|
-
</table>
|
43
|
-
</p>
|
44
|
-
<button class="close-button" data-close aria-label="Close modal" type="button">
|
45
|
-
<span aria-hidden="true">×</span>
|
46
|
-
</button>
|
47
|
-
</div>
|
@@ -1,82 +0,0 @@
|
|
1
|
-
(function () {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
$('#question-vote-modal').foundation("close");
|
5
|
-
$('#question-vote-confirm-modal').foundation("close");
|
6
|
-
$('#question-vote-modal, #question-vote-confirm-modal').remove()
|
7
|
-
var voteButton = $('#question-<%= current_question.id %>-vote-button');
|
8
|
-
voteButton.html('<%= j(render partial: "decidim/consultations/questions/vote_button", locals: { question: current_question }) %>');
|
9
|
-
|
10
|
-
$('#question-vote-modal').foundation();
|
11
|
-
$('#question-vote-confirm-modal').foundation();
|
12
|
-
|
13
|
-
<% if signed_in? && current_question.voted_by?(current_user) %>
|
14
|
-
$('#vote-result-callout').addClass('warning').removeClass('hide danger');
|
15
|
-
$('#vote-result-callout .callout-title').text($('#vote-result-callout').data('title-ok'));
|
16
|
-
$('#vote-result-callout .callout-message').text($('#vote-result-callout').data('message-ok'));
|
17
|
-
$('#confirm-vote-form-loader').addClass('hide');
|
18
|
-
$('#confirm-vote-form').removeClass('hide');
|
19
|
-
<% end %>
|
20
|
-
|
21
|
-
// Replicate the behaviour of vote_dialog.js as it has a bug when changed via ajax
|
22
|
-
var button = $("#vote_button"),
|
23
|
-
buttonChange = $("#question-vote-confirm-modal-button-change"),
|
24
|
-
responseButtons = $(".response-title"),
|
25
|
-
voteConfirmDialog = $("#question-vote-confirm-modal"),
|
26
|
-
voteDialog = $("#question-vote-modal");
|
27
|
-
|
28
|
-
if (voteDialog.length && button.length) {
|
29
|
-
button.click(function () {
|
30
|
-
voteDialog.foundation("open");
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
if (voteDialog.length && responseButtons.length && voteConfirmDialog.length) {
|
35
|
-
responseButtons.click(function () {
|
36
|
-
$("#question-vote-confirm-modal-question-title").text($(this).text());
|
37
|
-
$("#decidim_consultations_response_id").val($(this).data("response-id"));
|
38
|
-
|
39
|
-
voteDialog.foundation("close");
|
40
|
-
voteConfirmDialog.foundation("open");
|
41
|
-
});
|
42
|
-
}
|
43
|
-
|
44
|
-
if (buttonChange.length && voteDialog.length && voteConfirmDialog.length) {
|
45
|
-
buttonChange.click(function() {
|
46
|
-
voteConfirmDialog.foundation("close");
|
47
|
-
voteDialog.foundation("open");
|
48
|
-
});
|
49
|
-
}
|
50
|
-
|
51
|
-
//lets do the same for delegations
|
52
|
-
var delegationsButton = $("#delegations-button"),
|
53
|
-
delegationCallouts = $(".delegation-callout"),
|
54
|
-
delegationCalloutsMessage = $(".delegation-callout-message"),
|
55
|
-
delegationVoteButtons = $(".delegation-vote-button"),
|
56
|
-
delegationUnVoteButtons = $(".delegation_unvote_button"),
|
57
|
-
delegationField = $("#decidim_consultations_delegation_id"),
|
58
|
-
delegationDialog = $("#delegations-modal");
|
59
|
-
|
60
|
-
delegationDialog.foundation();
|
61
|
-
|
62
|
-
delegationsButton.click(function () {
|
63
|
-
delegationDialog.foundation("open");
|
64
|
-
});
|
65
|
-
|
66
|
-
delegationVoteButtons.click((evt) => {
|
67
|
-
delegationDialog.foundation("close");
|
68
|
-
voteDialog.foundation("open");
|
69
|
-
delegationField.val($(evt.currentTarget).data("delegation-id"));
|
70
|
-
delegationCalloutsMessage.text($(evt.currentTarget).data("delegation-granter-name"));
|
71
|
-
delegationCallouts.removeClass("is-hidden");
|
72
|
-
});
|
73
|
-
|
74
|
-
delegationUnVoteButtons.click((evt) => {
|
75
|
-
delegationDialog.foundation("close");
|
76
|
-
delegationCallouts.addClass("is-hidden");
|
77
|
-
});
|
78
|
-
|
79
|
-
button.click(() => {
|
80
|
-
delegationCallouts.addClass("is-hidden");
|
81
|
-
});
|
82
|
-
}());
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
namespace :action_delegator do
|
4
|
-
desc "Imports direct_verification existing authorizations into the participants table"
|
5
|
-
task import_direct_verifications: :environment do
|
6
|
-
Decidim::Organization.order(:id).find_each do |organization|
|
7
|
-
puts "Processing organization [#{organization.name}]"
|
8
|
-
settings = Decidim::ActionDelegator::OrganizationSettings.new(organization).query
|
9
|
-
authorizations = Decidim::Authorization.where(name: "direct_verifications", user: organization.users)
|
10
|
-
puts "Found #{authorizations.count} authorizations"
|
11
|
-
count = 0
|
12
|
-
authorizations.order(:id).each do |authorization|
|
13
|
-
weight = authorization.metadata["membership_weight"] || 1
|
14
|
-
type = authorization.metadata["membership_type"]
|
15
|
-
settings.find_each do |setting|
|
16
|
-
participant = setting.participants.find_or_initialize_by(email: authorization.user.email)
|
17
|
-
next unless participant.new_record?
|
18
|
-
|
19
|
-
participant.phone = authorization.metadata["membership_phone"]
|
20
|
-
participant.ponderation = setting.ponderations.find_or_initialize_by(weight: weight, name: (type.presence || "weight-#{weight}"))
|
21
|
-
if participant.save
|
22
|
-
puts "Imported authorization [#{authorization.id}] into participant [#{participant.email}] with ponderation [#{participant.ponderation.title}]"
|
23
|
-
count += 1
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
puts "Imported #{count} authorizations"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|