Fixed the coffee/javscript breakage

This commit is contained in:
Payton Quackenbush 2013-06-23 22:16:04 -05:00
parent 41e2091e64
commit 1b10eac01e
9 changed files with 600 additions and 70 deletions

View File

@ -0,0 +1,350 @@
Dashing.Clock = (function(_super) {
__extends(Clock, _super);
function Clock() {
this.startTime = __bind(this.startTime, this);
return Clock.__super__.constructor.apply(this, arguments);
}
Clock.prototype.ready = function() {
return setInterval(this.startTime, 500);
};
Clock.prototype.startTime = function() {
var h, m, s, today;
today = new Date();
h = today.getHours();
m = today.getMinutes();
s = today.getSeconds();
m = this.formatTime(m);
s = this.formatTime(s);
this.set('time', h + ":" + m + ":" + s);
return this.set('date', today.toDateString());
};
Clock.prototype.formatTime = function(i) {
if (i < 10) {
return "0" + i;
} else {
return i;
}
};
return Clock;
})(Dashing.Widget);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Dashing.Comments = (function(_super) {
__extends(Comments, _super);
function Comments() {
this.nextComment = __bind(this.nextComment, this);
return Comments.__super__.constructor.apply(this, arguments);
}
Comments.accessor('quote', function() {
var _ref;
return "“" + ((_ref = this.get('current_comment')) != null ? _ref.body : void 0) + "”";
});
Comments.prototype.ready = function() {
this.currentIndex = 0;
this.commentElem = $(this.node).find('.comment-container');
this.nextComment();
return this.startCarousel();
};
Comments.prototype.onData = function(data) {
return this.currentIndex = 0;
};
Comments.prototype.startCarousel = function() {
return setInterval(this.nextComment, 8000);
};
Comments.prototype.nextComment = function() {
var comments,
_this = this;
comments = this.get('comments');
if (comments) {
return this.commentElem.fadeOut(function() {
_this.currentIndex = (_this.currentIndex + 1) % comments.length;
_this.set('current_comment', comments[_this.currentIndex]);
return _this.commentElem.fadeIn();
});
}
};
return Comments;
})(Dashing.Widget);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Dashing.Graph = (function(_super) {
__extends(Graph, _super);
function Graph() {
return Graph.__super__.constructor.apply(this, arguments);
}
Graph.accessor('current', function() {
var points;
if (this.get('displayedValue')) {
return this.get('displayedValue');
}
points = this.get('points');
if (points) {
return points[points.length - 1].y;
}
});
Graph.prototype.ready = function() {
var container, height, width, x_axis, y_axis;
container = $(this.node).parent();
width = (Dashing.widget_base_dimensions[0] * container.data("sizex")) + Dashing.widget_margins[0] * 2 * (container.data("sizex") - 1);
height = Dashing.widget_base_dimensions[1] * container.data("sizey");
this.graph = new Rickshaw.Graph({
element: this.node,
width: width,
height: height,
series: [
{
color: "#fff",
data: [
{
x: 0,
y: 0
}
]
}
]
});
if (this.get('points')) {
this.graph.series[0].data = this.get('points');
}
x_axis = new Rickshaw.Graph.Axis.Time({
graph: this.graph
});
y_axis = new Rickshaw.Graph.Axis.Y({
graph: this.graph,
tickFormat: Rickshaw.Fixtures.Number.formatKMBT
});
return this.graph.render();
};
Graph.prototype.onData = function(data) {
if (this.graph) {
this.graph.series[0].data = data.points;
return this.graph.render();
}
};
return Graph;
})(Dashing.Widget);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Dashing.Iframe = (function(_super) {
__extends(Iframe, _super);
function Iframe() {
return Iframe.__super__.constructor.apply(this, arguments);
}
Iframe.prototype.ready = function() {};
Iframe.prototype.onData = function(data) {};
return Iframe;
})(Dashing.Widget);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Dashing.Image = (function(_super) {
__extends(Image, _super);
function Image() {
return Image.__super__.constructor.apply(this, arguments);
}
Image.prototype.ready = function() {};
Image.prototype.onData = function(data) {};
return Image;
})(Dashing.Widget);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Dashing.List = (function(_super) {
__extends(List, _super);
function List() {
return List.__super__.constructor.apply(this, arguments);
}
List.prototype.ready = function() {
if (this.get('unordered')) {
return $(this.node).find('ol').remove();
} else {
return $(this.node).find('ul').remove();
}
};
return List;
})(Dashing.Widget);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Dashing.Meter = (function(_super) {
__extends(Meter, _super);
Meter.accessor('value', Dashing.AnimatedValue);
function Meter() {
Meter.__super__.constructor.apply(this, arguments);
this.observe('value', function(value) {
return $(this.node).find(".meter").val(value).trigger('change');
});
}
Meter.prototype.ready = function() {
var meter;
meter = $(this.node).find(".meter");
meter.attr("data-bgcolor", meter.css("background-color"));
meter.attr("data-fgcolor", meter.css("color"));
return meter.knob();
};
return Meter;
})(Dashing.Widget);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Dashing.Number = (function(_super) {
__extends(Number, _super);
function Number() {
return Number.__super__.constructor.apply(this, arguments);
}
Number.accessor('current', Dashing.AnimatedValue);
Number.accessor('difference', function() {
var current, diff, last;
if (this.get('last')) {
last = parseInt(this.get('last'));
current = parseInt(this.get('current'));
if (last !== 0) {
diff = Math.abs(Math.round((current - last) / last * 100));
return "" + diff + "%";
}
} else {
return "";
}
});
Number.accessor('arrow', function() {
if (this.get('last')) {
if (parseInt(this.get('current')) > parseInt(this.get('last'))) {
return 'icon-arrow-up';
} else {
return 'icon-arrow-down';
}
}
});
Number.accessor('needsAttention', function() {
return this.get('status') === 'warning' || this.get('status') === 'danger';
});
Number.prototype.onData = function(data) {
if (data.status) {
return $(this.get('node')).addClass("status-" + data.status);
}
};
return Number;
})(Dashing.Widget);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Dashing.Text = (function(_super) {
__extends(Text, _super);
function Text() {
return Text.__super__.constructor.apply(this, arguments);
}
return Text;
})(Dashing.Widget);
}).call(this);
(function() {
console.log("Yeah! The dashboard has started!");
Dashing.on('ready', function() {
var contentWidth;
Dashing.widget_margins || (Dashing.widget_margins = [5, 5]);
Dashing.widget_base_dimensions || (Dashing.widget_base_dimensions = [300, 360]);
Dashing.numColumns || (Dashing.numColumns = 4);
contentWidth = (Dashing.widget_base_dimensions[0] + Dashing.widget_margins[0] * 2) * Dashing.numColumns;
return Batman.setImmediate(function() {
$('.gridster').width(contentWidth);
return $('.gridster ul:first').gridster({
widget_margins: Dashing.widget_margins,
widget_base_dimensions: Dashing.widget_base_dimensions,
avoid_overlapped_widgets: !Dashing.customGridsterLayout,
draggable: {
stop: Dashing.showGridsterInstructions
}
});
});
});
}).call(this);

