Fixes for surf mode pagination conversion

This commit is contained in:
Kyle Drake 2014-12-01 22:19:56 -08:00
parent acb6449e77
commit 17610787ee
3 changed files with 3 additions and 2 deletions

2
app.rb
View file

@ -429,7 +429,7 @@ end
get '/browse/?' do
params.delete 'tag' if params[:tag].nil? || params[:tag].empty?
site_dataset = browse_sites_dataset
site_dataset = site_dataset.paginate @current_page, 300
site_dataset = site_dataset.paginate @current_page, Site::BROWSE_PAGINATION_LENGTH
@page_count = site_dataset.page_count || 1
@sites = site_dataset.all
erb :browse

View file

@ -123,6 +123,7 @@ class Site < Sequel::Model
plan_five: 5
}
BROWSE_PAGINATION_LENGTH = 300
many_to_many :tags

View file

@ -63,7 +63,7 @@
<ul class="row website-Gallery content int-Gall">
<% @sites.each_with_index do |site,i| %>
<li>
<a href="" class="neo-Screen-Shot" title="<%= site.title %>" onclick="surf(<%= i+1 %>); return false">
<a href="" class="neo-Screen-Shot" title="<%= site.title %>" onclick="surf(<%= ((@current_page-1)*Site::BROWSE_PAGINATION_LENGTH)+i+1 %>); return false">
<span class="img-Holder" style="background:url(<%= site.screenshot_url('index.html', '540x405') %>) no-repeat;">
<img src="/img/placeholder.png" alt="<%= site.title %>" />
</span>