added helpers for photo show page
This commit is contained in:
parent
a5f359ef1b
commit
6f7f82e818
2 changed files with 21 additions and 7 deletions
14
app/helpers/photos_helper.rb
Normal file
14
app/helpers/photos_helper.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
module PhotosHelper
|
||||
|
||||
def linked_scaled_photo(photo, album)
|
||||
link_to (image_tag photo.image.url(:scaled_full)), photo_path(album.next_photo(photo))
|
||||
end
|
||||
|
||||
def link_to_prev(photo, album)
|
||||
link_to "<< previous", photo_path(album.prev_photo(photo))
|
||||
end
|
||||
|
||||
def link_to_next(photo, album)
|
||||
link_to "next >>", photo_path(album.next_photo(photo))
|
||||
end
|
||||
end
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
%h3
|
||||
viewing photos from album
|
||||
= link_to @album.name, album_path(@album)
|
||||
|
|
@ -6,18 +5,19 @@
|
|||
%div{:id => @photo.id}
|
||||
|
||||
= link_to "full size", @photo.image.url
|
||||
%br
|
||||
|
||||
#show_photo
|
||||
= link_to (image_tag @photo.image.url(:scaled_full)), photo_path(@album.next_photo(@photo))
|
||||
= linked_scaled_photo @photo, @album
|
||||
|
||||
#photo_pagination
|
||||
= link_to "<< previous", photo_path(@album.prev_photo(@photo))
|
||||
= link_to "next >>", photo_path(@album.next_photo(@photo))
|
||||
= link_to_prev @photo, @album
|
||||
|
|
||||
= link_to_next @photo, @album
|
||||
|
||||
%p
|
||||
= link_to "Destroy", @photo, :confirm => 'Are you sure?', :method => :delete
|
||||
|
|
||||
|
||||
%p
|
||||
= link_to "<< back to album", album_path(@album)
|
||||
|
||||
%h4{:class => "show_post_comments"}
|
||||
|
|
|
|||
Loading…
Reference in a new issue