decidim-elections 0.22.0 → 0.23.3
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/decidim_elections_manifest.js +2 -0
- data/app/assets/javascripts/decidim/elections/vote.js.es6 +170 -0
- data/app/assets/stylesheets/decidim/elections/elections.scss +10 -0
- data/app/assets/stylesheets/decidim/elections/focus/_evote.scss +279 -0
- data/app/assets/stylesheets/decidim/elections/focus/_focus.scss +128 -0
- data/app/cells/decidim/elections/election_cell.rb +22 -0
- data/app/cells/decidim/elections/election_m/data.erb +19 -0
- data/app/cells/decidim/elections/election_m/footer.erb +5 -0
- data/app/cells/decidim/elections/election_m_cell.rb +103 -0
- data/app/cells/decidim/elections/voting_step_navigation/show.erb +29 -0
- data/app/cells/decidim/elections/voting_step_navigation_cell.rb +42 -0
- data/app/commands/decidim/elections/admin/create_election.rb +14 -3
- data/app/commands/decidim/elections/admin/create_question.rb +2 -1
- data/app/commands/decidim/elections/admin/destroy_election.rb +4 -0
- data/app/commands/decidim/elections/admin/import_proposals_to_elections.rb +87 -0
- data/app/commands/decidim/elections/admin/publish_election.rb +54 -0
- data/app/commands/decidim/elections/admin/unpublish_election.rb +43 -0
- data/app/commands/decidim/elections/admin/update_election.rb +15 -3
- data/app/commands/decidim/elections/admin/update_question.rb +2 -1
- data/app/controllers/concerns/decidim/elections/orderable.rb +36 -0
- data/app/controllers/decidim/elections/admin/answers_controller.rb +9 -1
- data/app/controllers/decidim/elections/admin/elections_controller.rb +26 -0
- data/app/controllers/decidim/elections/admin/proposals_imports_controller.rb +53 -0
- data/app/controllers/decidim/elections/elections_controller.rb +68 -0
- data/app/controllers/decidim/elections/votes_controller.rb +50 -0
- data/app/events/decidim/elections/election_published_event.rb +8 -0
- data/app/forms/decidim/elections/admin/answer_import_proposals_form.rb +41 -0
- data/app/forms/decidim/elections/admin/election_form.rb +15 -2
- data/app/forms/decidim/elections/admin/question_form.rb +1 -0
- data/app/helpers/decidim/elections/application_helper.rb +12 -0
- data/app/helpers/decidim/elections/election_cells_helper.rb +12 -0
- data/app/helpers/decidim/elections/votes_helper.rb +21 -0
- data/app/models/decidim/elections/answer.rb +5 -1
- data/app/models/decidim/elections/election.rb +69 -0
- data/app/models/decidim/elections/question.rb +9 -2
- data/app/permissions/decidim/elections/admin/permissions.rb +13 -3
- data/app/permissions/decidim/elections/permissions.rb +35 -0
- data/app/presenters/decidim/elections/admin_log/election_presenter.rb +41 -0
- data/app/presenters/decidim/elections/election_presenter.rb +28 -0
- data/app/queries/decidim/elections/filtered_elections.rb +37 -0
- data/app/services/decidim/elections/election_search.rb +35 -0
- data/app/types/decidim/elections/election_question_type.rb +2 -2
- data/app/types/decidim/elections/election_type.rb +2 -1
- data/app/types/decidim/elections/elections_type.rb +1 -1
- data/app/views/decidim/elections/admin/answers/index.html.erb +2 -1
- data/app/views/decidim/elections/admin/elections/_form.html.erb +2 -4
- data/app/views/decidim/elections/admin/elections/index.html.erb +23 -1
- data/app/views/decidim/elections/admin/proposals_imports/new.html.erb +24 -0
- data/app/views/decidim/elections/admin/questions/_form.html.erb +4 -0
- data/app/views/decidim/elections/admin/questions/index.html.erb +3 -1
- data/app/views/decidim/elections/elections/_count.html.erb +1 -0
- data/app/views/decidim/elections/elections/_election.html.erb +1 -0
- data/app/views/decidim/elections/elections/_elections.html.erb +24 -0
- data/app/views/decidim/elections/elections/_filters.html.erb +24 -0
- data/app/views/decidim/elections/elections/_filters_small_view.html.erb +18 -0
- data/app/views/decidim/elections/elections/index.html.erb +24 -0
- data/app/views/decidim/elections/elections/index.js.erb +10 -0
- data/app/views/decidim/elections/elections/show.html.erb +64 -0
- data/app/views/decidim/elections/votes/_election_votes_confirm.html.erb +53 -0
- data/app/views/decidim/elections/votes/_election_votes_confirm_footer.html.erb +24 -0
- data/app/views/decidim/elections/votes/_election_votes_confirmed.html.erb +26 -0
- data/app/views/decidim/elections/votes/_election_votes_encrypting.html.erb +20 -0
- data/app/views/decidim/elections/votes/_election_votes_header.html.erb +8 -0
- data/app/views/decidim/elections/votes/_election_votes_modal.html.erb +46 -0
- data/app/views/decidim/elections/votes/_election_votes_question.html.erb +49 -0
- data/app/views/decidim/elections/votes/_election_votes_steps_header.html.erb +12 -0
- data/app/views/decidim/elections/votes/new.html.erb +44 -0
- data/app/views/layouts/decidim/_election_votes_header.html.erb +13 -0
- data/app/views/layouts/decidim/election_votes.html.erb +24 -0
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/bg.yml +7 -0
- data/config/locales/ca.yml +136 -6
- data/config/locales/cs.yml +133 -1
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +134 -4
- data/config/locales/el.yml +11 -1
- data/config/locales/en.yml +131 -1
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +131 -1
- data/config/locales/es-PY.yml +131 -1
- data/config/locales/es.yml +134 -4
- data/config/locales/et.yml +1 -0
- data/config/locales/fi-plain.yml +131 -1
- data/config/locales/fi.yml +131 -1
- data/config/locales/fr-CA.yml +131 -1
- data/config/locales/fr.yml +131 -1
- data/config/locales/gl.yml +111 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +18 -0
- data/config/locales/is.yml +1 -0
- data/config/locales/it.yml +98 -1
- data/config/locales/ja-JP.yml +95 -8
- data/config/locales/ja.yml +254 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/{lv-LV.yml → lv.yml} +11 -1
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +92 -1
- data/config/locales/no.yml +63 -0
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +126 -1
- data/config/locales/pt.yml +84 -1
- data/config/locales/ro-RO.yml +85 -1
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sv.yml +122 -2
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +261 -0
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +254 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200601141412_add_published_at_to_elections.rb +7 -0
- data/db/migrate/20200807125040_remove_subtitle_from_decidim_elections.rb +7 -0
- data/db/migrate/20200910103648_add_min_selections_to_decidim_elections_questions.rb +7 -0
- data/lib/decidim/elections.rb +5 -0
- data/lib/decidim/elections/admin_engine.rb +7 -0
- data/lib/decidim/elections/bulletin_board_client.rb +35 -0
- data/lib/decidim/elections/component.rb +17 -12
- data/lib/decidim/elections/engine.rb +8 -1
- data/lib/decidim/elections/test/factories.rb +59 -6
- data/lib/decidim/elections/version.rb +1 -1
- data/lib/tasks/decidim_elections.rake +16 -0
- metadata +84 -16
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Elections
|
5
|
+
# This class handles search and filtering of elections.
|
6
|
+
class ElectionSearch < ResourceSearch
|
7
|
+
# Public: Initializes the service.
|
8
|
+
# component - A Decidim::Component to get the election from.
|
9
|
+
# page - The page number to paginate the results.
|
10
|
+
# per_page - The number of proposals to return per page.
|
11
|
+
def initialize(options = {})
|
12
|
+
super(Election.all, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Handle the search_text filter
|
16
|
+
def search_search_text
|
17
|
+
query
|
18
|
+
.where("decidim_elections_elections.title::text ILIKE ?", "%#{search_text}%")
|
19
|
+
.or(query.where("decidim_elections_elections.description::text ILIKE ?", "%#{search_text}%"))
|
20
|
+
end
|
21
|
+
|
22
|
+
# Handle the state filter
|
23
|
+
def search_state
|
24
|
+
active = state.member?("active") ? query.active : nil
|
25
|
+
upcoming = state.member?("upcoming") ? query.upcoming : nil
|
26
|
+
finished = state.member?("finished") ? query.finished : nil
|
27
|
+
|
28
|
+
query
|
29
|
+
.where(id: upcoming)
|
30
|
+
.or(query.where(id: active))
|
31
|
+
.or(query.where(id: finished))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -15,10 +15,10 @@ module Decidim
|
|
15
15
|
field :id, !types.ID, "The internal ID of this question"
|
16
16
|
field :title, !Decidim::Core::TranslatedFieldType, "The title for this question"
|
17
17
|
field :description, !Decidim::Core::TranslatedFieldType, "The description for this question"
|
18
|
-
field :maxSelections, !types.Int, "The maximum number of
|
18
|
+
field :maxSelections, !types.Int, "The maximum number of possible selections for this question", property: :max_selections
|
19
19
|
field :weight, types.Int, "The ordering weight for this question"
|
20
20
|
field :randomAnswersOrder, types.Boolean, "Should this question order answers in random order?", property: :random_answers_order
|
21
|
-
|
21
|
+
field :minSelections, !types.Int, "The minimum number of possible selections for this question", property: :min_selections
|
22
22
|
field :answers, !types[Decidim::Elections::ElectionAnswerType], "The answers for this question"
|
23
23
|
end
|
24
24
|
end
|
@@ -5,6 +5,7 @@ module Decidim
|
|
5
5
|
# This type represents an Election.
|
6
6
|
ElectionType = GraphQL::ObjectType.define do
|
7
7
|
interfaces [
|
8
|
+
-> { Decidim::Core::AttachableInterface },
|
8
9
|
-> { Decidim::Core::TraceableInterface }
|
9
10
|
]
|
10
11
|
|
@@ -13,12 +14,12 @@ module Decidim
|
|
13
14
|
|
14
15
|
field :id, !types.ID, "The internal ID of this election"
|
15
16
|
field :title, !Decidim::Core::TranslatedFieldType, "The title for this election"
|
16
|
-
field :subtitle, !Decidim::Core::TranslatedFieldType, "The subtitle for this election"
|
17
17
|
field :description, !Decidim::Core::TranslatedFieldType, "The description for this election"
|
18
18
|
field :startTime, !Decidim::Core::DateTimeType, "The start time for this election", property: :start_time
|
19
19
|
field :endTime, !Decidim::Core::DateTimeType, "The end time for this election", property: :end_time
|
20
20
|
field :createdAt, Decidim::Core::DateTimeType, "When this election was created", property: :created_at
|
21
21
|
field :updatedAt, Decidim::Core::DateTimeType, "When this election was updated", property: :updated_at
|
22
|
+
field :publishedAt, Decidim::Core::DateTimeType, "When this election was published", property: :published_at
|
22
23
|
|
23
24
|
field :questions, !types[Decidim::Elections::ElectionQuestionType], "The questions for this election"
|
24
25
|
end
|
@@ -6,6 +6,7 @@
|
|
6
6
|
<%= t(".title") %>
|
7
7
|
|
8
8
|
<%= link_to t("actions.new", scope: "decidim.elections", name: t("models.answer.name", scope: "decidim.elections.admin")), new_election_question_answer_path(election, question), class: "button tiny button--title" if allowed_to? :create, :answer, election: election, question: question %>
|
9
|
+
<%= link_to t("actions.import", scope: "decidim.elections", name: t("models.answer.name", scope: "decidim.elections.admin")), new_election_question_proposals_import_path(election, question), class: "button tiny button--title" if allowed_to? :import_proposals, :answer, election: election, question: question %>
|
9
10
|
</h2>
|
10
11
|
</div>
|
11
12
|
|
@@ -23,7 +24,7 @@
|
|
23
24
|
<% answers.each do |answer| %>
|
24
25
|
<tr data-id="<%= question.id %>">
|
25
26
|
<td>
|
26
|
-
<%=
|
27
|
+
<%= translated_attribute(answer.title) %>
|
27
28
|
</td>
|
28
29
|
<td>
|
29
30
|
<%= answer.linked_resources(:proposals, "related_proposals").count %>
|
@@ -8,10 +8,6 @@
|
|
8
8
|
<%= form.translated :text_field, :title, autofocus: true %>
|
9
9
|
</div>
|
10
10
|
|
11
|
-
<div class="row column">
|
12
|
-
<%= form.translated :text_field, :subtitle %>
|
13
|
-
</div>
|
14
|
-
|
15
11
|
<div class="row column">
|
16
12
|
<%= form.translated :editor, :description %>
|
17
13
|
</div>
|
@@ -24,5 +20,7 @@
|
|
24
20
|
<%= form.datetime_field :end_time %>
|
25
21
|
</div>
|
26
22
|
</div>
|
23
|
+
|
24
|
+
<%= render partial: "decidim/admin/shared/gallery", locals: { form: form } %>
|
27
25
|
</div>
|
28
26
|
</div>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<% elections.each do |election| %>
|
23
23
|
<tr data-id="<%= election.id %>">
|
24
24
|
<td>
|
25
|
-
<%= link_to translated_attribute(election.title),
|
25
|
+
<%= link_to translated_attribute(election.title), resource_locator(election).path %>
|
26
26
|
</td>
|
27
27
|
<td>
|
28
28
|
<% if election.start_time %>
|
@@ -37,12 +37,34 @@
|
|
37
37
|
<td class="table-list__actions">
|
38
38
|
<%= icon_link_to "eye", resource_locator(election).path, t("actions.preview", scope: "decidim.elections"), class: "action-icon--preview", target: :blank %>
|
39
39
|
|
40
|
+
<%= icon_link_to "list", election_questions_path(election), t("actions.edit_questions", scope: "decidim.elections"), class: "action-icon--edit-questions" %>
|
41
|
+
|
40
42
|
<% if allowed_to? :update, :election, election: election %>
|
41
43
|
<%= icon_link_to "pencil", edit_election_path(election), t("actions.edit", scope: "decidim.elections"), class: "action-icon--edit" %>
|
44
|
+
<% else %>
|
45
|
+
<%= icon "pencil", class: "action-icon action-icon--disabled", role: "img" %>
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
<% if election.published? %>
|
49
|
+
<% if allowed_to?(:unpublish, :election, election: election) %>
|
50
|
+
<%= icon_link_to "x", url_for(action: :unpublish, id: election, controller: "elections"), t("actions.unpublish", scope: "decidim.elections"), class: "action-icon--unpublish", method: :put %>
|
51
|
+
<% else %>
|
52
|
+
<%= icon "x", class: "action-icon action-icon--disabled", role: "img" %>
|
53
|
+
<% end %>
|
54
|
+
<% else %>
|
55
|
+
<% if allowed_to?(:publish, :election, election: election) %>
|
56
|
+
<%= icon_link_to "check", url_for(action: :publish, id: election, controller: "elections"), t("actions.publish", scope: "decidim.elections"), class: "action-icon--publish", method: :put %>
|
57
|
+
<% else %>
|
58
|
+
<%= icon "check", class: "action-icon action-icon--disabled", role: "img" %>
|
59
|
+
<% end %>
|
42
60
|
<% end %>
|
43
61
|
|
62
|
+
<%= resource_permissions_link(election) %>
|
63
|
+
|
44
64
|
<% if allowed_to? :delete, :election, election: election %>
|
45
65
|
<%= icon_link_to "circle-x", election_path(election), t("actions.destroy", scope: "decidim.elections"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.elections") } %>
|
66
|
+
<% else %>
|
67
|
+
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
|
46
68
|
<% end %>
|
47
69
|
</td>
|
48
70
|
</tr>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= decidim_form_for(@form, url: election_question_proposals_import_path, html: { class: "form import_proposals" }) do |f| %>
|
2
|
+
<% if @form.origin_components.any? %>
|
3
|
+
<div class="card">
|
4
|
+
<div class="card-divider">
|
5
|
+
<h2 class="card-title"><%= title %></h2>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="card-section">
|
9
|
+
<div class="row column">
|
10
|
+
<%= f.select :origin_component_id, @form.origin_components_collection, prompt: t(".select_component") %>
|
11
|
+
</div>
|
12
|
+
<div class="row column">
|
13
|
+
<%= f.check_box :import_all_accepted_proposals %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="button--double form-general-submit">
|
19
|
+
<%= f.submit t(".create") %>
|
20
|
+
</div>
|
21
|
+
<% else %>
|
22
|
+
<p><%= t(".no_components") %></p>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<% questions.each do |question| %>
|
24
24
|
<tr data-id="<%= question.id %>">
|
25
25
|
<td>
|
26
|
-
<%=
|
26
|
+
<%= translated_attribute(question.title) %>
|
27
27
|
</td>
|
28
28
|
<td>
|
29
29
|
<%= question.answers.count %>
|
@@ -36,6 +36,8 @@
|
|
36
36
|
<% end %>
|
37
37
|
</td>
|
38
38
|
<td class="table-list__actions">
|
39
|
+
<%= icon_link_to "list", election_question_answers_path(election, question), t("actions.edit_answers", scope: "decidim.elections"), class: "action-icon--edit-answers" %>
|
40
|
+
|
39
41
|
<% if allowed_to? :update, :question, election: election, question: question %>
|
40
42
|
<%= icon_link_to "pencil", edit_election_question_path(election, question), t("actions.edit", scope: "decidim.elections"), class: "action-icon--edit" %>
|
41
43
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= t(".elections_count", count: paginated_elections.total_count) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= card_for election, from: election %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<% if elections.none? %>
|
2
|
+
<div class="callout warning">
|
3
|
+
<%= t("decidim.elections.warnings.no_elections_warning") %>
|
4
|
+
</div>
|
5
|
+
<% elsif scheduled_elections.none? %>
|
6
|
+
<div class="callout warning">
|
7
|
+
<%= t("decidim.elections.warnings.no_scheduled_elections_warning") %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<div class="collection-sort-controls row small-up-1 medium-up-3 card-grid">
|
12
|
+
<div class="column">
|
13
|
+
<%= order_selector available_orders, i18n_scope: "decidim.elections.orders" %>
|
14
|
+
</div>
|
15
|
+
<div class="column">
|
16
|
+
<%= render partial: "decidim/shared/results_per_page" %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="row small-up-1 medium-up-2 card-grid">
|
21
|
+
<%= render paginated_elections %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<%= decidim_paginate paginated_elections %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= render partial: "decidim/shared/filter_form_help", locals: { skip_to_id: "elections" } %>
|
2
|
+
|
3
|
+
<%= filter_form_for filter do |form| %>
|
4
|
+
<div class="filters__section">
|
5
|
+
<div class="filters__search">
|
6
|
+
<div class="input-group">
|
7
|
+
<%= form.search_field :search_text,
|
8
|
+
label: false,
|
9
|
+
class: "input-group-field",
|
10
|
+
placeholder: t(".search"),
|
11
|
+
title: t(".search"),
|
12
|
+
data: { disable_dynamic_change: true } %>
|
13
|
+
<div class="input-group-button">
|
14
|
+
<button type="submit" class="button" aria-controls="elections">
|
15
|
+
<%= icon "magnifying-glass", aria_label: t(".search"), role: "img" %>
|
16
|
+
</button>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<%= form.check_boxes_tree :state, state_filter_values, legend_title: t(".state") %>
|
23
|
+
<%= hidden_field_tag :order, order, id: nil, class: "order_filter" %>
|
24
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<div class="filters-controls hide-for-mediumlarge">
|
2
|
+
<button data-open="filter-box" class="filters-controls__trigger">
|
3
|
+
<%= t ".filter" %>
|
4
|
+
<%= icon "caret-bottom", class: "icon--small float-right", aria_label: t(".unfold"), role: "img" %>
|
5
|
+
</button>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="reveal" id="filter-box" data-reveal>
|
9
|
+
<div class="reveal__header">
|
10
|
+
<h3 class="reveal__title"><%= t ".filter_by" %>:</h3>
|
11
|
+
<button class="close-button" data-close aria-label="<%= t(".close_modal") %>" type="button">
|
12
|
+
<span aria-hidden="true">×</span>
|
13
|
+
</button>
|
14
|
+
</div>
|
15
|
+
<div class="filters">
|
16
|
+
<%= render partial: "filters" %>
|
17
|
+
</div>
|
18
|
+
</div>
|
@@ -1 +1,25 @@
|
|
1
1
|
<%= render partial: "decidim/shared/component_announcement" %>
|
2
|
+
|
3
|
+
<section class="section row">
|
4
|
+
<div class="columns">
|
5
|
+
<div class="row">
|
6
|
+
<h2 id="elections-count" class="order-by__text section-heading">
|
7
|
+
<%= render partial: "count" %>
|
8
|
+
</h2>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="row">
|
12
|
+
<div class="columns mediumlarge-4 large-3">
|
13
|
+
<%= render partial: "filters_small_view" %>
|
14
|
+
<div class="card card--secondary show-for-mediumlarge">
|
15
|
+
<%= render partial: "filters" %>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<div id="elections" class="columns mediumlarge-8 large-9" aria-live="polite">
|
19
|
+
<%= render partial: "elections" %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</section>
|
24
|
+
|
25
|
+
<%= javascript_include_tag("decidim/filters") %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
var $elections = $('#elections');
|
2
|
+
var $electionsCount = $('#elections-count');
|
3
|
+
var $orderFilterInput = $('.order_filter');
|
4
|
+
|
5
|
+
$elections.html('<%= j(render partial: "elections").strip.html_safe %>');
|
6
|
+
$electionsCount.html('<%= j(render partial: "count").strip.html_safe %>');
|
7
|
+
$orderFilterInput.val('<%= order %>');
|
8
|
+
|
9
|
+
var $dropdownMenu = $('.dropdown.menu', $elections);
|
10
|
+
$dropdownMenu.foundation();
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<% add_decidim_meta_tags(
|
2
|
+
title: translated_attribute(election.title),
|
3
|
+
description: translated_attribute(election.description)
|
4
|
+
) %>
|
5
|
+
|
6
|
+
<%
|
7
|
+
edit_link(
|
8
|
+
resource_locator(election).edit,
|
9
|
+
:update,
|
10
|
+
:election,
|
11
|
+
election: election
|
12
|
+
)
|
13
|
+
%>
|
14
|
+
|
15
|
+
<%= render partial: "decidim/shared/component_announcement" %>
|
16
|
+
|
17
|
+
<div class="row">
|
18
|
+
<div class="columns">
|
19
|
+
|
20
|
+
<% unless single? %>
|
21
|
+
<div class="m-bottom">
|
22
|
+
<%= link_to :elections, class: "small hollow" do %>
|
23
|
+
<%= icon "caret-left", class: "icon--small" %>
|
24
|
+
<%= t(".back") %>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<h1 class="heading2">
|
30
|
+
<%== present(election).title %>
|
31
|
+
</h1>
|
32
|
+
<p>
|
33
|
+
<%= t(".voting_period_status.#{election.voting_period_status}",
|
34
|
+
start_time: "<strong>#{l election.start_time, format: :long}</strong>",
|
35
|
+
end_time: "<strong>#{l election.end_time, format: :long}</strong>").html_safe %>
|
36
|
+
</p>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
<div class="row section">
|
40
|
+
<% if election.attachments.first.present? && election.attachments.first.file.content_type.start_with?("image") %>
|
41
|
+
<div class="columns medium-4 mediumlarge-5">
|
42
|
+
<img src="<%= election.attachments.first.url %>" alt="">
|
43
|
+
</div>
|
44
|
+
<% end %>
|
45
|
+
<div class="columns medium-8 mediumlarge-7">
|
46
|
+
<div class="section">
|
47
|
+
<%= decidim_sanitize(simple_format(translated_attribute(election.description))) %>
|
48
|
+
|
49
|
+
<% if election.published? && election.ongoing? %>
|
50
|
+
<%= action_authorized_link_to :vote, new_election_vote_path(election.id), resource: election, class: "title-action__action button small" do %>
|
51
|
+
<%= t(".vote") %>
|
52
|
+
<% end %>
|
53
|
+
<% else %>
|
54
|
+
<span class="title-action__action button small disabled"><%= t(".vote") %></span>
|
55
|
+
<% end %>
|
56
|
+
|
57
|
+
<% if allowed_to? :preview, :election, election: election %>
|
58
|
+
<%= link_to new_election_vote_path(election.id), class: "title-action__action button small" do %>
|
59
|
+
<%= t(".preview") %>
|
60
|
+
<% end %>
|
61
|
+
<% end %>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
</div>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<%= render("election_votes_header", header_title: t("decidim.elections.votes.header.confirm")) %>
|
2
|
+
|
3
|
+
<div class="focus__content evote">
|
4
|
+
<div class="row">
|
5
|
+
<h1 class="heading2">
|
6
|
+
<%= t("decidim.elections.votes.confirm.header") %>
|
7
|
+
</h1>
|
8
|
+
<p>
|
9
|
+
<%= t("decidim.elections.votes.confirm.intro").html_safe %>
|
10
|
+
</p>
|
11
|
+
|
12
|
+
<dl class="evote__confirm">
|
13
|
+
<dt>
|
14
|
+
<% questions.each_with_index do |question, question_index| %>
|
15
|
+
<strong class="evote__confirm-label">
|
16
|
+
<%= t("decidim.elections.votes.confirm.question", count: question_index + 1) %>:
|
17
|
+
</strong>
|
18
|
+
<strong>
|
19
|
+
<%= translated_attribute(question.title) %>
|
20
|
+
</strong>
|
21
|
+
<dd id="edit-step-<%= question_index+1 %>">
|
22
|
+
<strong class="evote__confirm-label">
|
23
|
+
<%= t("decidim.elections.votes.confirm.answer") %>
|
24
|
+
(<%= link_to(
|
25
|
+
"#{t("decidim.elections.votes.confirm.edit")}<span class='show-for-sr'>
|
26
|
+
#{t("decidim.elections.votes.confirm.answer_number", number: question_index + 1)}</span>".html_safe,
|
27
|
+
"#",
|
28
|
+
class: "evote__edit-answer",
|
29
|
+
data: {
|
30
|
+
toggle: ["step-#{question_index}", "step-#{questions_count}"].join(" ")
|
31
|
+
}
|
32
|
+
) %>):
|
33
|
+
</strong>
|
34
|
+
<ul>
|
35
|
+
<% question.answers.each do |answer| %>
|
36
|
+
<li class="confirmed_answer hide" id="<%= answer.id %>">
|
37
|
+
<%= translated_attribute(answer.title) %>
|
38
|
+
</li>
|
39
|
+
<% end %>
|
40
|
+
<% if question.min_selections == 0 %>
|
41
|
+
<li class="<%= "hide nota_input_#{question.id}" %>">
|
42
|
+
<%= t("decidim.elections.votes.confirm.nota_option") %>
|
43
|
+
</li>
|
44
|
+
<% end %>
|
45
|
+
</ul>
|
46
|
+
</dd>
|
47
|
+
<% end %>
|
48
|
+
</dt>
|
49
|
+
</dl>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<%= render("election_votes_confirm_footer") %>
|