diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 6d9bc4216..3858bbcef 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1024,7 +1024,7 @@ color: white; .title { - color: #FFD200; + color: #92BA48; } .info { @@ -1032,7 +1032,7 @@ padding: $line-height; @include breakpoint(medium) { - border-top: rem-calc(6) solid #FFD200; + border-top: rem-calc(6) solid #92BA48; } a { @@ -1049,12 +1049,15 @@ .poll, .poll-question { background: white; - border-bottom: 1px solid $border; + border-radius: rem-calc(6); margin-bottom: $line-height/2; +} + +.poll { padding: $line-height; - .date { - color: $brand; + .dates { + color: $text-medium; font-size: $small-font-size; } @@ -1062,3 +1065,47 @@ color: $text; } } + +h2.questions-callout { + font-size: $base-font-size; +} + +.poll-question { + padding: 0 $line-height; + + h3 { + padding-top: $line-height; + + a { + color: $text; + } + } +} + +.poll-question-answers { + + .button { + margin-right: $line-height/4; + min-width: rem-calc(168); + + &.answered { + background: #F4F8EC; + border: 2px solid #92BA48; + color: $text; + position: relative; + + &:after { + background: #92BA48; + border-radius: rem-calc(20); + content: "\6c"; + color: white; + font-family: "icons" !important; + font-size: rem-calc(12); + padding: $line-height/4; + position: absolute; + right: -6px; + top: -6px; + } + } + } +} diff --git a/app/views/polls/_callout.html.erb b/app/views/polls/_callout.html.erb new file mode 100644 index 000000000..2fad7d07d --- /dev/null +++ b/app/views/polls/_callout.html.erb @@ -0,0 +1,22 @@ +<% 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 %> diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index 0b59a17ab..bba805ebb 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -17,12 +17,18 @@
<% @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) %> +
+
+

<%= poll.name %>

+

<%= poll_dates(poll) %>

+
+
+ <%= link_to t("polls.index.button"), + poll, + class: "button", + title: t("polls.index.button") + ": " + (poll.name) %> +
+
<% end %> diff --git a/app/views/polls/questions/_answers.html.erb b/app/views/polls/questions/_answers.html.erb index c7effd0c0..c88156b68 100644 --- a/app/views/polls/questions/_answers.html.erb +++ b/app/views/polls/questions/_answers.html.erb @@ -2,7 +2,7 @@ <% if can? :answer, question %> <% question.valid_answers.each do |answer| %> <% if @answers_by_question_id[question.id] == answer %> - "> + "> <%= answer %> <% else %> @@ -16,7 +16,7 @@ <% end %> <% else %> <% question.valid_answers.each do |answer| %> - <%= answer %> + <%= answer %> <% end %> <% end %>
diff --git a/app/views/polls/questions/_question.html.erb b/app/views/polls/questions/_question.html.erb index b8040c85b..f0958b6e4 100644 --- a/app/views/polls/questions/_question.html.erb +++ b/app/views/polls/questions/_question.html.erb @@ -3,7 +3,7 @@ <%= link_to question.title, question_path(question) %> -
+
<%= render 'polls/questions/answers', question: question %>
diff --git a/app/views/polls/questions/show.html.erb b/app/views/polls/questions/show.html.erb index 76265797c..91dcff01d 100644 --- a/app/views/polls/questions/show.html.erb +++ b/app/views/polls/questions/show.html.erb @@ -27,52 +27,67 @@ <%= t('poll_questions.show.author') %> -

-

- <%= link_to @question.author.name, @question.author, class: "margin-bottom" %> +
+ <%= link_to @question.author.name, @question.author %>

- - <%= t('poll_questions.show.dates_title') %> + + <%= t('poll_questions.show.poll') %> + +
+ <%= link_to @question.poll.name, @question.poll %> +

+ +

+ + <%= t('poll_questions.show.dates_title') %> + +
+ <%= poll_dates(@question.poll) %>

-

<%= poll_dates(@question.poll) %>

-<% if @question.poll.current? %>
- <% if current_user.nil? %> + <% if @question.poll.current? %> + + <% if current_user.nil? %> +
+ <%= t("poll_questions.show.not_logged_in", + signin: link_to(t("poll_questions.show.signin"), new_user_session_path, class: "probe-message"), + signup: link_to(t("poll_questions.show.signup"), new_user_registration_path, class: "probe-message")).html_safe %> +
+ <% elsif current_user.unverified? %> +
+ <%= t('poll_questions.show.cant_answer_verify_html', + verify_link: link_to(t('poll_questions.show.verify_link'), verification_path)) %> +
+ <% else %> +
+ <%= t('poll_questions.show.cant_answer_wrong_geozone') %> +
+ <% end %> + +
+
+ <%= render "answers", question: @question %> +
+
+ + <% elsif @question.poll.incoming? %> +
+ <%= t('poll_questions.show.cant_answer_expired') %> +
+ <% elsif @question.poll.expired? %>
- <%= t("poll_questions.show.not_logged_in", - signin: link_to(t("poll_questions.show.signin"), new_user_session_path, class: "probe-message"), - signup: link_to(t("poll_questions.show.signup"), new_user_registration_path, class: "probe-message")).html_safe %> -
- <% elsif current_user.unverified? %> -
- <%= t('poll_questions.show.cant_answer_verify_html', - verify_link: link_to(t('poll_questions.show.verify_link'), verification_path)) %> -
- <% else %> -
- <%= t('poll_questions.show.cant_answer_wrong_geozone') %> + <%= t('poll_questions.show.cant_answer_incoming') %>
<% end %>
- -
-
- <%= render "answers", question: @question %> -
-
-<% elsif @question.poll.incoming? %> - <%= t('poll_questions.show.cant_answer_expired') %> -<% elsif @question.poll.expired? %> - <%= t('poll_questions.show.cant_answer_incoming') %> -<% end %>
diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 63babcfd4..fb207618d 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -3,55 +3,44 @@
-
+
<%= render "shared/back_link" %>

<%= @poll.name %>

-
-
-

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

- <%= poll_dates(@poll) %> + <%= t("polls.show.question_count_html", + count: @poll.questions.count) %>

+ + <%= render "callout" %> +
+
+
+

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

+
-
- <% 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_wrong_geozone') %> +
+

+ <%= t("polls.show.cant_answer_wrong_geozone", + count: @non_answerable_questions.count) %> +

<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 298b33858..38f7d482a 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -398,7 +398,8 @@ en: verify_link: "verify your account" cant_answer_incoming: "This poll has not yet started." cant_answer_expired: "This poll has finished." - cant_answer_wrong_geozone: "The following questions are not available in your geozone." + cant_answer_wrong_geozone: "You can't answers the following %{count} questions because are not available in your geozone." + question_count_html: "This poll has a total of %{count} qeustions." poll_questions: create_question: "Create question" default_valid_answers: "Yes, No" @@ -417,6 +418,7 @@ en: cant_answer_wrong_geozone: "This question is not available on your geozone." vote_answer: "Vote %{answer}" voted: "You have voted %{answer}" + poll: "Poll" banner: featured_title: "#NextVoting" info: "New proposals that have reached the voting phase." diff --git a/config/locales/es.yml b/config/locales/es.yml index 5464efb80..858956f41 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -398,7 +398,8 @@ es: verify_link: "verifica tu cuenta" cant_answer_incoming: "Esta votación todavía no ha comenzado." cant_answer_expired: "Esta votación ha terminado." - cant_answer_wrong_geozone: "Esta votación no está disponible en tu zona." + cant_answer_wrong_geozone: "No puedes responder a las siguientes %{count} preguntas porque no están disponibles en tu zona:" + question_count_html: "Esta votación tiene un total de %{count} preguntas." poll_questions: create_question: "Crear pregunta para votación" default_valid_answers: "Sí, No" @@ -417,6 +418,7 @@ es: cant_answer_wrong_geozone: "Esta votación no está disponible en tu zona." vote_answer: "Votar %{answer}" voted: "Has votado %{answer}" + poll: "Votación" banner: featured_title: "#PróximaVotación" info: "Nuevas propuestas ciudadanas han llegado a la fase de votación." diff --git a/spec/features/polls/polls_spec.rb b/spec/features/polls/polls_spec.rb index ceacda164..df8ee5105 100644 --- a/spec/features/polls/polls_spec.rb +++ b/spec/features/polls/polls_spec.rb @@ -131,7 +131,7 @@ feature 'Polls' do visit poll_path(poll) - expect(page).to have_content('The following questions are not available in your geozone') + expect(page).to have_content("You can't answers the following 1 questions because are not available in your geozone.") expect(page).to have_content('Vader') expect(page).to have_content('Palpatine')