Skip to content

Commit

Permalink
Factorised default branding
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilawal Hameed committed Oct 18, 2015
1 parent 36be77c commit 1fab39a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions no_light_sinatra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -99,4 +101,4 @@ def set_response_headers
response.headers['Content-Transfer-Encoding'] = 'binary'
response.headers['Content-Length'] = create_tempfile.size
end
end
end

0 comments on commit 1fab39a

Please sign in to comment.