diff --git a/app/controllers/photos.rb b/app/controllers/photos.rb
index 754c82b..e3b560a 100644
--- a/app/controllers/photos.rb
+++ b/app/controllers/photos.rb
@@ -7,8 +7,8 @@ class Photos < Application
def index
@page = params[:page].to_i
per_page = 24
- @page_count = (Photo.count(:id).to_f / per_page.to_f).ceil
- @photos = Photo.find :all, :order => 'id DESC', :limit => per_page, :offset => (per_page * @page)
+ @page_count = (Photo.count(:id, :conditions => 'facebook_id IS NULL').to_f / per_page.to_f).ceil
+ @photos = Photo.find :all, :order => 'id DESC', :limit => per_page, :offset => (per_page * @page), :conditions => 'facebook_id IS NULL'
if request.xhr?
partial 'photos/photo_browser'
else
@@ -90,12 +90,8 @@ class Photos < Application
end
def by_hash
- @photo_ids = Photo.find(:all, :select => 'id', :conditions => [ 'email_hash = ?', params[:id] ]).collect { |p| p.id } rescue []
- @page = params[:page].to_i
- per_page = 4
- @photos = Photo.find :all, :conditions => "id IN (#{@photo_ids.join(',')})", :limit => per_page, :offset => (@page * per_page) rescue []
+ @photo_ids = Photo.find(:all, :select => 'id', :conditions => [ 'email_hash = ?', params[:id] ]).collect(&:id) rescue []
@votes = Vote.find :all, :conditions => "photo_id IN (#{@photo_ids.join(',')})" rescue []
- @page_count = (@photo_ids.size.to_f / per_page.to_f).ceil
if params[:id].to_s.empty? or @photo_ids.empty? or @votes.empty?
redirect url(:action => :by_email)
else
diff --git a/app/views/photos/_stats_for_email_hash.html.haml b/app/views/photos/_stats_for_email_hash.html.haml
deleted file mode 100644
index 98cd613..0000000
--- a/app/views/photos/_stats_for_email_hash.html.haml
+++ /dev/null
@@ -1,25 +0,0 @@
-- dim = 100
-#inner_scrolling_photo_block{ :style => (request.xhr? ? 'display: none;' : '') }
- %table{ :cellspacing => 0, :cellpadding => 0 }
- %tr
- %td{ :style => "width: 140px; height: 150px;" }
- - if @photos[0]
- %a{ :href => url(:photo, @photos[0]), :onclick => 'window.open(this.href);return false;' }
- %img{ :src => photo_url(@photos[0], dim, dim) }
- %p== #{@photos[0].one_votes.to_i} / #{@photos[0].oneness}%
- %td{ :style => "width: 140px; height: 150px;" }
- - if @photos[1]
- %a{ :href => url(:photo, @photos[1]), :onclick => 'window.open(this.href);return false;' }
- %img{ :src => photo_url(@photos[1], dim, dim) }
- %p== #{@photos[1].one_votes.to_i} / #{@photos[1].oneness}%
- %tr
- %td{ :style => "width: 140px; height: 150px;" }
- - if @photos[2]
- %a{ :href => url(:photo, @photos[2]), :onclick => 'window.open(this.href);return false;' }
- %img{ :src => photo_url(@photos[2], dim, dim) }
- %p== #{@photos[2].one_votes.to_i} / #{@photos[2].oneness}%
- %td{ :style => "width: 140px; height: 150px;" }
- - if @photos[3]
- %a{ :href => url(:photo, @photos[3]), :onclick => 'window.open(this.href);return false;' }
- %img{ :src => photo_url(@photos[3], dim, dim) }
- %p== #{@photos[3].one_votes.to_i} / #{@photos[3].oneness}%
diff --git a/app/views/photos/by_hash.html.haml b/app/views/photos/by_hash.html.haml
index 38ff655..709e5aa 100644
--- a/app/views/photos/by_hash.html.haml
+++ b/app/views/photos/by_hash.html.haml
@@ -1,11 +1,6 @@
-#scrolling_photo_block_container
- = pagination 'scrolling_photo_block', url(:controller => :photos, :action => :by_hash, :id => params[:id])
- #scrolling_photo_block
- = partial 'photos/stats_for_email_hash'
-
%h1== Stats for your photos
-%div.user_stat_chart
+%div.centered{ :style => 'width: 415px' }
= stat_chart
%br{ :style => 'clear: both' }