diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 6f5117bf2..8c1529531 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1322,8 +1322,19 @@ ul.ballot-list { color: $brand; } - .callout.warning a { - color: $color-warning; + .callout { + + &.warning a { + color: $color-warning; + } + + &.primary a { + color: $color-info; + } + + &.alert a { + color: $color-alert; + } } .info { @@ -1361,9 +1372,13 @@ ul.ballot-list { .dates { color: $text-medium; font-size: $small-font-size; + + @include breakpoint(medium) { + float: right; + } } - h3 a { + h4 a { color: $text; } } @@ -1372,6 +1387,12 @@ h2.questions-callout { font-size: $base-font-size; } +h3.section-title-divider { + border-bottom: 2px solid $brand; + color: $brand; + margin-bottom: $line-height; +} + .poll-question { padding: 0 $line-height; diff --git a/app/views/polls/_poll_group.html.erb b/app/views/polls/_poll_group.html.erb new file mode 100644 index 000000000..a30259304 --- /dev/null +++ b/app/views/polls/_poll_group.html.erb @@ -0,0 +1,23 @@ +<% poll_group.each do |poll| %> +
+
+
+
<%= poll_dates(poll) %>
+

<%= link_to poll.name, poll %>

+
    + <% poll.questions.each do |question| %> +
  • <%= link_to question.title, question_path(question) %>
  • + <% end %> +
+
    + <% poll.geozones.each do |g| %> +
  • <%= g.name %>
  • + <% end %> +
+
+
+ <%= link_to t("polls.index.participate_button"), poll, class: "button" %> +
+
+
+<% end %> diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index 0d278a8ba..d8c328267 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -15,27 +15,16 @@
- <% @polls.each do |poll| %> -
-
-
-

<%= link_to poll.name, poll %>

-

<%= poll_dates(poll) %>

-
    - <% poll.geozones.each do |g| %> -
  • <%= g.name %>
  • - <% end %> -
-
-
- <% if can? :answer, poll %> - <%= link_to t("polls.index.participate_button"), poll, class: "button" %> - <% else %> - <%= link_to t("polls.index.view_button"), poll %> - <% end %> -
-
-
+ <% polls_by_geozone_restriction = @polls.group_by(&:geozone_restricted) %> + + <% if polls_by_geozone_restriction[false].present? %> +

<%= t("polls.index.no_geozone_restricted") %>

+ <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[false]} %> + <% end %> + + <% if polls_by_geozone_restriction[true].present? %> +

<%= t("polls.index.geozone_restricted") %>

+ <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[true]} %> <% end %> <%= paginate @polls %> diff --git a/config/locales/en.yml b/config/locales/en.yml index edf96a210..a28a93598 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -403,7 +403,8 @@ en: expired: "Expired" title: "Polls" participate_button: "Participate in this poll" - view_button: "View details about this poll" + no_geozone_restricted: "All city" + geozone_restricted: "Districts" show: dates_title: "Participation dates" cant_answer_not_logged_in: "You must %{signin} or %{signup} to participate." diff --git a/config/locales/es.yml b/config/locales/es.yml index ce5d328c5..d6d819fe8 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -403,7 +403,8 @@ es: expired: "Terminadas" title: "Votaciones" participate_button: "Participar en esta votación" - view_button: "Ver detalles de la votación" + no_geozone_restricted: "Toda la ciudad" + geozone_restricted: "Distritos" show: dates_title: "Fechas de participación" cant_answer_not_logged_in: "Necesitas %{signin} o %{signup} para participar." diff --git a/spec/features/polls/polls_spec.rb b/spec/features/polls/polls_spec.rb index 7293d6682..fe5957181 100644 --- a/spec/features/polls/polls_spec.rb +++ b/spec/features/polls/polls_spec.rb @@ -11,7 +11,7 @@ feature 'Polls' do polls.each do |poll| expect(page).to have_content(poll.name) - expect(page).to have_link("View details about this poll") + expect(page).to have_link("Participate in this poll") end end