decidim-consultations 0.19.1 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/consultations/icon.svg +1 -3
  3. data/app/assets/images/decidim/consultations/icon2.svg +1 -88
  4. data/app/assets/javascripts/decidim/consultations/utils_multiple.js +1 -1
  5. data/app/assets/stylesheets/decidim/consultations/_question.scss +0 -6
  6. data/app/assets/stylesheets/decidim/consultations/_question_multiple_votes.scss +22 -0
  7. data/app/assets/stylesheets/decidim/consultations/consultations.scss +1 -0
  8. data/app/assets/stylesheets/decidim/consultations/consultations/_consultations-header.scss +0 -1
  9. data/app/cells/decidim/consultations/consultation_m/data.erb +1 -1
  10. data/app/cells/decidim/consultations/consultation_m/footer.erb +1 -1
  11. data/app/cells/decidim/consultations/content_blocks/highlighted_consultations/show.erb +3 -3
  12. data/app/commands/decidim/consultations/admin/create_response.rb +2 -1
  13. data/app/commands/decidim/consultations/admin/create_response_group.rb +40 -0
  14. data/app/commands/decidim/consultations/admin/destroy_response_group.rb +39 -0
  15. data/app/commands/decidim/consultations/admin/update_consultation.rb +9 -4
  16. data/app/commands/decidim/consultations/admin/update_response.rb +3 -2
  17. data/app/commands/decidim/consultations/admin/update_response_group.rb +46 -0
  18. data/app/controllers/concerns/decidim/consultations/admin/filterable.rb +27 -0
  19. data/app/controllers/decidim/consultations/admin/consultations_controller.rb +2 -1
  20. data/app/controllers/decidim/consultations/admin/response_groups_controller.rb +88 -0
  21. data/app/controllers/decidim/consultations/admin/responses_controller.rb +1 -0
  22. data/app/forms/decidim/consultations/admin/consultation_form.rb +5 -6
  23. data/app/forms/decidim/consultations/admin/question_form.rb +5 -6
  24. data/app/forms/decidim/consultations/admin/response_form.rb +5 -0
  25. data/app/forms/decidim/consultations/admin/response_group_form.rb +18 -0
  26. data/app/helpers/decidim/consultations/admin/questions_helper.rb +11 -0
  27. data/app/models/decidim/consultation.rb +25 -0
  28. data/app/models/decidim/consultations/question.rb +34 -1
  29. data/app/models/decidim/consultations/response.rb +11 -0
  30. data/app/models/decidim/consultations/response_group.rb +23 -0
  31. data/app/permissions/decidim/consultations/admin/permissions.rb +16 -0
  32. data/app/permissions/decidim/consultations/permissions.rb +2 -0
  33. data/app/presenters/decidim/consultations/question_stats_presenter.rb +1 -1
  34. data/app/types/decidim/consultations/consultation_question_type.rb +57 -0
  35. data/app/types/decidim/consultations/consultation_type.rb +32 -0
  36. data/app/views/decidim/consultations/admin/consultations/index.html.erb +3 -2
  37. data/app/views/decidim/consultations/admin/response_groups/_form.html.erb +11 -0
  38. data/app/views/decidim/consultations/admin/response_groups/edit.html.erb +18 -0
  39. data/app/views/decidim/consultations/admin/response_groups/index.html.erb +56 -0
  40. data/app/views/decidim/consultations/admin/response_groups/new.html.erb +13 -0
  41. data/app/views/decidim/consultations/admin/responses/_form.html.erb +3 -0
  42. data/app/views/decidim/consultations/admin/responses/index.html.erb +12 -1
  43. data/app/views/decidim/consultations/consultations/_consultation_card.html.erb +3 -3
  44. data/app/views/decidim/consultations/consultations/_consultation_details.html.erb +2 -2
  45. data/app/views/decidim/consultations/consultations/_filters.html.erb +9 -4
  46. data/app/views/decidim/consultations/consultations/_question.html.erb +2 -2
  47. data/app/views/decidim/consultations/consultations/index.html.erb +3 -3
  48. data/app/views/decidim/consultations/question_multiple_votes/_form.html.erb +14 -10
  49. data/app/views/decidim/consultations/question_multiple_votes/show.html.erb +8 -2
  50. data/app/views/decidim/consultations/questions/_vote_button.html.erb +70 -67
  51. data/app/views/decidim/consultations/questions/_vote_modal.html.erb +1 -1
  52. data/app/views/decidim/consultations/questions/_vote_modal_confirm.html.erb +1 -1
  53. data/app/views/decidim/consultations/questions/show.html.erb +4 -4
  54. data/app/views/layouts/decidim/_question_components.html.erb +3 -3
  55. data/app/views/layouts/decidim/_question_header.html.erb +1 -1
  56. data/app/views/layouts/decidim/admin/question.html.erb +1 -1
  57. data/app/views/layouts/decidim/consultation.html.erb +1 -0
  58. data/config/locales/am-ET.yml +1 -0
  59. data/config/locales/ar.yml +29 -1
  60. data/config/locales/bg-BG.yml +1 -0
  61. data/config/locales/bg.yml +1 -0
  62. data/config/locales/ca.yml +29 -1
  63. data/config/locales/cs.yml +37 -9
  64. data/config/locales/da-DK.yml +1 -0
  65. data/config/locales/da.yml +1 -0
  66. data/config/locales/de.yml +82 -1
  67. data/config/locales/el-GR.yml +1 -0
  68. data/config/locales/el.yml +377 -0
  69. data/config/locales/en.yml +29 -1
  70. data/config/locales/eo.yml +1 -0
  71. data/config/locales/es-MX.yml +29 -1
  72. data/config/locales/es-PY.yml +29 -1
  73. data/config/locales/es.yml +29 -1
  74. data/config/locales/et-EE.yml +1 -0
  75. data/config/locales/et.yml +1 -0
  76. data/config/locales/eu.yml +0 -1
  77. data/config/locales/fi-plain.yml +29 -1
  78. data/config/locales/fi.yml +38 -10
  79. data/config/locales/fr-CA.yml +377 -0
  80. data/config/locales/fr.yml +30 -2
  81. data/config/locales/ga-IE.yml +1 -0
  82. data/config/locales/gl.yml +0 -1
  83. data/config/locales/hr-HR.yml +1 -0
  84. data/config/locales/hr.yml +1 -0
  85. data/config/locales/hu.yml +25 -1
  86. data/config/locales/id-ID.yml +0 -1
  87. data/config/locales/is-IS.yml +185 -0
  88. data/config/locales/is.yml +185 -0
  89. data/config/locales/it.yml +82 -54
  90. data/config/locales/ja-JP.yml +367 -0
  91. data/config/locales/ja.yml +367 -0
  92. data/config/locales/ko-KR.yml +1 -0
  93. data/config/locales/ko.yml +1 -0
  94. data/config/locales/lt-LT.yml +1 -0
  95. data/config/locales/lt.yml +1 -0
  96. data/config/locales/lv.yml +383 -0
  97. data/config/locales/mt-MT.yml +1 -0
  98. data/config/locales/mt.yml +1 -0
  99. data/config/locales/nl.yml +29 -1
  100. data/config/locales/no.yml +312 -1
  101. data/config/locales/om-ET.yml +1 -0
  102. data/config/locales/pl.yml +183 -102
  103. data/config/locales/pt-BR.yml +1 -2
  104. data/config/locales/pt.yml +156 -75
  105. data/config/locales/ro-RO.yml +338 -0
  106. data/config/locales/ru.yml +0 -1
  107. data/config/locales/sk-SK.yml +394 -0
  108. data/config/locales/sk.yml +393 -0
  109. data/config/locales/sl.yml +9 -0
  110. data/config/locales/so-SO.yml +1 -0
  111. data/config/locales/sr-CS.yml +1 -0
  112. data/config/locales/sv.yml +60 -11
  113. data/config/locales/ti-ER.yml +1 -0
  114. data/config/locales/tr-TR.yml +0 -1
  115. data/config/locales/uk.yml +0 -1
  116. data/config/locales/vi-VN.yml +1 -0
  117. data/config/locales/vi.yml +1 -0
  118. data/config/locales/zh-CN.yml +367 -0
  119. data/config/locales/zh-TW.yml +1 -0
  120. data/db/migrate/20190708114204_create_decidim_consultations_response_groups.rb +16 -0
  121. data/db/migrate/20190708120345_add_response_groups_count_to_decidim_consultations_questions.rb +7 -0
  122. data/db/migrate/20190708121643_add_response_groups_to_decidim_consultations_responses.rb +10 -0
  123. data/db/migrate/20200320105916_index_foreign_keys_in_decidim_consultations_votes.rb +7 -0
  124. data/db/migrate/20200827154143_add_commentable_counter_cache_to_consultations.rb +9 -0
  125. data/db/seeds/city.jpeg +0 -0
  126. data/db/seeds/city2.jpeg +0 -0
  127. data/lib/decidim/consultations/admin_engine.rb +2 -0
  128. data/lib/decidim/consultations/participatory_space.rb +23 -17
  129. data/lib/decidim/consultations/test/factories.rb +6 -0
  130. data/lib/decidim/consultations/version.rb +1 -1
  131. metadata +67 -11
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Consultations
5
+ # This type represents a consultation.
6
+ ConsultationType = GraphQL::ObjectType.define do
7
+ interfaces [
8
+ -> { Decidim::Core::ParticipatorySpaceInterface }
9
+ ]
10
+
11
+ name "Consultation"
12
+ description "A consultation"
13
+
14
+ field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this consultation"
15
+ field :description, Decidim::Core::TranslatedFieldType, "The description of this consultation"
16
+ field :slug, !types.String, "Slug of this consultation"
17
+ field :createdAt, !Decidim::Core::DateTimeType, "The time this consultation was created", property: :created_at
18
+ field :updatedAt, !Decidim::Core::DateTimeType, "The time this consultation was updated", property: :updated_at
19
+ field :publishedAt, !Decidim::Core::DateTimeType, "The time this consultation was published", property: :published_at
20
+
21
+ field :introductoryVideoUrl, types.String, "The introductory video url for this consultation", property: :introductory_video_url
22
+ field :introductoryImage, types.String, "The introductory image for this consultation", property: :introductory_image
23
+ field :bannerImage, types.String, "The banner image for this consultation", property: :banner_image
24
+ field :highlightedScope, Decidim::Core::ScopeApiType, "This is the highlighted scope of this consultation", property: :highlighted_scope
25
+ field :startVotingDate, Decidim::Core::DateType, "Start date of the voting for this consultation", property: :start_voting_date
26
+ field :endVotingDate, Decidim::Core::DateType, "End date of the voting for this consultation", property: :end_voting_date
27
+ field :resultsPublishedAt, Decidim::Core::DateType, "Date when the results have been published", property: :results_published_at
28
+
29
+ field :questions, types[Decidim::Consultations::ConsultationQuestionType], ""
30
+ end
31
+ end
32
+ end
@@ -1,4 +1,4 @@
1
- <div class="card" id="consultations">
1
+ <div class="card with-overflow" id="consultations">
2
2
  <div class="card-divider">
3
3
  <h2 class="card-title">
4
4
  <%= t "decidim.admin.titles.consultations" %>
@@ -6,13 +6,14 @@
6
6
  ["new", "consultation"], class: "button tiny button--title" if allowed_to? :create, :consultation %>
7
7
  </h2>
8
8
  </div>
9
+ <%= admin_filter_selector %>
9
10
  <div class="card-section">
10
11
  <div class="table-scroll">
11
12
  <table class="table-list">
12
13
  <thead>
13
14
  <tr>
14
15
  <th><%= t("models.consultation.fields.title", scope: "decidim.admin") %></th>
15
- <th><%= t("models.consultation.fields.created_at", scope: "decidim.admin") %></th>
16
+ <th><%= sort_link(query, :created_at, t("models.consultation.fields.created_at", scope: "decidim.admin"), default_order: :desc) %></th>
16
17
  <th class="table-list__actions">
17
18
  <%= t("models.consultation.fields.published", scope: "decidim.admin") %>
18
19
  </th>
@@ -0,0 +1,11 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title"><%= t "response_groups.form.title", scope: "decidim.admin" %></h2>
4
+ </div>
5
+
6
+ <div class="card-section">
7
+ <div class="row column">
8
+ <%= form.translated :text_field, :title, autofocus: true %>
9
+ </div>
10
+ </div>
11
+ </div>
@@ -0,0 +1,18 @@
1
+ <%= decidim_form_for @form,
2
+ url: response_group_path(current_question, current_response_group),
3
+ html: { class: "form edit_response_group" } do |f| %>
4
+ <%= render partial: "form", object: f %>
5
+ <div class="button--double form-general-submit">
6
+ <%= f.submit t("response_groups.edit.update", scope: "decidim.admin"),
7
+ class: "button",
8
+ data: { disable_with: true } %>
9
+
10
+ <% if allowed_to? :destroy, :response_group, response_group: current_response_group %>
11
+ <%= link_to t("decidim.admin.actions.destroy"),
12
+ response_group_path(current_question, current_response_group),
13
+ method: :delete,
14
+ class: "alert button",
15
+ data: { confirm: t("decidim.admin.actions.confirm_destroy") } %>
16
+ <% end %>
17
+ </div>
18
+ <% end %>
@@ -0,0 +1,56 @@
1
+ <div class="card" id="questions">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t "decidim.admin.titles.response_groups" %>
5
+ <%= link_to t("actions.new_response_group", scope: "decidim.admin"),
6
+ new_response_group_path(current_question),
7
+ class: "button tiny button--title" if allowed_to? :create, :response_group, question: current_question %>
8
+ <%= link_to t("actions.back_to_responses", scope: "decidim.admin"),
9
+ responses_path(current_question),
10
+ class: "button tiny button--title" if allowed_to? :read, :response %>
11
+ </h2>
12
+ </div>
13
+ <div class="card-section">
14
+ <p>
15
+ <%= t "decidim.admin.response_groups.help" %>
16
+ </p>
17
+ </div>
18
+ <div class="card-section">
19
+ <div class="table-scroll">
20
+ <table class="table-list">
21
+ <thead>
22
+ <tr>
23
+ <th><%= t("models.response.fields.title", scope: "decidim.admin") %></th>
24
+ <th><%= t("models.response.fields.created_at", scope: "decidim.admin") %></th>
25
+ <th></th>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ <% current_question.response_groups.each do |group| %>
30
+ <tr>
31
+ <td>
32
+ <% if allowed_to? :update, :response_group, response_group: group %>
33
+ <%= link_to translated_attribute(group.title),
34
+ edit_response_group_path(current_question, group) %>
35
+ <% else %>
36
+ <%= translated_attribute(group.title) %>
37
+ <% end %>
38
+ </td>
39
+ <td>
40
+ <%= l group.created_at, format: :short %>
41
+ </td>
42
+ <td class="table-list__actions">
43
+ <% if allowed_to? :update, :response_group, response_group: group %>
44
+ <%= icon_link_to "pencil",
45
+ edit_response_group_path(current_question, group),
46
+ t("actions.configure", scope: "decidim.admin"),
47
+ class: "action-icon--edit" %>
48
+ <% end %>
49
+ </td>
50
+ </tr>
51
+ <% end %>
52
+ </tbody>
53
+ </table>
54
+ </div>
55
+ </div>
56
+ </div>
@@ -0,0 +1,13 @@
1
+ <h2 class="questions-title-summary">
2
+ <%= t "response_groups.new.title", scope: "decidim.admin" %>
3
+ </h2>
4
+
5
+ <%= decidim_form_for @form,
6
+ url: response_groups_path(current_question),
7
+ html: { class: "form new_response_group" } do |f| %>
8
+ <%= render partial: "form", object: f %>
9
+
10
+ <div class="button--double form-general-submit">
11
+ <%= f.submit t("response_groups.new.create", scope: "decidim.admin"), data: { disable_with: true } %>
12
+ </div>
13
+ <% end %>
@@ -6,6 +6,9 @@
6
6
  <div class="card-section">
