remove photo browser from stats to match facebook variant
parent
3b4bc95f54
commit
c782437220
|
@ -7,8 +7,8 @@ class Photos < Application
|
||||||
def index
|
def index
|
||||||
@page = params[:page].to_i
|
@page = params[:page].to_i
|
||||||
per_page = 24
|
per_page = 24
|
||||||
@page_count = (Photo.count(:id).to_f / per_page.to_f).ceil
|
@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)
|
@photos = Photo.find :all, :order => 'id DESC', :limit => per_page, :offset => (per_page * @page), :conditions => 'facebook_id IS NULL'
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
partial 'photos/photo_browser'
|
partial 'photos/photo_browser'
|
||||||
else
|
else
|
||||||
|
@ -90,12 +90,8 @@ class Photos < Application
|
||||||
end
|
end
|
||||||
|
|
||||||
def by_hash
|
def by_hash
|
||||||
@photo_ids = Photo.find(:all, :select => 'id', :conditions => [ 'email_hash = ?', params[:id] ]).collect { |p| p.id } rescue []
|
@photo_ids = Photo.find(:all, :select => 'id', :conditions => [ 'email_hash = ?', params[:id] ]).collect(&: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 []
|
|
||||||
@votes = Vote.find :all, :conditions => "photo_id IN (#{@photo_ids.join(',')})" 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?
|
if params[:id].to_s.empty? or @photo_ids.empty? or @votes.empty?
|
||||||
redirect url(:action => :by_email)
|
redirect url(:action => :by_email)
|
||||||
else
|
else
|
||||||
|
|
|
@ -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== <tt>#{@photos[0].one_votes.to_i} / #{@photos[0].oneness}%</tt>
|
|
||||||
%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== <tt>#{@photos[1].one_votes.to_i} / #{@photos[1].oneness}%</tt>
|
|
||||||
%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== <tt>#{@photos[2].one_votes.to_i} / #{@photos[2].oneness}%</tt>
|
|
||||||
%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== <tt>#{@photos[3].one_votes.to_i} / #{@photos[3].oneness}%</tt>
|
|
|
@ -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
|
%h1== Stats for your photos
|
||||||
|
|
||||||
%div.user_stat_chart
|
%div.centered{ :style => 'width: 415px' }
|
||||||
= stat_chart
|
= stat_chart
|
||||||
|
|
||||||
%br{ :style => 'clear: both' }
|
%br{ :style => 'clear: both' }
|
||||||
|
|
Reference in New Issue