Commit 2271f9cb authored by Martin Markech's avatar Martin Markech
Browse files

no restfull pagination, because when using url_for to render submenu, it...

no restfull pagination, because when using url_for to render submenu, it appends page/:page to all links
parent 5fac36d3
## 0.1.0 [21 September 2012]
* support for fancybox 1.3 or 2
* auto photo orientation
* drop collection thumbnail version
* support for old fancybox v1.3
* auto photo orientation, by default
* added admin tab to pages, enable attach photo album to page
* added fragment caching for photos on frontend
* added ajaxified pagination with history.pushState for photos on frontend
......
module Refinery
module PhotoGallery
class AlbumsController < ::ApplicationController
include PhotoGalleryHelper, AlbumsHelper
helper :'refinery/photo_gallery/photo_gallery'
def show
@collections = Collection.has_albums
@albums = Album.with_collection_id
@album = Album.find(params[:id])
@photos = Photo.where("album_id = ? ", params[:id]).paginate(:page => params[:page]).order("id ASC")
respond_to do |format|
format.html
format.js { render :partial => "refinery/photo_gallery/albums/photos" }
end
end
end
end
end
<% cache "refinery/photo_gallery/albums/#{@page.album.id}/page/#{params[:page]}" do %>
<% photos_for_page = @page.photos_for_page(params[:page]) %>
<%= will_paginate photos_for_page %>
<%= will_paginate photos_for_page %>
<ul id="gallery" class="clearfix">
<% photos_for_page.each_with_index do |photo, index| %>
......@@ -16,5 +16,5 @@
<% end %>
</ul>
<%= will_paginate photos_for_page %>
<%= will_paginate photos_for_page %>
<% end %>
Refinery::Core::Engine.routes.draw do
# To have unique url adress in Google
get "*path/page/1" => redirect("/%{path}")
get "*path/page/:page" => "pages#show", :as => :page, :constraints => {:page => /[1-9]+/} # 1-9 because I want will_paginate render page/1 link for XHR, but I dont want page/1 for non-XHR
namespace "photo_gallery", :path => '' do
namespace :admin, :path => 'refinery' do
scope :path => 'photo-gallery' do
......
......@@ -20,7 +20,7 @@ module Refinery
#TODO or per album?
self.delete_uploaded_file = true
#self.collection_dimensions = [200, 200]
self.album_dimensions = [140, 140]
self.album_dimensions = [140, 105]
self.preview_dimensions = [210, 210]
self.single_dimensions = [900, 900]
......
module Refinery
module PhotoGallery
module Extensions
......@@ -9,6 +10,7 @@ module Refinery
def wrap_show_action
# this is only for fragment caching to create 1 cache file version for first page
params[:page].blank? ? params[:page] = 1 : params[:page]
if request.xhr?
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment