get pagination back online

This commit is contained in:
Kyle Drake 2013-07-14 02:58:51 -04:00
parent 841ad3e44d
commit f112146257
3 changed files with 18 additions and 1 deletions

2
app.rb
View file

@ -36,7 +36,7 @@ end
get '/browse' do
@current_page = params[:current_page] || 1
@current_page = @current_page.to_i
site_dataset = Site.order(:updated_at.desc, :hits.desc).filter(is_banned: false).filter(site_changed: true).paginate(@current_page, 201)
site_dataset = Site.order(:updated_at.desc, :hits.desc).filter(is_banned: false).filter(site_changed: true).paginate(@current_page, 400)
site_dataset.filter! is_nsfw: (!params[:is_nsfw].nil? ? true : false)

View file

@ -8,4 +8,20 @@
</li>
<% end %>
</ul>
<% if @page_count > 1 %>
<div style="font-size: 30pt">
<% if @current_page != 1 %>
<a href="/browse?current_page=<%= @current_page - 1 %>"><i class="icon-arrow-left" style="text-decoration: none"></i></a>&nbsp;
<% end %>
<% 1.upto(@page_count) do |num| %>
<a href="/browse?current_page=<%= num %>" style="<%= "text-decoration: none" if num == @current_page %>"><%= num %></a>&nbsp;
<% end %>
<% if @current_page != @page_count %>
<a href="/browse?current_page=<%= @current_page + 1 %>"><i class="icon-arrow-right" style="text-decoration: none"></i></a>
<% end %>
</div>
<% end %>
</div> <!-- end .content -->

View file

@ -24,6 +24,7 @@
<!-- Styles -->
<link href="assets/css/neo.min.css" rel="stylesheet" type="text/css" media="all"/>
<link href="/css/font-awesome.min.css" rel="stylesheet" type="text/css" media="all"/>
<!-- If exists, brings over style blocks from child pages -->
<link rel="shortcut icon" type="image/ico" href="#favicon.ico" />