Skip to content

Commit

Permalink
fix snippet pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew vonderLuft committed Aug 16, 2010
1 parent 1ea4d99 commit 67a01f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/helpers/application_helper.rb
Expand Up @@ -228,7 +228,9 @@ def pagination_for(list, options={})
depagination_limit = options.delete(:max_per_page) # supply :max_per_page => false to include the 'show all' link no matter how large the collection
html = will_paginate(list, will_paginate_options.merge(options))
if depaginate && list.total_pages > 1 && (!depagination_limit.blank? || list.total_entries <= depagination_limit.to_i)
html << content_tag(:div, link_to("show all", :pp => list.total_entries), :class => 'depaginate')
html.insert(html.index("</div>"), content_tag(:span, link_to("show all", :pp => list.total_entries), :class => 'depaginate', :style=>"padding-left:8px"))
else
html = content_tag(:div, link_to("paginate", :p => 1), :class => 'depaginate', :style=>"padding-left:8px")
end
html
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/snippets/index.html.haml
Expand Up @@ -29,6 +29,6 @@
- render_region :bottom do |bottom|
- bottom.new_button do
#actions
= pagination_for(@snippets)
%ul
%li= link_to image('plus') + " " + t('new_snippet'), new_admin_snippet_url
%li{:style=>"float:right"}= pagination_for(@snippets)

0 comments on commit 67a01f5

Please sign in to comment.