adds styles to polls index and show views

This commit is contained in:
Alberto Garcia Cabeza
2016-12-22 18:30:39 +01:00
parent 78db093e49
commit a6fbe063c9
5 changed files with 137 additions and 84 deletions

View File

@@ -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;
}
}

View File

@@ -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 %>
<div class="expanded no-margin-top dark-heading">
<div class="row">
<div class="small-12 medium-6 column padding">
<h1><%= t("polls.index.title") %></h1>
</div>
</div>
</div>
<%= paginate @polls %>
<div class="row">
<div class="small-12 medium-3 column">
<%= render 'shared/filter_subnav_vertical', i18n_namespace: "polls.index" %>
</div>
<div class="small-12 medium-9 column margin-top">
<% @polls.each do |poll| %>
<div class="poll">
<h3><%= poll.name %></h3>
<p><%= poll_dates(poll) %></p>
<%= link_to t("polls.index.button"),
poll,
class: "button",
title: t("polls.index.button") + " " + (poll.name) %>
</div>
<% end %>
<%= paginate @polls %>
</div>
</div>

View File

@@ -1,54 +1,62 @@
<h1><%= @poll.name %></h1>
<p><strong><%= t("polls.show.dates_title") %>: <%= poll_dates(@poll) %></strong></p>
<% provide :title do %><%= @poll.name %><% end %>
<% content_for :wrapper_class, "light" %>
<% unless can?(:answer, @poll) %>
<div class="expanded no-margin-top dark-heading poll-show">
<div class="row">
<div class="small-12 medium-6 column padding">
<%= render "shared/back_link" %>
<h2><%= @poll.name %></h2>
</div>
<div class="small-12 medium-4 column padding info">
<p class="title">
<strong><%= t("polls.show.dates_title") %></strong>
</p>
<p>
<strong><%= poll_dates(@poll) %></strong>
</p>
</div>
</div>
</div>
<div class="row margin-top">
<div class="small-12 column">
<% if current_user.nil? %>
<div class="callout primary">
<%= 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 %>
</div>
<% elsif current_user.unverified? %>
<% unless can?(:answer, @poll) %>
<% if current_user.nil? %>
<div class="callout primary">
<%= 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 %>
</div>
<% elsif current_user.unverified? %>
<div class="callout warning">
<%= t('polls.show.cant_answer_verify_html',
verify_link: link_to(t('polls.show.verify_link'), verification_path)) %>
</div>
<% elsif @poll.incoming? %>
<div class="callout primary">
<%= t('polls.show.cant_answer_incoming') %>
</div>
<% elsif @poll.expired? %>
<div class="callout alert">
<%= t('polls.show.cant_answer_expired') %>
</div>
<% end %>
<% end %>
<% @answerable_questions.each do |question| %>
<%= render 'polls/questions/question', question: question %>
<% end %>
<% if can?(:answer, @poll) &&
@non_answerable_questions.present? %>
<div class="callout warning">
<%= t('polls.show.cant_answer_verify_html',
verify_link: link_to(t('polls.show.verify_link'), verification_path)) %>
</div>
<% elsif @poll.incoming? %>
<div class="callout primary">
<%= t('polls.show.cant_answer_incoming') %>
</div>
<% elsif @poll.expired? %>
<div class="callout alert">
<%= t('polls.show.cant_answer_expired') %>
<%= t('polls.show.cant_answer_wrong_geozone') %>
</div>
<% end %>
<% @non_answerable_questions.each do |question| %>
<%= render 'polls/questions/question', question: question %>
<% end %>
</div>
<% end %>
<% @answerable_questions.each do |question| %>
<div id="<%= dom_id(question) %>">
<%= link_to question.title, question_path(question) %>
<div class="row margin-top text-center" id="<%= dom_id(question) %>_answers">
<%= render 'polls/questions/answers', question: question %>
</div>
</div>
<% end %>
<% if can?(:answer, @poll) &&
@non_answerable_questions.present? %>
<div class="callout warning">
<%= t('polls.show.cant_answer_wrong_geozone') %>
</div>
<% end %>
<% @non_answerable_questions.each do |question| %>
<div id="<%= dom_id(question) %>">
<%= link_to question.title, question_path(question) %>
<div class="row margin-top text-center" id="<%= dom_id(question) %>_answers">
<%= render 'polls/questions/answers', question: question %>
</div>
</div>
<% end %>
</div>

View File

@@ -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."

View File

@@ -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."