Merge pull request #360 from Skud/crop-images

Crop images
This commit is contained in:
pozorvlak
2014-06-28 20:04:52 +01:00
7 changed files with 45 additions and 18 deletions

View File

@@ -113,7 +113,7 @@ gem 'bootstrap-datepicker-rails'
# For connecting to other services (eg Twitter)
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-flickr'
gem 'omniauth-flickr', '>= 0.0.15'
gem 'rake', '>= 10.0.0'

View File

@@ -180,7 +180,7 @@ GEM
omniauth (1.2.1)
hashie (>= 1.2, < 3)
rack (~> 1.0)
omniauth-flickr (0.0.13)
omniauth-flickr (0.0.15)
omniauth-oauth (~> 1.0)
omniauth-oauth (1.0.1)
oauth
@@ -318,7 +318,7 @@ DEPENDENCIES
memcachier
newrelic_rpm
omniauth
omniauth-flickr
omniauth-flickr (>= 0.0.15)
omniauth-twitter
pg
rack (~> 1.4.5)

View File

@@ -164,6 +164,33 @@ p.stats {
color: @brown;
}
.crop-thumbnail {
position:relative;
padding:0;
img {
width:100%;
}
.text {
display:none;
color:#000;
position:absolute;
bottom:0;
background:rgba(0, 0, 0, 0.8);
width:100%;
margin:0;
}
p {
padding:5px;
margin:0;
color:#fff;
}
&:hover {
.text {
display:block;
}
}
}
// Overrides applying only to mobile view
@media only screen and (max-width: 767px) {

View File

@@ -143,8 +143,8 @@ class Member < ActiveRecord::Base
if @flickr.nil?
flickr_auth = auth('flickr')
if flickr_auth
FlickRaw.api_key = ENV['FLICKR_KEY']
FlickRaw.shared_secret = ENV['FLICKR_SECRET']
FlickRaw.api_key = ENV['GROWSTUFF_FLICKR_KEY']
FlickRaw.shared_secret = ENV['GROWSTUFF_FLICKR_SECRET']
@flickr = FlickRaw::Flickr.new
@flickr.access_token = flickr_auth.token
@flickr.access_secret = flickr_auth.secret

View File

@@ -1,6 +1,6 @@
.row-fluid
- if !crop.photos.empty?
%ul.thumbnails
- crop.photos.first(4).each do |p|
%li.span2
- crop.photos.first(3).each do |p|
%li.span4
= render :partial => "photos/thumbnail", :locals => { :photo => p }

View File

@@ -1,9 +1,10 @@
.thumbnail(style='height: 220px')
.thumbnail.crop-thumbnail
= link_to image_tag(photo.thumbnail_url, :alt => photo.title, :class => 'img-rounded'), photo
%p
= link_to photo.title, photo
%br/
%small
%i
by
= link_to photo.owner, photo.owner
.text
%p
= link_to photo.title, photo
%br/
%small
%i
by
= link_to photo.owner, photo.owner

View File

@@ -15,13 +15,12 @@ describe "crops/show" do
@photo1 = FactoryGirl.create(:photo)
@photo2 = FactoryGirl.create(:photo)
@photo3 = FactoryGirl.create(:photo)
@photo4 = FactoryGirl.create(:photo)
@planting.photos << [@photo1, @photo2, @photo3, @photo4]
@planting.photos << [@photo1, @photo2, @photo3]
render
end
it 'shows 4 photos across the top of the page' do
assert_select "div.thumbnail>a>img", :count => 4
assert_select "div.thumbnail>a>img", :count => 3
end
it 'links to the photo detail page' do