7
7
  <div class="row column">
8
8
  <%= form.translated :text_field, :title, autofocus: true %>
9
+ <% if allowed_to? :create, :response_group, question: current_question %>
10
+ <%= form.collection_select :decidim_consultations_response_group_id, question_response_groups, :id, :title %>
11
+ <% end %>
9
12
  </div>
10
13
  </div>
11
14
  </div>
@@ -5,6 +5,9 @@
5
5
  <%= link_to t("actions.new_response", scope: "decidim.admin"),
6
6
  new_response_path(current_question),
7
7
  class: "button tiny button--title" if allowed_to? :create, :response %>
8
+ <%= link_to t("actions.response_groups", scope: "decidim.admin"),
9
+ response_groups_path(current_question),
10
+ class: "button tiny button--title" if allowed_to? :create, :response_group, question: current_question %>
8
11
  </h2>
9
12
  </div>
10
13
  <div class="card-section">
@@ -13,12 +16,15 @@
13
16
  <thead>
14
17
  <tr>
15
18
  <th><%= t("models.response.fields.title", scope: "decidim.admin") %></th>
19
+ <% if allowed_to? :create, :response_group, question: current_question %>
20
+ <th><%= t("models.response.fields.response_group", scope: "decidim.admin") %></th>
21
+ <% end %>
16
22
  <th><%= t("models.response.fields.created_at", scope: "decidim.admin") %></th>
