simplifying pagination partials and renaming a few photo browser divs to better reflect a common naming policy

master
Coleman 2008-10-11 18:15:32 -05:00
parent 77775bc753
commit 149f31f5fd
6 changed files with 18 additions and 23 deletions

View File

@ -41,7 +41,7 @@ module Merb
def pagination(div_name, base_url)
@pagination_block = div_name
@base_pagination_url = base_url
partial 'home/pagination_script'
partial 'home/pagination'
end
end
end

View File

@ -1,8 +1,6 @@
%h1 Your favorite photos
= pagination 'photo_browser', url(:favorites, :id => current_user.user_name)
#browser_container.centered
= partial 'home/pagination_navigation'
#photo_browser_container
= pagination 'photo_browser', url(:favorites, :id => current_user.user_name)
#photo_browser
= partial 'photos/photo_browser'

View File

@ -18,3 +18,15 @@
page = newpage;
new Ajax.Updater('#{@pagination_block}', '#{@base_pagination_url}#{@base_pagination_url =~ /\?/ ? '&' : '?'}page=' + page, { method: 'get', onComplete: function(){ new Effect.Appear($('inner_#{@pagination_block}')); }, onSuccess: function(){ $('pagenum').innerHTML = parseInt(page) + 1; } });
}
#pagination_navigation
%p
%a{ :href => '#', :onclick => "scroll_box(0); return false;", :title => 'First page' }
%img{ :src => '/images/go-first.png' }
%a{ :href => '#', :onclick => "scroll_box(page - 1); return false;", :title => 'Previous page' }
%img{ :src => '/images/go-previous.png' }
== <span id="pagenum">#{@page + 1}</span> / #{@page_count}
%a{ :href => '#', :onclick => "scroll_box(page + 1); return false;", :title => 'Next page' }
%img{ :src => '/images/go-next.png' }
%a{ :href => '#', :onclick => "scroll_box(page_count - 1); return false;", :title => 'Next page' }
%img{ :src => '/images/go-last.png' }

View File

@ -1,11 +0,0 @@
#pagination_navigation
%p
%a{ :href => '#', :onclick => "scroll_box(0); return false;", :title => 'First page' }
%img{ :src => '/images/go-first.png' }
%a{ :href => '#', :onclick => "scroll_box(page - 1); return false;", :title => 'Previous page' }
%img{ :src => '/images/go-previous.png' }
== <span id="pagenum">#{@page + 1}</span> / #{@page_count}
%a{ :href => '#', :onclick => "scroll_box(page + 1); return false;", :title => 'Next page' }
%img{ :src => '/images/go-next.png' }
%a{ :href => '#', :onclick => "scroll_box(page_count - 1); return false;", :title => 'Next page' }
%img{ :src => '/images/go-last.png' }

View File

@ -1,8 +1,6 @@
%h1 Photos of oneness
= pagination 'photo_browser', url(:photos)
#browser_container.centered
= partial 'home/pagination_navigation'
#photo_browser_container
= pagination 'photo_browser', url(:photos)
#photo_browser
= partial 'photos/photo_browser'

View File

@ -1,7 +1,5 @@
= pagination 'scrolling_photo_block', url(:vote, :id => @user.user_name)
#scrolling_photo_block_container
= partial 'home/pagination_navigation'
= pagination 'scrolling_photo_block', url(:vote, :id => @user.user_name)
#scrolling_photo_block
= partial 'votes/stats_for_user'