From 16e546c3fc3ba84c05cbf35fc34ed6ad15440da3 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 31 Jan 2017 20:44:46 +0100 Subject: [PATCH 1/8] fixes callout colors on dark heading --- app/assets/stylesheets/participation.scss | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 6f5117bf2..3f5daf8e2 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 { From 8c4541d50f7551d68961710459ed86516c7f34b6 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 31 Jan 2017 21:08:03 +0100 Subject: [PATCH 2/8] shows always questions lists and button to participate on poll index --- app/assets/stylesheets/participation.scss | 12 +++++++++++- app/views/polls/index.html.erb | 17 ++++++++++------- config/locales/en.yml | 3 ++- config/locales/es.yml | 3 ++- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 3f5daf8e2..8c1529531 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1372,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; } } @@ -1383,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/index.html.erb b/app/views/polls/index.html.erb index 0d278a8ba..9b490f3e2 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -15,12 +15,19 @@
+

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

+

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

<% @polls.each do |poll| %>
-

<%= link_to poll.name, poll %>

-

<%= poll_dates(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 %>
  • @@ -28,11 +35,7 @@
- <% if can? :answer, poll %> - <%= link_to t("polls.index.participate_button"), poll, class: "button" %> - <% else %> - <%= link_to t("polls.index.view_button"), poll %> - <% end %> + <%= link_to t("polls.index.participate_button"), poll, class: "button" %>
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." From 7091e15f1bd0aa8e74024ab5f256691cb036e01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Wed, 1 Feb 2017 17:01:09 +0100 Subject: [PATCH 3/8] separates polls in poll index based on geozone restriction --- app/views/polls/index.html.erb | 75 ++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 22 deletions(-) diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index 9b490f3e2..f606aaef9 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -15,30 +15,61 @@
-

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

-

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

- <% @polls.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" %> + <% polls_by_geozone_restriction = @polls.group_by(&:geozone_restricted) %> + + <% if polls_by_geozone_restriction[false].any? %> +

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

+ + <% polls_by_geozone_restriction[false].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 %> + <% end %> + + <% if polls_by_geozone_restriction[true].any? %> +

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

+ <% polls_by_geozone_restriction[true].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 %> <% end %> <%= paginate @polls %> From a490b88865b2d3d4531f8c382954525a5864da87 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 1 Feb 2017 17:31:04 +0100 Subject: [PATCH 4/8] moves polls_group to partial --- app/views/polls/_poll_group.html.erb | 23 +++++++++++++ app/views/polls/index.html.erb | 51 +++------------------------- 2 files changed, 27 insertions(+), 47 deletions(-) create mode 100644 app/views/polls/_poll_group.html.erb diff --git a/app/views/polls/_poll_group.html.erb b/app/views/polls/_poll_group.html.erb new file mode 100644 index 000000000..42c55809c --- /dev/null +++ b/app/views/polls/_poll_group.html.erb @@ -0,0 +1,23 @@ +<%= polls.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 f606aaef9..f0edcfbc7 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -19,57 +19,14 @@ <% if polls_by_geozone_restriction[false].any? %>

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

- - <% polls_by_geozone_restriction[false].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 %> + <%# render "poll_group", polls: polls_by_geozone_restriction[false] %> + <%= render partial: 'poll_group', locals: {polls: polls_by_geozone_restriction[false]} %> <% end %> <% if polls_by_geozone_restriction[true].any? %>

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

- <% polls_by_geozone_restriction[true].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 %> + <%# render "poll_group", polls: polls_by_geozone_restriction[true] %> + <%= render partial: 'poll_group', locals: {polls: polls_by_geozone_restriction[true]} %> <% end %> <%= paginate @polls %> From ee3b7258314d3d212efc19c03c7f48ae838e55ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Wed, 1 Feb 2017 17:37:16 +0100 Subject: [PATCH 5/8] avoids loop to render --- app/views/polls/_poll_group.html.erb | 2 +- app/views/polls/index.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/polls/_poll_group.html.erb b/app/views/polls/_poll_group.html.erb index 42c55809c..a30259304 100644 --- a/app/views/polls/_poll_group.html.erb +++ b/app/views/polls/_poll_group.html.erb @@ -1,4 +1,4 @@ -<%= polls.each do |poll| %> +<% poll_group.each do |poll| %>
diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index f0edcfbc7..2ef45547c 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -20,13 +20,13 @@ <% if polls_by_geozone_restriction[false].any? %>

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

<%# render "poll_group", polls: polls_by_geozone_restriction[false] %> - <%= render partial: 'poll_group', locals: {polls: polls_by_geozone_restriction[false]} %> + <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[false]} %> <% end %> <% if polls_by_geozone_restriction[true].any? %>

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

<%# render "poll_group", polls: polls_by_geozone_restriction[true] %> - <%= render partial: 'poll_group', locals: {polls: polls_by_geozone_restriction[true]} %> + <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[true]} %> <% end %> <%= paginate @polls %> From d676c84605a7e9c039ee938ae6e613419aef364e Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 1 Feb 2017 17:41:12 +0100 Subject: [PATCH 6/8] removes comments --- app/views/polls/index.html.erb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index 2ef45547c..237e6dc4c 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -19,13 +19,11 @@ <% if polls_by_geozone_restriction[false].any? %>

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

- <%# render "poll_group", polls: polls_by_geozone_restriction[false] %> <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[false]} %> <% end %> <% if polls_by_geozone_restriction[true].any? %>

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

- <%# render "poll_group", polls: polls_by_geozone_restriction[true] %> <%= render partial: 'poll_group', locals: {poll_group: polls_by_geozone_restriction[true]} %> <% end %> From 006cd8718865c4307b2fa59848fe9b0c11d26e2e Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 1 Feb 2017 17:43:56 +0100 Subject: [PATCH 7/8] updates text on specs --- spec/features/polls/polls_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 43907de807199034ee93e3d459702b17165a09e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Wed, 1 Feb 2017 18:00:21 +0100 Subject: [PATCH 8/8] checks for presence in hash value instead of expecting an array --- app/views/polls/index.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index 237e6dc4c..d8c328267 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -17,12 +17,12 @@
<% polls_by_geozone_restriction = @polls.group_by(&:geozone_restricted) %> - <% if polls_by_geozone_restriction[false].any? %> + <% 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].any? %> + <% 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 %>