summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Beauchamp <daniel.beauchamp@shopify.com>2013-02-13 21:32:34 -0500
committerDaniel Beauchamp <daniel.beauchamp@shopify.com>2013-02-13 21:32:34 -0500
commit6dcda5d7cd26514cac1b18438af7913105e68f00 (patch)
tree0a3a4761aeb4629cdb9b00e999c8d11f1b4ad09b /lib
parent7a064c4193a2590527b1848adc56fc9d340c7851 (diff)
Added the public directory for serving static assets. This allows for stuff like favicons and custom 404/500 pages.
Diffstat (limited to 'lib')
-rw-r--r--lib/dashing.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/dashing.rb b/lib/dashing.rb
index 04e4cee..bae4c29 100644
--- a/lib/dashing.rb
+++ b/lib/dashing.rb
@@ -49,7 +49,11 @@ end
get '/:dashboard' do
protected!
- erb params[:dashboard].to_sym
+ if File.exist? File.join(settings.views, "#{params[:dashboard]}.erb")
+ erb params[:dashboard].to_sym
+ else
+ halt 404
+ end
end
get '/views/:widget?.html' do
@@ -71,6 +75,10 @@ post '/widgets/:id' do
end
end
+not_found do
+ send_file File.join(settings.public_folder, '404.html')
+end
+
def development?
ENV['RACK_ENV'] == 'development'
end