View File

@ -14554,8 +14554,8 @@ Math.tan(e=a*fh),g):e/fh},g.origin=function(a){return arguments.length?(c=a[0]*f
*
* @method add_widget
* @param {String} html The string representing the HTML of the widget.
* @param {Number} size_x The nº of rows the widget occupies horizontally.
* @param {Number} size_y The nº of columns the widget occupies vertically.
* @param {Number} size_x The no of rows the widget occupies horizontally.
* @param {Number} size_y The no of columns the widget occupies vertically.
* @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing.
* the widget that was just created.
*/
@ -14583,8 +14583,8 @@ Math.tan(e=a*fh),g):e/fh},g.origin=function(a){return arguments.length?(c=a[0]*f
* Get the most left column below to add a new widget.
*
* @method next_position
* @param {Number} size_x The nº of rows the widget occupies horizontally.
* @param {Number} size_y The nº of columns the widget occupies vertically.
* @param {Number} size_x The no of rows the widget occupies horizontally.
* @param {Number} size_y The no of columns the widget occupies vertically.
* @return {Object} Returns a grid coords object representing the future
* widget coords.
*/

File diff suppressed because one or more lines are too long

View File

@ -12364,4 +12364,4 @@
}).call(this);
}).call(this);

File diff suppressed because one or more lines are too long

View File

