mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-09 16:24:32 -04:00
show plantings on photo page
This commit is contained in:
@@ -46,4 +46,8 @@ class Planting < ActiveRecord::Base
|
||||
def planted_at_string=(str)
|
||||
self.planted_at = str == '' ? nil : Time.parse(str)
|
||||
end
|
||||
|
||||
def to_s
|
||||
self.crop_system_name + " in " + self.location
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
= image_tag(@photo.fullsize_url, :alt => 'A plant', :class => 'img-rounded')
|
||||
-content_for :title, @photo.title
|
||||
|
||||
%p
|
||||
= link_to @photo.title, @photo.link_url
|
||||
by
|
||||
= succeed "." do
|
||||
= link_to @photo.owner, @photo.owner
|
||||
License:
|
||||
- if @photo.license_url
|
||||
= succeed "." do
|
||||
= link_to @photo.license_name, @photo.license_url
|
||||
- else
|
||||
= succeed "." do
|
||||
= @photo.license_name
|
||||
.row
|
||||
.span6
|
||||
%p
|
||||
%strong Posted by:
|
||||
= link_to @photo.owner, @photo.owner
|
||||
%p
|
||||
%strong License:
|
||||
- if @photo.license_url
|
||||
= link_to @photo.license_name, @photo.license_url
|
||||
- else
|
||||
= succeed "." do
|
||||
= @photo.license_name
|
||||
%p
|
||||
= link_to "View on Flickr", @photo.link_url
|
||||
|
||||
.span6
|
||||
- if @photo.plantings.count > 0
|
||||
%p This photo depicts:
|
||||
%ul
|
||||
- @photo.plantings.each do |p|
|
||||
%li= link_to p, p
|
||||
|
||||
%p= image_tag(@photo.fullsize_url, :alt => 'A plant', :class => 'img-rounded')
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ describe "photos/show" do
|
||||
:text => @photo.license_name
|
||||
end
|
||||
|
||||
it "shows the title as a link to the original image" do
|
||||
assert_select "a", :href => @photo.link_url, :text => @photo.title
|
||||
it "shows a link to the original image" do
|
||||
assert_select "a", :href => @photo.link_url, :text => "View on Flickr"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,6 +34,21 @@ describe "photos/show" do
|
||||
it "contains the phrase 'All rights reserved'" do
|
||||
rendered.should contain "All rights reserved"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "linked to a planting" do
|
||||
before(:each) do
|
||||
@photo = FactoryGirl.create(:photo)
|
||||
@planting = FactoryGirl.create(:planting)
|
||||
@planting.photos << @photo
|
||||
@photo = assign(:photo, @photo)
|
||||
render
|
||||
end
|
||||
|
||||
it "shows link to planting" do
|
||||
assert_select "a[href=#{planting_path(@planting)}]"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user