Commit 5a5d5953 authored by Jonne Haß's avatar Jonne Haß

Merge pull request #6238 from svbergerem/mobile-location-polls

Add location and polls to mobile website
parents 6eebd5aa 79dfdfa2
......@@ -52,6 +52,7 @@ With the port to Bootstrap 3, app/views/terms/default.haml has a new structure.
* Add mobile services and privacy settings pages [#6086](https://github.com/diaspora/diaspora/pull/6086)
* Optionally make your extended profile details public [#6162](https://github.com/diaspora/diaspora/pull/6162)
* Add admin dashboard showing latest diaspora\* version [#6216](https://github.com/diaspora/diaspora/pull/6216)
* Display poll & location on mobile [#6238](https://github.com/diaspora/diaspora/pull/6238)
# 0.5.3.0
......
......@@ -10,6 +10,7 @@
@import "mobile/tags";
@import "mobile/conversations";
@import "mobile/settings";
@import "mobile/stream_element";
a {
color: #2489ce;
......
.stream_element {
.location {
color: $text-grey;
font-size: $font-size-small;
white-space: normal;
}
.poll {
border-top: 1px solid $border-grey;
margin-top: 20px;
padding-top: 10px;
.poll-head .question {
font-weight: bold;
}
}
}
......@@ -30,3 +30,6 @@
= t('public')
- else
= t('limited')
- if !post.is_a?(Reshare) and post.location
.location
= t("posts.show.location", location: post.location.address)
.poll
.poll-head
.poll-stats.pull-right
= t("polls.votes", count: poll.participation_count)
.question
= poll.question
.poll-content
- poll.poll_answers.each do |answer|
.result-row
.result-head
- percentage = 0
- if poll.participation_count > 0
- percentage = (answer.vote_count / 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}%"
......@@ -16,8 +16,10 @@
%div{:class => direction_for(post.text)}
!= post.message.markdownified
- if post.poll
= render "status_messages/poll", poll: post.poll
- 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
......@@ -975,10 +975,17 @@ 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}"
show:
location: "Posted from: %{location}"
destroy: "Delete"
permalink: "Permalink"
not_found: "Sorry, we couldn’t find that post."
......
......@@ -99,6 +99,12 @@ FactoryGirl.define do
end
end
factory(:status_message_with_location) do
after(:build) do |sm|
FactoryGirl.create(:location, status_message: sm)
end
end
factory(:status_message_with_photo) do
sequence(:text) {|n| "There are #{n} ninjas in this photo." }
after(:build) do |sm|
......@@ -134,6 +140,7 @@ FactoryGirl.define do
end
factory(:location) do
address "unicorn city"
lat 1
lng 2
end
......
require "spec_helper"
describe PostsController, type: :request do
context "with a poll" do
let(:sm) { FactoryGirl.build(:status_message_with_poll, public: true) }
it "displays the poll" do
get "/posts/#{sm.id}", format: :mobile
expect(response.status).to eq(200)
expect(response.body).to match(/div class='poll'/)
expect(response.body).to match(/#{sm.poll.poll_answers.first.answer}/)
end
end
context "with a location" do
let(:sm) { FactoryGirl.build(:status_message_with_location, public: true) }
it "displays the location" do
get "/posts/#{sm.id}", format: :mobile
expect(response.status).to eq(200)
expect(response.body).to match(/div class='location'/)
expect(response.body).to match(/#{I18n.t("posts.show.location", location: sm.location.address)}/)
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment