mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-18 13:38:24 -04:00
Added a partial to display a member's location.
This commit is contained in:
@@ -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) {
|
||||
|
||||
5
app/views/members/_location.html.haml
Normal file
5
app/views/members/_location.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
.member-location
|
||||
- if member.location.blank?
|
||||
unknown location
|
||||
- else
|
||||
= link_to member.location, place_path(:place => member.location)
|
||||
35
spec/views/members/_location.html.haml_spec.rb
Normal file
35
spec/views/members/_location.html.haml_spec.rb
Normal 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
|
||||
Reference in New Issue
Block a user