pagination for site profile

This commit is contained in:
Kyle Drake 2014-07-31 17:01:30 -07:00
parent 17119d369c
commit 351b2d7178

11
app.rb
View file

@ -89,7 +89,16 @@ get '/site/:username' do |username|
end end
@title = site.title @title = site.title
@latest_events = site.latest_events
@current_page = params[:current_page]
@current_page = @current_page.to_i
@current_page = 1 if @current_page == 0
latest_events_dataset = site.latest_events(@current_page, 10)
@page_count = latest_events_dataset.page_count || 1
@latest_events = latest_events_dataset.all
erb :'site', locals: {site: site, is_current_site: site == current_site} erb :'site', locals: {site: site, is_current_site: site == current_site}
end end