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,23 +1,23 @@
|
||||||
|
|
||||||
%h3
|
%h3
|
||||||
viewing photos from album
|
viewing photos from album
|
||||||
=link_to @album.name, album_path(@album)
|
= link_to @album.name, album_path(@album)
|
||||||
|
|
||||||
%div{:id => @photo.id}
|
%div{:id => @photo.id}
|
||||||
|
|
||||||
= link_to "full size", @photo.image.url
|
= link_to "full size", @photo.image.url
|
||||||
%br
|
|
||||||
|
|
||||||
#show_photo
|
#show_photo
|
||||||
= link_to (image_tag @photo.image.url(:scaled_full)), photo_path(@album.next_photo(@photo))
|
= linked_scaled_photo @photo, @album
|
||||||
|
|
||||||
#photo_pagination
|
#photo_pagination
|
||||||
= link_to "<< previous", photo_path(@album.prev_photo(@photo))
|
= link_to_prev @photo, @album
|
||||||
= link_to "next >>", photo_path(@album.next_photo(@photo))
|
|
|
||||||
|
= link_to_next @photo, @album
|
||||||
|
|
||||||
%p
|
%p
|
||||||
= link_to "Destroy", @photo, :confirm => 'Are you sure?', :method => :delete
|
= link_to "Destroy", @photo, :confirm => 'Are you sure?', :method => :delete
|
||||||
|
|
|
||||||
|
%p
|
||||||
= link_to "<< back to album", album_path(@album)
|
= link_to "<< back to album", album_path(@album)
|
||||||
|
|
||||||
%h4{:class => "show_post_comments"}
|
%h4{:class => "show_post_comments"}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue