go to image page
This commit is contained in:
parent
ffac07f3bf
commit
c299d46708
@ -9,6 +9,16 @@ class PortfolioImage < ActiveRecord::Base
|
|||||||
|
|
||||||
scope :after, lambda {|time| {:conditions => ["shoot_at > ?", time]}}
|
scope :after, lambda {|time| {:conditions => ["shoot_at > ?", time]}}
|
||||||
|
|
||||||
|
def position(portfolio)
|
||||||
|
portfolio.images.after(self.shoot_at).count+1
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def page(portfolio)
|
||||||
|
per_page = portfolio.content_type || 1
|
||||||
|
(self.position(portfolio)/(per_page*1.0)).ceil
|
||||||
|
end
|
||||||
|
|
||||||
def width
|
def width
|
||||||
self.photo.geometry[:width]
|
self.photo.geometry[:width]
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
-@index_images.each do |img|
|
-@index_images.each do |img|
|
||||||
=link_to image_tag(img.photo.square.url), img.portfolios.first.path
|
=link_to image_tag(img.photo.square.url), portfolio_path(:id => img.portfolios.first.slug, :page => img.page(img.portfolios.first),:position => img.position(img.portfolios.first))
|
||||||
%p{:style => "clear:both;height:2px;"}
|
%p{:style => "clear:both;height:2px;"}
|
||||||
:javascript
|
:javascript
|
||||||
function size_index_images(){
|
function size_index_images(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user