From 1fab39a6e2765d1f68d2d1f156ae9db6a544a399 Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Sun, 18 Oct 2015 14:15:19 +0100 Subject: [PATCH] Factorised default branding --- no_light_sinatra.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/no_light_sinatra.rb b/no_light_sinatra.rb index 3465f1f..fd48bf2 100644 --- a/no_light_sinatra.rb +++ b/no_light_sinatra.rb @@ -9,6 +9,8 @@ class NoLightSinatra < Sinatra::Base 'test' => { 'uri' => 'mongodb://localhost/no_light_test' }, 'production' => { 'uri' => ENV['MONGODB_URI'] } } + + DEFAULT_BRANDING = 'dell' MongoMapper.setup(environments, ENV['RACK_ENV']) end @@ -34,7 +36,7 @@ class NoLightSinatra < Sinatra::Base end end - get '/:hackathon' do show_editor end + get '/:hackathon' do show_editor(DEFAULT_BRANDING) end get '/:hackathon/:branding' do show_editor(params[:branding]) end private @@ -51,7 +53,7 @@ def show_submitted erb :submitted end - def show_editor(custom_branding = 'dell') + def show_editor(custom_branding) @body_class = ['editor', custom_branding].join(' ') erb :editor end @@ -99,4 +101,4 @@ def set_response_headers response.headers['Content-Transfer-Encoding'] = 'binary' response.headers['Content-Length'] = create_tempfile.size end -end +end \ No newline at end of file