Commit 0065d462 authored by Martin Markech's avatar Martin Markech
Browse files

fix issue #3 by changing around_filter to before_filter. This still isn't best...

fix issue #3 by changing around_filter to before_filter. This still isn't best solution for those, who need custom ajax in PageController#show.
parent a155f0f1
if (history && history.pushState) { if (history && history.pushState) {
function slide_to(target){ function slide_to(target){
var scrollToPosition = $(target).offset().top; var scrollToPosition = $(target).offset().top;
console.log(scrollToPosition);
$("html,body").animate({ 'scrollTop': scrollToPosition }, 600, function(){ $("html,body").animate({ 'scrollTop': scrollToPosition }, 600, function(){
//window.location.hash = "" + target; //window.location.hash = "" + target;
...@@ -13,7 +13,6 @@ if (history && history.pushState) { ...@@ -13,7 +13,6 @@ if (history && history.pushState) {
} }
$(document).ready(function(){ $(document).ready(function(){
$('#photo_gallery').on("click", ".pagination a[href]", function() { $('#photo_gallery').on("click", ".pagination a[href]", function() {
slide_to($('#photo_gallery')); slide_to($('#photo_gallery'));
$.getScript(this.href); $.getScript(this.href);
......
module Refinery module Refinery
module PhotoGallery module PhotoGallery
module Extensions module Extensions
...@@ -6,10 +5,10 @@ module Refinery ...@@ -6,10 +5,10 @@ module Refinery
def self.included(base) def self.included(base)
base.class_eval do base.class_eval do
around_filter :wrap_show_action, :only => :show before_filter :ajax_photo_gallery, :only => :show
def wrap_show_action def ajax_photo_gallery
# this is only for fragment caching to create 1 cache file version for first page # this is only for fragment caching to create 1 cache file version for first page
params[:page].blank? ? params[:page] = 1 : params[:page] params[:page].blank? ? params[:page] = 1 : params[:page]
...@@ -17,8 +16,6 @@ module Refinery ...@@ -17,8 +16,6 @@ module Refinery
respond_to do |format| respond_to do |format|
format.js { render :partial=> "/refinery/photo_gallery/albums/photos"} format.js { render :partial=> "/refinery/photo_gallery/albums/photos"}
end end
else
show
end end
end end
......
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