further cleanups to app.rb

This commit is contained in:
Kyle Drake 2014-12-03 08:50:24 -08:00
parent 4cbcc3a5e9
commit 60e6697529
10 changed files with 261 additions and 279 deletions

16
app/surf.rb Normal file
View file

@ -0,0 +1,16 @@
get '/surf/?' do
params.delete 'tag' if params[:tag].nil? || params[:tag].empty?
site_dataset = browse_sites_dataset
site_dataset = site_dataset.paginate @current_page, 1
@page_count = site_dataset.page_count || 1
@site = site_dataset.first
redirect "/browse?#{Rack::Utils.build_query params}" if @site.nil?
erb :'surf', layout: false
end
get '/surf/:username' do |username|
@site = Site.select(:id, :username, :title, :domain, :views, :stripe_customer_id).where(username: username).first
@title = @site.title
not_found if @site.nil?
erb :'surf', layout: false
end