Merge pull request #6238 from svbergerem/mobile-location-polls
Add location and polls to mobile website
This commit is contained in:
commit
5a5d595339
9 changed files with 90 additions and 1 deletions
|
|
@ -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)
|
* 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)
|
* 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)
|
* 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
|
# 0.5.3.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
@import "mobile/tags";
|
@import "mobile/tags";
|
||||||
@import "mobile/conversations";
|
@import "mobile/conversations";
|
||||||
@import "mobile/settings";
|
@import "mobile/settings";
|
||||||
|
@import "mobile/stream_element";
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #2489ce;
|
color: #2489ce;
|
||||||
|
|
|
||||||
16
app/assets/stylesheets/mobile/stream_element.scss
Normal file
16
app/assets/stylesheets/mobile/stream_element.scss
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
.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')
|
= t('public')
|
||||||
- else
|
- else
|
||||||
= t('limited')
|
= t('limited')
|
||||||
|
- if !post.is_a?(Reshare) and post.location
|
||||||
|
.location
|
||||||
|
= t("posts.show.location", location: post.location.address)
|
||||||
|
|
|
||||||
25
app/views/status_messages/_poll.mobile.haml
Normal file
25
app/views/status_messages/_poll.mobile.haml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
.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)}
|
%div{:class => direction_for(post.text)}
|
||||||
!= post.message.markdownified
|
!= post.message.markdownified
|
||||||
|
- if post.poll
|
||||||
|
= render "status_messages/poll", poll: post.poll
|
||||||
- if post.o_embed_cache
|
- if post.o_embed_cache
|
||||||
!= o_embed_html post.o_embed_cache
|
!= o_embed_html post.o_embed_cache
|
||||||
-if post.open_graph_cache
|
- if post.open_graph_cache
|
||||||
.opengraph
|
.opengraph
|
||||||
!= og_html post.open_graph_cache
|
!= og_html post.open_graph_cache
|
||||||
|
|
|
||||||
|
|
@ -975,10 +975,17 @@ en:
|
||||||
or_select_one_existing: "or select one from your already existing %{photos}"
|
or_select_one_existing: "or select one from your already existing %{photos}"
|
||||||
comment_email_subject: "%{name}’s photo"
|
comment_email_subject: "%{name}’s photo"
|
||||||
|
|
||||||
|
polls:
|
||||||
|
votes:
|
||||||
|
zero: "%{count} votes so far"
|
||||||
|
one: "%{count} vote so far"
|
||||||
|
other: "%{count} votes so far"
|
||||||
|
|
||||||
posts:
|
posts:
|
||||||
presenter:
|
presenter:
|
||||||
title: "A post from %{name}"
|
title: "A post from %{name}"
|
||||||
show:
|
show:
|
||||||
|
location: "Posted from: %{location}"
|
||||||
destroy: "Delete"
|
destroy: "Delete"
|
||||||
permalink: "Permalink"
|
permalink: "Permalink"
|
||||||
not_found: "Sorry, we couldn’t find that post."
|
not_found: "Sorry, we couldn’t find that post."
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,12 @@ FactoryGirl.define do
|
||||||
end
|
end
|
||||||
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
|
factory(:status_message_with_photo) do
|
||||||
sequence(:text) {|n| "There are #{n} ninjas in this photo." }
|
sequence(:text) {|n| "There are #{n} ninjas in this photo." }
|
||||||
after(:build) do |sm|
|
after(:build) do |sm|
|
||||||
|
|
@ -134,6 +140,7 @@ FactoryGirl.define do
|
||||||
end
|
end
|
||||||
|
|
||||||
factory(:location) do
|
factory(:location) do
|
||||||
|
address "unicorn city"
|
||||||
lat 1
|
lat 1
|
||||||
lng 2
|
lng 2
|
||||||
end
|
end
|
||||||
|
|
|
||||||
27
spec/integration/mobile_posts_spec.rb
Normal file
27
spec/integration/mobile_posts_spec.rb
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
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
|
||||||
Loading…
Reference in a new issue