summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/dashing.rb10
-rw-r--r--templates/project/public/404.html26
-rw-r--r--templates/project/public/favicon.ico (renamed from templates/project/assets/images/favicon.ico)bin5430 -> 5430 bytes
3 files changed, 35 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
diff --git a/templates/project/public/404.html b/templates/project/public/404.html
new file mode 100644
index 0000000..1a8f334
--- /dev/null
+++ b/templates/project/public/404.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>This Dashboard doesn't exist.</title>
+ <style>
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/404.html -->
+ <div class="dialog">
+ <h1>Drats! That Dashboard doesn't exist.</h1>
+ <p>You may have mistyped the address or the page may have moved.</p>
+ </div>
+</body>
+</html> \ No newline at end of file
diff --git a/templates/project/assets/images/favicon.ico b/templates/project/public/favicon.ico
index 29a408f..29a408f 100644
--- a/templates/project/assets/images/favicon.ico
+++ b/templates/project/public/favicon.ico
Binary files differ