From a6fbe063c9202a9844bd71b1738c7c801d0d7f7b Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Thu, 22 Dec 2016 18:30:39 +0100 Subject: [PATCH] adds styles to polls index and show views --- app/assets/stylesheets/participation.scss | 79 +++++++++------- app/views/polls/index.html.erb | 34 +++++-- app/views/polls/show.html.erb | 104 ++++++++++++---------- config/locales/en.yml | 2 + config/locales/es.yml | 2 + 5 files changed, 137 insertions(+), 84 deletions(-) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 4f0b58bf7..6d9bc4216 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -6,6 +6,7 @@ // 04. List participation // 05. Featured // 06. Proposals successful +// 07. Polls // // 01. Votes and supports @@ -945,37 +946,6 @@ // 06. Proposals successful // ------------------------- -.dark-heading { - background: #2D3E50; - color: white; - - @include breakpoint(medium) { - padding-bottom: $line-height; - } - - &.enquiries { - background: #2D3E50 image-url('heading_enquiries.jpg') no-repeat; - background-position: 70%; - } - - p { - margin-bottom: 0; - - &.title { - color: #FFD200; - } - } - - .info { - background: #314253; - padding-top: $line-height; - - @include breakpoint(medium) { - border-top: rem-calc(6) solid #FFD200; - } - } -} - .sucessfull-proposals-banner { background: #2D3E50 image-url("ballot_tiny.gif") no-repeat; background-position: 75% 0; @@ -1045,3 +1015,50 @@ } } } + +// 07. Polls +// ---------------------- + +.dark-heading { + background: #2D3E50; + color: white; + + .title { + color: #FFD200; + } + + .info { + background: #314253; + padding: $line-height; + + @include breakpoint(medium) { + border-top: rem-calc(6) solid #FFD200; + } + + a { + color: white; + text-decoration: underline; + } + + } + + &.poll-show { + min-height: $line-height*8; + } +} + +.poll, .poll-question { + background: white; + border-bottom: 1px solid $border; + margin-bottom: $line-height/2; + padding: $line-height; + + .date { + color: $brand; + font-size: $small-font-size; + } + + h3 a { + color: $text; + } +} diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index b5d98e00f..0b59a17ab 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -1,7 +1,31 @@ -<%= render 'shared/filter_subnav', i18n_namespace: "polls.index" %> +<% provide :title do %><%= t("polls.index.title") %><% end %> +<% content_for :wrapper_class, "light" %> -<% @polls.each do |poll| %> - <%= link_to poll.name, poll %> (<%= poll_dates(poll) %>) -<% end %> +
+
+
+

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

+
+
+
-<%= paginate @polls %> +
+
+ <%= render 'shared/filter_subnav_vertical', i18n_namespace: "polls.index" %> +
+ +
+ <% @polls.each do |poll| %> +
+

<%= poll.name %>

+

<%= poll_dates(poll) %>

+ <%= link_to t("polls.index.button"), + poll, + class: "button", + title: t("polls.index.button") + " " + (poll.name) %> +
+ <% end %> + + <%= paginate @polls %> +
+
diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 3006ebc71..63babcfd4 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -1,54 +1,62 @@ -

<%= @poll.name %>

-

<%= t("polls.show.dates_title") %>: <%= poll_dates(@poll) %>

+<% provide :title do %><%= @poll.name %><% end %> +<% content_for :wrapper_class, "light" %> -<% unless can?(:answer, @poll) %> +
+
+
+ <%= render "shared/back_link" %> + +

<%= @poll.name %>

+
+
+

+ <%= t("polls.show.dates_title") %> +

+

+ <%= poll_dates(@poll) %> +

+
+
+
+ +
- <% if current_user.nil? %> -
- <%= t("polls.show.cant_answer_not_logged_in", - signin: link_to(t("polls.show.signin"), new_user_session_path, class: "probe-message"), - signup: link_to(t("polls.show.signup"), new_user_registration_path, class: "probe-message")).html_safe %> -
- <% elsif current_user.unverified? %> + <% unless can?(:answer, @poll) %> + <% if current_user.nil? %> +
+ <%= t("polls.show.cant_answer_not_logged_in", + signin: link_to(t("polls.show.signin"), new_user_session_path, class: "probe-message"), + signup: link_to(t("polls.show.signup"), new_user_registration_path, class: "probe-message")).html_safe %> +
+ <% elsif current_user.unverified? %> +
+ <%= t('polls.show.cant_answer_verify_html', + verify_link: link_to(t('polls.show.verify_link'), verification_path)) %> +
+ <% elsif @poll.incoming? %> +
+ <%= t('polls.show.cant_answer_incoming') %> +
+ <% elsif @poll.expired? %> +
+ <%= t('polls.show.cant_answer_expired') %> +
+ <% end %> + <% end %> + + <% @answerable_questions.each do |question| %> + <%= render 'polls/questions/question', question: question %> + <% end %> + + <% if can?(:answer, @poll) && + @non_answerable_questions.present? %>
- <%= t('polls.show.cant_answer_verify_html', - verify_link: link_to(t('polls.show.verify_link'), verification_path)) %> -
- <% elsif @poll.incoming? %> -
- <%= t('polls.show.cant_answer_incoming') %> -
- <% elsif @poll.expired? %> -
- <%= t('polls.show.cant_answer_expired') %> + <%= t('polls.show.cant_answer_wrong_geozone') %>
<% end %> + + <% @non_answerable_questions.each do |question| %> + <%= render 'polls/questions/question', question: question %> + <% end %>
-<% end %> - -<% @answerable_questions.each do |question| %> -
- <%= link_to question.title, question_path(question) %> - -
- <%= render 'polls/questions/answers', question: question %> -
-
-<% end %> - -<% if can?(:answer, @poll) && - @non_answerable_questions.present? %> -
- <%= t('polls.show.cant_answer_wrong_geozone') %> -
-<% end %> - -<% @non_answerable_questions.each do |question| %> -
- <%= link_to question.title, question_path(question) %> - -
- <%= render 'polls/questions/answers', question: question %> -
-
-<% end %> +
diff --git a/config/locales/en.yml b/config/locales/en.yml index 4f632166f..f4ba4630d 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -387,6 +387,8 @@ en: current: "Open" incoming: "Incoming" expired: "Expired" + title: "Polls" + button: "Participate in this polls" 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 8440d2390..5464efb80 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -387,6 +387,8 @@ es: current: "Abiertas" incoming: "Próximamente" expired: "Terminadas" + title: "Votaciones" + button: "Participar en esta votación" show: dates_title: "Fechas de participación" cant_answer_not_logged_in: "Necesitas %{signin} o %{signup} para participar."