From 174b98b118db401f08cc540b145a315c42441f90 Mon Sep 17 00:00:00 2001 From: Barbara Natali Date: Wed, 18 Jun 2014 21:54:30 -0700 Subject: [PATCH 1/5] Improve display of images on crop page --- .../bootstrap_and_overrides.css.less | 27 +++++++++++++++++++ app/views/crops/_photos.html.haml | 4 +-- app/views/photos/_thumbnail.html.haml | 17 ++++++------ 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index a0970bd89..0532b24a9 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -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.5); + 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) { diff --git a/app/views/crops/_photos.html.haml b/app/views/crops/_photos.html.haml index 6ff8adb82..864560eb8 100644 --- a/app/views/crops/_photos.html.haml +++ b/app/views/crops/_photos.html.haml @@ -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 } diff --git a/app/views/photos/_thumbnail.html.haml b/app/views/photos/_thumbnail.html.haml index e0526d8cd..ae85df1cd 100644 --- a/app/views/photos/_thumbnail.html.haml +++ b/app/views/photos/_thumbnail.html.haml @@ -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 From d10c9d96f1f7e2e6718c83ca4da5768a1ce95b73 Mon Sep 17 00:00:00 2001 From: Skud Date: Sat, 28 Jun 2014 11:27:26 -0700 Subject: [PATCH 2/5] Fixed whitespace issues and tests --- app/views/photos/_thumbnail.html.haml | 14 +++++++------- spec/views/crops/show.html.haml_spec.rb | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/views/photos/_thumbnail.html.haml b/app/views/photos/_thumbnail.html.haml index ae85df1cd..b6dace133 100644 --- a/app/views/photos/_thumbnail.html.haml +++ b/app/views/photos/_thumbnail.html.haml @@ -1,10 +1,10 @@ .thumbnail.crop-thumbnail = link_to image_tag(photo.thumbnail_url, :alt => photo.title, :class => 'img-rounded'), photo .text - %p - = link_to photo.title, photo - %br/ - %small - %i - by - = link_to photo.owner, photo.owner + %p + = link_to photo.title, photo + %br/ + %small + %i + by + = link_to photo.owner, photo.owner diff --git a/spec/views/crops/show.html.haml_spec.rb b/spec/views/crops/show.html.haml_spec.rb index 4b637cc1d..b530f16c8 100644 --- a/spec/views/crops/show.html.haml_spec.rb +++ b/spec/views/crops/show.html.haml_spec.rb @@ -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 From 343e7963f203a8635999783e730e0647a01b4788 Mon Sep 17 00:00:00 2001 From: Skud Date: Sat, 28 Jun 2014 11:27:45 -0700 Subject: [PATCH 3/5] Use the latest omniauth-flickr Something seems to have chagned in the API (requiring https?) which was breaking things. --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 050142197..38b4a70ce 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 322d6e40a..bd7b668bb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) From 0560172565d3f640bda11622282a3a68dd27ef20 Mon Sep 17 00:00:00 2001 From: Skud Date: Sat, 28 Jun 2014 11:28:21 -0700 Subject: [PATCH 4/5] Fixed incorrect env variable --- app/models/member.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/member.rb b/app/models/member.rb index 1bacddbb6..608b32286 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -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 From 1ac35e7d4ef0fd3954eb99a1c367aea18ac2f1b1 Mon Sep 17 00:00:00 2001 From: Skud Date: Sat, 28 Jun 2014 11:29:51 -0700 Subject: [PATCH 5/5] Darkened text background for readability --- app/assets/stylesheets/bootstrap_and_overrides.css.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index 0532b24a9..bd97a8b81 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -175,7 +175,7 @@ p.stats { color:#000; position:absolute; bottom:0; - background:rgba(0, 0, 0, 0.5); + background:rgba(0, 0, 0, 0.8); width:100%; margin:0; }