@ -4,58 +4,59 @@
#= require batman.jquery
Batman.Filters.prettyNumber = (num) ->
num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") unless isNaN(num)
#Batman.Filters.prettyNumber = (num) ->
# num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") unless isNaN(num)
#
#Batman.Filters.dashize = (str) ->
# dashes_rx1 = /([A-Z]+)([A-Z][a-z])/g;
# dashes_rx2 = /([a-z\d])([A-Z])/g;
#
# return str.replace(dashes_rx1, '$1_$2').replace(dashes_rx2, '$1_$2').replace('_', '-').toLowerCase()
#
#Batman.Filters.shortenedNumber = (num) ->
# return num if isNaN(num)
# if num >= 1000000000
# (num / 1000000000).toFixed(1) + 'B'
# else if num >= 1000000
# (num / 1000000).toFixed(1) + 'M'
# else if num >= 1000
# (num / 1000).toFixed(1) + 'K'
# else
# num
Batman.Filters.dashize = (str) ->
dashes_rx1 = /([A-Z]+)([A-Z][a-z])/g;
dashes_rx2 = /([a-z\d])([A-Z])/g;
return str.replace(dashes_rx1, '$1_$2').replace(dashes_rx2, '$1_$2').replace('_', '-').toLowerCase()
Batman.Filters.shortenedNumber = (num) ->
return num if isNaN(num)
if num >= 1000000000
(num / 1000000000).toFixed(1) + 'B'
else if num >= 1000000
(num / 1000000).toFixed(1) + 'M'
else if num >= 1000
(num / 1000).toFixed(1) + 'K'
else
num
class window.Dashing extends Batman.App
@root ->
Dashing.params = Batman.URI.paramsFromQuery(window.location.search.slice(1));
class Dashing.Widget extends Batman.View
constructor: ->
# Set the view path
@constructor::source = Batman.Filters.underscore(@constructor.name)
super
@mixin($(@node).data())
Dashing.widgets[@id] ||= []
Dashing.widgets[@id].push(@)
@mixin(Dashing.lastEvents[@id]) # in case the events from the server came before the widget was rendered
type = Batman.Filters.dashize(@view)
$(@node).addClass("widget widget-#{type} #{@id}")
@accessor 'updatedAtMessage', ->
if updatedAt = @get('updatedAt')
timestamp = updatedAt.toString().match(/\d*:\d*/)[0]
"Last updated at #{timestamp}"
@::on 'ready', ->
Dashing.Widget.fire 'ready'
receiveData: (data) =>
@mixin(data)
@onData(data)
onData: (data) =>
# Widgets override this to handle incoming data
#class window.Dashing extends Batman.App
# @root ->
#Dashing.params = Batman.URI.paramsFromQuery(window.location.search.slice(1));
#
#class Dashing.Widget extends Batman.View
# constructor: ->
# # Set the view path
# @constructor::source = Batman.Filters.underscore(@constructor.name)
# super
#
# @mixin($(@node).data())
# Dashing.widgets[@id] ||= []
# Dashing.widgets[@id].push(@)
# @mixin(Dashing.lastEvents[@id]) # in case the events from the server came before the widget was rendered
#
# type = Batman.Filters.dashize(@view)
# $(@node).addClass("widget widget-#{type} #{@id}")
#
# @accessor 'updatedAtMessage', ->
# if updatedAt = @get('updatedAt')
# timestamp = updatedAt.toString().match(/\d*:\d*/)[0]
# "Last updated at #{timestamp}"
#
# @::on 'ready', ->
# Dashing.Widget.fire 'ready'
#
# receiveData: (data) =>
# @mixin(data)
# @onData(data)
#
# onData: (data) =>
# # Widgets override this to handle incoming data
#
Dashing.AnimatedValue =
get: Batman.Property.defaultAccessor.get

View File

@ -827,8 +827,8 @@
*
* @method add_widget
* @param {String} html The string representing the HTML of the widget.
* @param {Number} size_x The nº of rows the widget occupies horizontally.
* @param {Number} size_y The nº of columns the widget occupies vertically.
* @param {Number} size_x The no of rows the widget occupies horizontally.
* @param {Number} size_y The no of columns the widget occupies vertically.
* @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing.
* the widget that was just created.
*/
@ -856,8 +856,8 @@
* Get the most left column below to add a new widget.
*
* @method next_position
* @param {Number} size_x The nº of rows the widget occupies horizontally.
* @param {Number} size_y The nº of columns the widget occupies vertically.
* @param {Number} size_x The no of rows the widget occupies horizontally.
* @param {Number} size_y The no of columns the widget occupies vertically.
* @return {Object} Returns a grid coords object representing the future
* widget coords.
*/
@ -2887,4 +2887,4 @@
};
}(jQuery, window, document));
}(jQuery, window, document));

File diff suppressed because one or more lines are too long

View File

@ -15,23 +15,29 @@ def javascripts():
'assets/javascripts/jquery.js',
'assets/javascripts/es5-shim.js',
'assets/javascripts/d3.v2.min.js',
'assets/javascripts/batman.js',
'assets/javascripts/batman.jquery.js',
'assets/javascripts/jquery.gridster.js',
'assets/javascripts/jquery.leanModal.min.js',
'assets/javascripts/dashing.coffee',
#'assets/javascripts/dashing.coffee',
'assets/javascripts/dashing.gridster.coffee',
'assets/javascripts/jquery.knob.js',
'assets/javascripts/rickshaw.min.js',
'assets/javascripts/application.coffee',
'assets/javascripts/dashing.gridster.coffee'
#'assets/javascripts/application.coffee',
'assets/javascripts/application.js',
]
nizzle = False
nizzle = True
if not nizzle:
scripts = ['assets/javascripts/application.js']
output = []
for path in scripts:
print path
output.append('// JS: %s\n' % path)
if '.coffee' in path:
print('Compiling Coffee for %s ' % path)
contents = coffeescript.compile_file(path)