Added a partial to display a member's location.

This commit is contained in:
Skud
2013-10-29 16:22:48 +11:00
parent 795dc0923f
commit 8dcd3932fa
3 changed files with 49 additions and 0 deletions

View File

@@ -155,6 +155,15 @@ p.stats {
height: 500px;
}
.member-location {
font-size: small;
font-style: italic;
}
.member-location a {
color: @brown;
}
// Overrides applying only to mobile view
@media only screen and (max-width: 767px) {

View File

@@ -0,0 +1,5 @@
.member-location
- if member.location.blank?
unknown location
- else
= link_to member.location, place_path(:place => member.location)

View File

@@ -0,0 +1,35 @@
require 'spec_helper'
describe "members/_location" do
context "member with location" do
before(:each) do
@member = FactoryGirl.create(:london_member)
render :partial => 'members/location', :locals => { :member => @member }
end
it 'shows location if available' do
rendered.should contain @member.location
end
it "links to the places page" do
assert_select "a", :href => place_path(@member.location)
end
end
context "member with no location" do
before(:each) do
@member = FactoryGirl.create(:member)
render :partial => 'members/location', :locals => { :member => @member }
end
it 'shows unknown location' do
rendered.should contain "unknown location"
end
it "doesn't link anywhere" do
assert_select "a", false
end
end
end