17
23
  <th></th>
18
24
  </tr>
19
25
  </thead>
20
26
  <tbody>
21
- <% current_question.responses.each do |response| %>
27
+ <% current_question.sorted_responses.each do |response| %>
22
28
  <tr>
23
29
  <td>
24
30
  <% if allowed_to? :update, :response, response: response %>
@@ -28,6 +34,11 @@
28
34
  <%= translated_attribute(response.title) %>
29
35
  <% end %>
30
36
  </td>
37
+ <% if allowed_to? :create, :response_group, question: current_question %>
38
+ <td>
39
+ <%= translated_attribute(response&.response_group&.title) %>
40
+ </td>
41
+ <% end %>
31
42
  <td>
32
43
  <%= l response.created_at, format: :short %>
33
44
  </td>
@@ -1,12 +1,12 @@
1
1
  <div class="column">
2
- <article class="card card--process">
2
+ <div class="card card--process">
3
3
  <%= link_to consultation_path(consultation), class: "card__link" do %>
4
4
  <div class="card__image-top"
5
5
  style="background-image:url(<%= consultation.banner_image.url %>)"></div>
6
6
  <% end %>
7
7
  <div class="card__content">
8
8
  <%= link_to consultation_path(consultation), class: "card__link" do %>
9
- <h4 class="card__title"><%= translated_attribute consultation.title %></h4>
9
+ <span class="card__title"><%= translated_attribute consultation.title %></span>
10
10
  <% end %>
11
11
  <p class="card__desc">
12
12
  <%= decidim_sanitize html_truncate(translated_attribute(consultation.subtitle), length: 630, separator: "...") %>
@@ -20,5 +20,5 @@
20
20
  <% end %>
21
21
  </div>
22
22
  </div>
23
- </article>
23
+ </div>
24
24
  </div>
@@ -1,6 +1,6 @@
1
1
  <div class="row section" id="consultation-details">
2
2
  <div class="columns medium-6 large-5 large-push-1">
3
- <p class="lead"><%= decidim_sanitize translated_attribute consultation.description %></p>
3
+ <p class="lead"><%= decidim_sanitize translated_attribute(consultation.description), strip_tags: true %></p>
4
4
  </div>
5
5
  <div class="columns medium-6 large-5 large-pull-1">
6
6
  <% if consultation.introductory_video_url.blank? %>
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  <% else %>
11
11
  <div class="embed-container">
12
- <iframe src="<%= consultation.introductory_video_url %>" frameborder=0 allowfullscreen>
12
+ <iframe src="<%= consultation.introductory_video_url %>" allowfullscreen>
13
13
  </iframe>
14
14
  </div>
15
15
  <% end %>
@@ -1,3 +1,5 @@
1
+ <%= render partial: "decidim/shared/filter_form_help", locals: { skip_to_id: "consultations" } %>
2
+
1
3
  <%= filter_form_for filter do |form| %>
2
4
  <div class="filters__section">
3
5
  <div class="filters__search">
@@ -5,10 +7,12 @@
5
7
  <%= form.search_field :search_text,
6
8
  label: false,
7
9
  class: "input-group-field",
8
- placeholder: t("consultations.filters.search", scope: "decidim") %>
10
+ placeholder: t("consultations.filters.search", scope: "decidim"),
11
+ title: t("consultations.filters.search", scope: "decidim"),
12
+ data: { disable_dynamic_change: true } %>
9
13
  <div class="input-group-button">
10
- <button type="submit" class="button button--muted">
11
- <%= icon "magnifying-glass", aria_label: t("consultations.filters.search", scope: "decidim") %>
14
+ <button type="submit" class="button" aria-controls="consultations">
15
+ <%= icon "magnifying-glass", aria_label: t("consultations.filters.search", scope: "decidim"), role: "img" %>
12
16
  </button>
13
17
  </div>
14
18
  </div>
@@ -19,7 +23,8 @@
19
23
  options_for_state_filter,
20
24
  :first,
21
25
  :last,
22
- legend_title: t("consultations.filters.state", scope: "decidim") %>
26
+ { legend_title: t("consultations.filters.state", scope: "decidim") },
27
+ "aria-controls": "consultations" %>
23
28
 
24
29
  <%= hidden_field_tag :order, order, id: nil, class: "order_filter" %>
25
30
  <% end %>
@@ -1,4 +1,4 @@
1
- <article class="card consultations-card">
1
+ <div class="card consultations-card">
2
2
  <div class="row collapse card--process__row">
3
3
  <div class="columns mediumlarge-8 large-9 card--process__column">
4
4
  <div class="card__content">
@@ -35,4 +35,4 @@
35
35
  </div>
36
36
  </div>
37
37
  </div>
