From 9033e5707417f89bf0334aacd2772e3a53cff78a Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Mon, 8 Jul 2013 21:36:57 -0400 Subject: [PATCH] is_nsfw --- app.rb | 5 ++++- config.yml.template | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app.rb b/app.rb index 507c6a4a..68d50dcf 100644 --- a/app.rb +++ b/app.rb @@ -20,7 +20,10 @@ 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_nsfw: false).filter(is_banned: false).filter(~{updated_at: nil}).paginate(@current_page, 201) + site_dataset = Site.order(:updated_at.desc, :hits.desc).filter(is_banned: false).filter(~{updated_at: nil}).paginate(@current_page, 201) + + site_dataset.filter! is_nsfw: (!params[:is_nsfw].nil? ? true : false) + @page_count = site_dataset.page_count || 1 @sites = site_dataset.all slim :browse diff --git a/config.yml.template b/config.yml.template index c502c93f..09569639 100644 --- a/config.yml.template +++ b/config.yml.template @@ -1,7 +1,8 @@ development: - database: 'postgres://localhost/neocities' + database: 'postgres://neocities@127.0.0.1/neocities' database_pool: 1 - session_secret: SETSOMETHINGHERE - recaptcha_public_key: ddsfsdfsdf - recaptcha_private_key: fsdgfdsdfd - phantomjs_url: http://localhost:40000 + session_secret: SECRET GOES HERE + recaptcha_public_key: ENTER PUBLIC KEY HERE + recaptcha_private_key: ENTER PRIVATE KEY HERE + phantomjs_url: + - http://localhost:8910 \ No newline at end of file