summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--javascripts/dashing.coffee6
-rw-r--r--lib/dashing/app.rb12
-rw-r--r--smashing.gemspec2
-rw-r--r--templates/project/dashboards/layout.erb4
4 files changed, 16 insertions, 8 deletions
diff --git a/javascripts/dashing.coffee b/javascripts/dashing.coffee
index 20a9987..a85d595 100644
--- a/javascripts/dashing.coffee
+++ b/javascripts/dashing.coffee
@@ -57,16 +57,22 @@ class Dashing.Widget extends Batman.View
# In case the events from the server came before the widget was rendered
lastData = Dashing.lastEvents[@id]
if lastData
+ lastData = @select(lastData)
@mixin(lastData)
@onData(lastData)
receiveData: (data) =>
+ data = @select(data)
@mixin(data)
@onData(data)
onData: (data) =>
# Widgets override this to handle incoming data
+ select: (data) =>
+ # Widgets override this to transform data before it is applied to the model
+ return data
+
Dashing.AnimatedValue =
get: Batman.Property.defaultAccessor.get
set: (k, to) ->
diff --git a/lib/dashing/app.rb b/lib/dashing/app.rb
index 7f8a745..53ee0dc 100644
--- a/lib/dashing/app.rb
+++ b/lib/dashing/app.rb
@@ -34,16 +34,18 @@ set :root, Dir.pwd
set :sprockets, Sprockets::Environment.new(settings.root)
set :assets_prefix, '/assets'
set :digest_assets, false
-set server: 'thin', connections: [], history_file: 'history.yml'
+set :server, 'thin'
+set :connections, []
+set :history_file, 'history.yml'
set :public_folder, File.join(settings.root, 'public')
set :views, File.join(settings.root, 'dashboards')
set :default_dashboard, nil
set :auth_token, nil
if File.exists?(settings.history_file)
- set history: YAML.load_file(settings.history_file)
+ set :history, YAML.load_file(settings.history_file)
else
- set history: {}
+ set :history, {}
end
%w(javascripts stylesheets fonts images).each do |path|
@@ -55,7 +57,7 @@ end
end
not_found do
- send_file File.join(settings.public_folder, '404.html'), status: 404
+ send_file File.join(settings.public_folder, '404.html'), :status => 404
end
at_exit do
@@ -70,7 +72,7 @@ get '/' do
redirect "/" + dashboard
end
-get '/events', provides: 'text/event-stream' do
+get '/events', :provides => 'text/event-stream' do
protected!
response.headers['X-Accel-Buffering'] = 'no' # Disable buffering for nginx
stream :keep_open do |out|
diff --git a/smashing.gemspec b/smashing.gemspec
index c8f1cb2..4f1fbd6 100644
--- a/smashing.gemspec
+++ b/smashing.gemspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.add_dependency('sinatra', '~> 1.4.4')
s.add_dependency('sinatra-contrib', '~> 1.4.2')
s.add_dependency('thin', '~> 1.6.1')
- s.add_dependency('rufus-scheduler', '~> 2.0.24')
+ s.add_dependency('rufus-scheduler', '~> 3.2.0')
s.add_dependency('thor', '~> 0.19')
s.add_dependency('sprockets', '~> 2.10.1')
s.add_dependency('rack', '~> 1.5.4')
diff --git a/templates/project/dashboards/layout.erb b/templates/project/dashboards/layout.erb
index eae9785..a578f0c 100644
--- a/templates/project/dashboards/layout.erb
+++ b/templates/project/dashboards/layout.erb
@@ -13,7 +13,7 @@
<link rel="stylesheet" href="/assets/application.css">
<link href='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
- <link rel="icon" href="/assets/favicon.ico">
+ <link rel="icon" href="/public/favicon.ico">
</head>
<body>
@@ -29,4 +29,4 @@
<a href="#saving-instructions" id="save-gridster">Save this layout</a>
<% end %>
</body>
-</html> \ No newline at end of file
+</html>