38
- </article>
38
+ </div>
@@ -11,9 +11,9 @@ edit_link(
11
11
  <div class="row columns">
12
12
  <div class="title-action">
13
13
  <div class="row collapse">
14
- <h2 id="consultations-count" class="title-action__title section-heading">
14
+ <h1 id="consultations-count" class="title-action__title section-heading">
15
15
  <%= render partial: "count", locals: { count: consultations.count } %>
16
- </h2>
16
+ </h1>
17
17
  </div>
18
18
  </div>
19
19
  </div>
@@ -32,4 +32,4 @@ edit_link(
32
32
  <% end %>
33
33
 
34
34
  <%= javascript_include_tag "decidim/filters" %>
35
- <%= javascript_include_tag "decidim/orders" %>
35
+ <%= javascript_include_tag "decidim/results_listing" %>
@@ -1,14 +1,18 @@
1
- <div class="row column">
2
- <div class="large-offset-4 large-4 medium-offset-3 medium-6">
3
- <div class="card">
4
- <div class="card__content multiple_votes_form">
5
- <% question.responses.each do |response| %>
6
- <div>
7
- <%= check_box_tag "responses[]", response.id, false, id: "vote_id_#{response.id}" %>
8
- <%= form.label :id, translated_attribute(response.title), for: "vote_id_#{response.id}" %>
9
- </div>
10
- <% end %>
1
+ <div class="card">
2
+ <% if group %>
3
+ <div class="card__top">
4
+ <div class="card__content">
5
+ <h5 class="card__title"><%= translated_attribute group.title %></h5>
11
6
  </div>
12
7
  </div>
8
+ <% end %>
9
+
10
+ <div class="card__content multiple_votes_form">
11
+ <% responses.each do |response| %>
12
+ <div>
13
+ <%= check_box_tag "responses[]", response.id, false, id: "vote_id_#{response.id}" %>
14
+ <%= form.label :id, translated_attribute(response.title), for: "vote_id_#{response.id}" %>
15
+ </div>
16
+ <% end %>
13
17
  </div>
14
18
  </div>
@@ -3,9 +3,15 @@
3
3
  method: :post,
4
4
  html: { class: "form" }) do |f| %>
5
5
 
6
- <%= render partial: "form", locals: { form: f, question: current_participatory_space } %>
6
+ <div class="section row<%= " question-masonry-group" if current_participatory_space.grouped? %>">
7
+ <% current_participatory_space.grouped_responses.each do |group, responses| %>
8
+ <div class="column large-4 medium-6<%= " large-offset-4 medium-offset-3" unless current_participatory_space.grouped? %>">
9
+ <%= render partial: "form", locals: { form: f, group: group, responses: responses } %>
10
+ </div>
11
+ <% end %>
12
+ </div>
7
13
 
8
- <div class="section question-vote-cabin">
14
+ <div class="question-vote-cabin">
9
15
 
10
16
  <div class="row column">
11
17
  <div class="large-offset-4 large-4 medium-offset-3 medium-6">
@@ -8,88 +8,91 @@
8
8
  </div>
9
9
  </div>
10
10
 
11
- <div class="row column question-vote-cabin">
12
- <div class="columns mediumlarge-4 show-for-mediumlarge previous-question">
13
- <%= display_next_previous_button(:previous, "float-left") %>
14
- </div>
15
- <div class="columns mediumlarge-4">
16
- <% if question.consultation.upcoming? %>
17
- <div class="card__button button expanded disabled">
18
- <div class="vote-button-caption"><%= t("questions.vote_button.vote", scope: "decidim") %></div>
19
- <div>
20
- <%= t "questions.vote_button.starting_from",
21
- scope: "decidim",
22
- date: l(question.start_voting_date) %>
23
- </div>
24
- </div>
25
- <% elsif question.consultation.finished? && signed_in? && question.voted_by?(current_user) %>
26
- <%= button_to decidim_consultations.question_question_votes_path(question),
27
- method: :delete,
28
- remote: true,
29
- data: { disable: true },
30
- class: "card__button button expanded success disabled",
31
- id: "unvote_button" do %>
32
- <div class="vote-button-caption">
33
- <%= t("questions.vote_button.already_voted", scope: "decidim") %>
11
+ <%# Check if controller has questions_helper %>
12
+ <% if defined? display_next_previous_button %>
13
+ <div class="row column question-vote-cabin">
14
+ <div class="columns mediumlarge-4 show-for-mediumlarge previous-question">
15
+ <%= display_next_previous_button(:previous, "float-left") %>
16
+ </div>
17
+ <div class="columns mediumlarge-4">
18
+ <% if question.consultation.upcoming? %>
19
+ <div class="card__button button expanded disabled">
20
+ <div class="vote-button-caption"><%= t("questions.vote_button.vote", scope: "decidim") %></div>
21
+ <div>
22
+ <%= t "questions.vote_button.starting_from",
23
+ scope: "decidim",
24
+ date: l(question.start_voting_date) %>
25
+ </div>
34
26
  </div>
35
- <% end %>
36
- <% elsif signed_in? && question.consultation.active? %>
37
- <% if allowed_to? :unvote, :question, question: question %>
27
+ <% elsif question.consultation.finished? && signed_in? && question.voted_by?(current_user) %>
38
28
  <%= button_to decidim_consultations.question_question_votes_path(question),
39
- method: :delete,
40
- remote: true,
41
- data: { disable: true },
42
- class: "card__button button expanded success",
43
- id: "unvote_button" do %>
44
- <div class="vote-button-caption"
45
- data-original="<%= t("questions.vote_button.already_voted", scope: "decidim") %>"
46
- data-replace="<%= t("questions.vote_button.already_voted_hover", scope: "decidim") %>">
29
+ method: :delete,
30
+ remote: true,
31
+ data: { disable: true },
32
+ class: "card__button button expanded success disabled",
33
+ id: "unvote_button" do %>
34
+ <div class="vote-button-caption">
47
35
  <%= t("questions.vote_button.already_voted", scope: "decidim") %>
48
36
  </div>
49
37
  <% end %>
50
- <% elsif allowed_to? :vote, :question, question: question %>
51
- <% if question.multiple? %>
52
- <%= link_to decidim_consultations.question_question_multiple_votes_path(question),
53
- class: "card__button button expanded",
54
- id: "multivote_button" do %>
55
- <div class="vote-button-caption"><%= t "questions.vote_button.vote", scope: "decidim" %></div>
38
+ <% elsif signed_in? && question.consultation.active? %>
39
+ <% if allowed_to? :unvote, :question, question: question %>
40
+ <%= button_to decidim_consultations.question_question_votes_path(question),
41
+ method: :delete,
42
+ remote: true,
43
+ data: { disable: true },
44
+ class: "card__button button expanded success",
45
+ id: "unvote_button" do %>
46
+ <div class="vote-button-caption"
47
+ data-original="<%= t("questions.vote_button.already_voted", scope: "decidim") %>"
48
+ data-replace="<%= t("questions.vote_button.already_voted_hover", scope: "decidim") %>">
49
+ <%= t("questions.vote_button.already_voted", scope: "decidim") %>
50
+ </div>
51
+ <% end %>
52
+ <% elsif allowed_to? :vote, :question, question: question %>
53
+ <% if question.multiple? %>
54
+ <%= link_to decidim_consultations.question_question_multiple_votes_path(question),
55
+ class: "card__button button expanded",
56
+ id: "multivote_button" do %>
57
+ <div class="vote-button-caption"><%= t "questions.vote_button.vote", scope: "decidim" %></div>
58
+ <% end %>
59
+ <% else %>
60
+ <%= link_to "#", class: "card__button button expanded", id: "vote_button" do %>
61
+ <div class="vote-button-caption"><%= t "questions.vote_button.vote", scope: "decidim" %></div>
62
+ <% end %>
56
63
  <% end %>
57
64
  <% else %>
58
- <%= link_to "#", class: "card__button button expanded", id: "vote_button" do %>
59
- <div class="vote-button-caption"><%= t "questions.vote_button.vote", scope: "decidim" %></div>
65
+ <%= authorized_vote_modal_button(question, remote: true, class: "button expanded light button--sc") do %>
66
+ <%= t("questions.vote_button.verification_required", scope: "decidim") %>
60
67
  <% end %>
61
68
  <% end %>
62
- <% else %>
63
- <%= authorized_vote_modal_button(question, remote: true, class: "button expanded light button--sc") do %>
64
- <%= t("questions.vote_button.verification_required", scope: "decidim") %>
69
+ <% elsif question.consultation.active? %>
70
+ <%= logged_button_to decidim_consultations.question_question_votes_path(question),
71
+ class: "card__button button expanded",
72
+ data: { disable: true },
73
+ id: "vote_button" do %>
74
+ <div class="vote-button-caption">
75
+ <%= t("questions.vote_button.vote", scope: "decidim") %>
76
+ </div>
65
77
  <% end %>
66
78
  <% end %>
67
- <% elsif question.consultation.active? %>
68
- <%= logged_button_to decidim_consultations.question_question_votes_path(question),
69
- class: "card__button button expanded",
70
- data: { disable: true },
71
- id: "vote_button" do %>
72
- <div class="vote-button-caption">
73
- <%= t("questions.vote_button.vote", scope: "decidim") %>
74
- </div>
75
- <% end %>
76
- <% end %>
77
- </div>
78
- <div class="columns mediumlarge-4 show-for-mediumlarge next-question">
79
- <%= display_next_previous_button(:next, "float-right") %>
79
+ </div>
80
+ <div class="columns mediumlarge-4 show-for-mediumlarge next-question">
81
+ <%= display_next_previous_button(:next, "float-right") %>
82
+ </div>
80
83
  </div>
81
- </div>
82
84
 
83
- <div class="row column section hide-for-mediumlarge">
84
- <div class="small-buttons">
85
- <div class="columns small-6 previous-question">
86
- <%= display_next_previous_button(:previous, "expanded") %>
87
- </div>
88
- <div class="columns small-6 next-question">
89
- <%= display_next_previous_button(:next, "expanded") %>
85
+ <div class="row column section hide-for-mediumlarge">
86
+ <div class="small-buttons">
87
+ <div class="columns small-6 previous-question">
88
+ <%= display_next_previous_button(:previous, "expanded") %>
89
+ </div>
90
+ <div class="columns small-6 next-question">
91
+ <%= display_next_previous_button(:next, "expanded") %>
92
+ </div>
90
93
  </div>
91
94
  </div>
92
- </div>
95
+ <% end %>
93
96
 
94
97
  <%= render partial: "decidim/consultations/questions/vote_modal", locals: { question: question } %>
95
98
  <%= render partial: "decidim/consultations/questions/vote_modal_confirm", locals: { question: question } %>