Display polls on mobile devices

This commit is contained in:
Steffen van Bergerem 2015-07-23 14:09:14 +02:00
parent dce2101d9d
commit 5d39461443
4 changed files with 42 additions and 1 deletions

View file

@ -10,6 +10,7 @@
@import "mobile/tags";
@import "mobile/conversations";
@import "mobile/settings";
@import "mobile/polls";
a {
color: #2489ce;

View file

@ -0,0 +1,8 @@
.stream_element .poll {
border-top: 1px solid $border-grey;
margin-top: 20px;
padding-top: 10px;
.poll-head .question {
font-weight: bold;
}
}

View file

@ -16,8 +16,34 @@
%div{:class => direction_for(post.text)}
!= post.message.markdownified
- if post.poll
.poll
.poll-head
.poll-stats.pull-right
= t("polls.votes", count: post.poll.participation_count)
.question
= post.poll.question
.poll-content
- post.poll.poll_answers.each do |answer|
.result-row
.result-head
- percentage = 0
- if post.poll.participation_count > 0
- percentage = (answer.vote_count / post.poll.participation_count * 100).round
.percentage.pull-right
= "#{percentage}%"
.answer
= answer.answer
.progress
.progress-bar{role: "progressbar",
aria: {valuenow: "#{percentage}",
valuemin: "0",
valuemax: "100"},
style: "width: #{percentage}%;"}
%span.sr-only
= "#{percentage}%"
- if post.o_embed_cache
!= o_embed_html post.o_embed_cache
-if post.open_graph_cache
- if post.open_graph_cache
.opengraph
!= og_html post.open_graph_cache

View file

@ -975,6 +975,12 @@ en:
or_select_one_existing: "or select one from your already existing %{photos}"
comment_email_subject: "%{name}s photo"
polls:
votes:
zero: "%{count} votes so far"
one: "%{count} vote so far"
other: "%{count} votes so far"
posts:
presenter:
title: "A post from %{name}"