summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDaniel Beauchamp <daniel.beauchamp@shopify.com>2012-08-08 18:02:56 -0400
committerDaniel Beauchamp <daniel.beauchamp@shopify.com>2012-08-08 18:06:58 -0400
commit780fe49f715c2fced88e958b02541bf8e7dca934 (patch)
tree7cd147e96913c9f95cda54f4bd341d0630e34c66 /templates
parentcdd8ff258582f5eba7e3941a5a18007e7aabbbfa (diff)
Rename project to 'Dashing', and do some other cleanups
Diffstat (limited to 'templates')
-rw-r--r--templates/project/Gemfile2
-rw-r--r--templates/project/README.md1
-rw-r--r--templates/project/config.ru2
-rw-r--r--templates/project/dashboards/layout.erb24
-rw-r--r--templates/project/public/javascripts/jquery.knob.js646
-rw-r--r--templates/project/widgets/list/list.coffee6
-rw-r--r--templates/project/widgets/meter/meter.coffee14
-rw-r--r--templates/project/widgets/number/number.coffee8
-rw-r--r--templates/project/widgets/table/table.coffee2
-rw-r--r--templates/project/widgets/table/table.html8
-rw-r--r--templates/project/widgets/table/table.scss42
-rw-r--r--templates/project/widgets/text/text.coffee3
-rw-r--r--templates/widget/%name%/%name%.coffee.tt5
-rw-r--r--templates/widget/%name%/%name%.html1
14 files changed, 43 insertions, 721 deletions
diff --git a/templates/project/Gemfile b/templates/project/Gemfile
index 66989b6..7724b81 100644
--- a/templates/project/Gemfile
+++ b/templates/project/Gemfile
@@ -1,3 +1,3 @@
source :rubygems
-gem 'allthethings', '0.1.0', :git => 'git@github.com:Shopify/allthethings.git' \ No newline at end of file
+gem 'dashing', '0.1.0', :git => 'git@github.com:Shopify/dashing.git' \ No newline at end of file
diff --git a/templates/project/README.md b/templates/project/README.md
index 32f36ad..e69de29 100644
--- a/templates/project/README.md
+++ b/templates/project/README.md
@@ -1 +0,0 @@
-Here lies instructions on how to set this thing up. \ No newline at end of file
diff --git a/templates/project/config.ru b/templates/project/config.ru
index acc42a0..a3a74de 100644
--- a/templates/project/config.ru
+++ b/templates/project/config.ru
@@ -1,4 +1,4 @@
-require 'allthethings'
+require 'dashing'
configure do
set :auth_token, 'YOUR_AUTH_TOKEN'
diff --git a/templates/project/dashboards/layout.erb b/templates/project/dashboards/layout.erb
index cb1a455..1d1aeb3 100644
--- a/templates/project/dashboards/layout.erb
+++ b/templates/project/dashboards/layout.erb
@@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8"/>
- <title>My Awesome Dashboard</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -17,6 +16,19 @@
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/stylesheets/font-awesome.css">
<link rel="icon" href="/images/favicon.ico">
+
+ <script type="text/javascript">
+ var relayout = function() {
+ $('#container ul').masonry({ itemSelector: '.widget-container' });
+ }
+
+ Dashing.on('ready', function() {
+ setTimeout(relayout, 0);
+ });
+
+ $(window).resize(relayout);
+
+ </script>
</head>
<body>
@@ -24,15 +36,5 @@
<%= yield %>
</div>
- <script type="text/javascript">
- AllTheThings.on('ready', function() {
- setInterval(function(){
- $('#container ul').masonry({
- itemSelector: '.widget-container'
- });
- }, 0);
- });
- </script>
-
</body>
</html> \ No newline at end of file
diff --git a/templates/project/public/javascripts/jquery.knob.js b/templates/project/public/javascripts/jquery.knob.js
index 3224638..0c5b8f1 100644
--- a/templates/project/public/javascripts/jquery.knob.js
+++ b/templates/project/public/javascripts/jquery.knob.js
@@ -12,635 +12,17 @@
*
* Thanks to vor, eskimoblood, spiffistan, FabrizioC
*/
-$(function () {
-
- /**
- * Kontrol library
- */
- "use strict";
-
- /**
- * Definition of globals and core
- */
- var k = {}, // kontrol
- max = Math.max,
- min = Math.min;
-
- k.c = {};
- k.c.d = $(document);
- k.c.t = function (e) {
- return e.originalEvent.touches.length - 1;
- };
-
- /**
- * Kontrol Object
- *
- * Definition of an abstract UI control
- *
- * Each concrete component must call this one.
- * <code>
- * k.o.call(this);
- * </code>
- */
- k.o = function () {
- var s = this;
-
- this.o = null; // array of options
- this.$ = null; // jQuery wrapped element
- this.i = null; // mixed HTMLInputElement or array of HTMLInputElement
- this.g = null; // 2D graphics context for 'pre-rendering'
- this.v = null; // value ; mixed array or integer
- this.cv = null; // change value ; not commited value
- this.x = 0; // canvas x position
- this.y = 0; // canvas y position
- this.$c = null; // jQuery canvas element
- this.c = null; // rendered canvas context
- this.t = 0; // touches index
- this.isInit = false;
- this.fgColor = null; // main color
- this.pColor = null; // previous color
- this.dH = null; // draw hook
- this.cH = null; // change hook
- this.eH = null; // cancel hook
- this.rH = null; // release hook
-
- this.run = function () {
- var cf = function (e, conf) {
- var k;
- for (k in conf) {
- s.o[k] = conf[k];
- }
- s.init();
- s._configure()
- ._draw();
- };
-
- if(this.$.data('kontroled')) return;
- this.$.data('kontroled', true);
-
- this.extend();
- this.o = $.extend(
- {
- // Config
- min : this.$.data('min') || 0,
- max : this.$.data('max') || 100,
- stopper : true,
- readOnly : this.$.data('readonly'),
-
- // UI
- cursor : (this.$.data('cursor') === true && 30)
- || this.$.data('cursor')
- || 0,
- thickness : this.$.data('thickness') || 0.35,
- width : this.$.data('width') || 200,
- height : this.$.data('height') || 200,
- displayInput : this.$.data('displayinput') == null || this.$.data('displayinput'),
- displayPrevious : this.$.data('displayprevious'),
- fgColor : this.$.data('fgcolor') || '#87CEEB',
- inline : false,
-
- // Hooks
- draw : null, // function () {}
- change : null, // function (value) {}
- cancel : null, // function () {}
- release : null // function (value) {}
- }, this.o
- );
-
- // routing value
- if(this.$.is('fieldset')) {
-
- // fieldset = array of integer
- this.v = {};
- this.i = this.$.find('input')
- this.i.each(function(k) {
- var $this = $(this);
- s.i[k] = $this;
- s.v[k] = $this.val();
-
- $this.bind(
- 'change'
- , function () {
- var val = {};
- val[k] = $this.val();
- s.val(val);
- }
- );
- });
- this.$.find('legend').remove();
-
- } else {
- // input = integer
- this.i = this.$;
- this.v = this.$.val();
- (this.v == '') && (this.v = this.o.min);
-
- this.$.bind(
- 'change'
- , function () {
- s.val(s.$.val());
- }
- );
- }
-
- (!this.o.displayInput) && this.$.hide();
-
- this.$c = $('<canvas width="' +
- this.o.width + 'px" height="' +
- this.o.height + 'px"></canvas>');
- this.c = this.$c[0].getContext("2d");
-
- this.$
- .wrap($('<div style="' + (this.o.inline ? 'display:inline;' : '') +
- 'width:' + this.o.width + 'px;height:' +
- this.o.height + 'px;"></div>'))
- .before(this.$c);
-
- if (this.v instanceof Object) {
- this.cv = {};
- this.copy(this.v, this.cv);
- } else {
- this.cv = this.v;
- }
-
- this.$
- .bind("configure", cf)
- .parent()
- .bind("configure", cf);
-
- this._listen()
- ._configure()
- ._xy()
- .init();
-
- this.isInit = true;
-
- this._draw();
-
- return this;
- };
-
- this._draw = function () {
-
- // canvas pre-rendering
- var d = true,
- c = document.createElement('canvas');
-
- c.width = s.o.width;
- c.height = s.o.height;
- s.g = c.getContext('2d');
-
- s.clear();
-
- s.dH
- && (d = s.dH());
-
- (d !== false) && s.draw();
-
- s.c.drawImage(c, 0, 0);
- c = null;
- };
-
- this._touch = function (e) {
-
- var touchMove = function (e) {
-
- var v = s.xy2val(
- e.originalEvent.touches[s.t].pageX,
- e.originalEvent.touches[s.t].pageY
- );
-
- if (v == s.cv) return;
-
- if (
- s.cH
- && (s.cH(v) === false)
- ) return;
-
-
- s.change(v);
- s._draw();
- };
-
- // get touches index
- this.t = k.c.t(e);
-
- // First touch
- touchMove(e);
-
- // Touch events listeners
- k.c.d
- .bind("touchmove.k", touchMove)
- .bind(
- "touchend.k"
- , function () {
- k.c.d.unbind('touchmove.k touchend.k');
-
- if (
- s.rH
- && (s.rH(s.cv) === false)
- ) return;
-
- s.val(s.cv);
- }
- );
-
- return this;
- };
-
- this._mouse = function (e) {
-
- var mouseMove = function (e) {
- var v = s.xy2val(e.pageX, e.pageY);
- if (v == s.cv) return;
-
- if (
- s.cH
- && (s.cH(v) === false)
- ) return;
-
- s.change(v);
- s._draw();
- };
-
- // First click
- mouseMove(e);
-
- // Mouse events listeners
- k.c.d
- .bind("mousemove.k", mouseMove)
- .bind(
- // Escape key cancel current change
- "keyup.k"
- , function (e) {
- if (e.keyCode === 27) {
- k.c.d.unbind("mouseup.k mousemove.k keyup.k");
-
- if (
- s.eH
- && (s.eH() === false)
- ) return;
-
- s.cancel();
- }
- }
- )
- .bind(
- "mouseup.k"
- , function (e) {
- k.c.d.unbind('mousemove.k mouseup.k keyup.k');
-
- if (
- s.rH
- && (s.rH(s.cv) === false)
- ) return;
-
- s.val(s.cv);
- }
- );
-
- return this;
- };
-
- this._xy = function () {
- var o = this.$c.offset();
- this.x = o.left;
- this.y = o.top;
- return this;
- };
-
- this._listen = function () {
-
- if (!this.o.readOnly) {
- this.$c
- .bind(
- "mousedown"
- , function (e) {
- e.preventDefault();
- s._xy()._mouse(e);
- }
- )
- .bind(
- "touchstart"
- , function (e) {
- e.preventDefault();
- s._xy()._touch(e);
- }
- );
- this.listen();
- } else {
- this.$.attr('readonly', 'readonly');
- }
-
- return this;
- };
-
- this._configure = function () {
-
- // Hooks
- if (this.o.draw) this.dH = this.o.draw;
- if (this.o.change) this.cH = this.o.change;
- if (this.o.cancel) this.eH = this.o.cancel;
- if (this.o.release) this.rH = this.o.release;
-
- if (this.o.displayPrevious) {
- this.pColor = this.h2rgba(this.o.fgColor, "0.4");
- this.fgColor = this.h2rgba(this.o.fgColor, "0.6");
- } else {
- this.fgColor = this.o.fgColor;
- }
-
- return this;
- };
-
- this._clear = function () {
- this.$c[0].width = this.$c[0].width;
- };
-
- // Abstract methods
- this.listen = function () {}; // on start, one time
- this.extend = function () {}; // each time configure triggered
- this.init = function () {}; // each time configure triggered
- this.change = function (v) {}; // on change
- this.val = function (v) {}; // on release
- this.xy2val = function (x, y) {}; //
- this.draw = function () {}; // on change / on release
- this.clear = function () { this._clear(); };
-
- // Utils
- this.h2rgba = function (h, a) {
- var rgb;
- h = h.substring(1,7)
- rgb = [parseInt(h.substring(0,2),16)
- ,parseInt(h.substring(2,4),16)
- ,parseInt(h.substring(4,6),16)];
- return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + a + ")";
- };
-
- this.copy = function (f, t) {
- for (var i in f) { t[i] = f[i]; }
- };
- };
-
-
- /**
- * k.Dial
- */
- k.Dial = function () {
- k.o.call(this);
-
- this.startAngle = null;
- this.xy = null;
- this.radius = null;
- this.lineWidth = null;
- this.cursorExt = null;
- this.w2 = null;
- this.PI2 = 2*Math.PI;
-
- this.extend = function () {
- this.o = $.extend(
- {
- bgColor : this.$.data('bgcolor') || '#EEEEEE',
- angleOffset : this.$.data('angleoffset') || 0,
- angleArc : this.$.data('anglearc') || 360,
- inline : true
- }, this.o
- );
- };
-
- this.val = function (v) {
- if (null != v) {
- this.cv = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;
- this.v = this.cv;
- this.$.val(this.v);
- this._draw();
- } else {
- return this.v;
- }
- };
-
- this.xy2val = function (x, y) {
- var a, ret;
-
- a = Math.atan2(
- x - (this.x + this.w2)
- , - (y - this.y - this.w2)
- ) - this.angleOffset;
-
- if(this.angleArc != this.PI2 && (a < 0) && (a > -0.5)) {
- // if isset angleArc option, set to min if .5 under min
- a = 0;
- } else if (a < 0) {
- a += this.PI2;
- }
-
- ret = ~~ (0.5 + (a * (this.o.max - this.o.min) / this.angleArc))
- + this.o.min;
-
- this.o.stopper
- && (ret = max(min(ret, this.o.max), this.o.min));
-
- return ret;
- };
-
- this.listen = function () {
- // bind MouseWheel
- var s = this,
- mw = function (e) {
- e.preventDefault();
-
- var ori = e.originalEvent
- ,deltaX = ori.detail || ori.wheelDeltaX
- ,deltaY = ori.detail || ori.wheelDeltaY
- ,v = parseInt(s.$.val()) + (deltaX>0 || deltaY>0 ? 1 : deltaX<0 || deltaY<0 ? -1 : 0);
-
- if (
- s.cH
- && (s.cH(v) === false)
- ) return;
-
- s.val(v);
- }
- , kval, to, m = 1, kv = {37:-1, 38:1, 39:1, 40:-1};
-
- this.$
- .bind(
- "keydown"
- ,function (e) {
- var kc = e.keyCode;
- kval = parseInt(String.fromCharCode(kc));
-
- if (isNaN(kval)) {
-
- (kc !== 13) // enter
- && (kc !== 8) // bs
- && (kc !== 9) // tab
- && (kc !== 189) // -
- && e.preventDefault();
-
- // arrows
- if ($.inArray(kc,[37,38,39,40]) > -1) {
- e.preventDefault();
-
- var v = parseInt(s.$.val()) + kv[kc] * m;
-
- s.o.stopper
- && (v = max(min(v, s.o.max), s.o.min));
-
- s.change(v);
- s._draw();
-
- // long time keydown speed-up
- to = window.setTimeout(
- function () { m*=2; }
- ,30
- );
- }
- }
- }
- )
- .bind(
- "keyup"
- ,function (e) {
- if (isNaN(kval)) {
- if (to) {
- window.clearTimeout(to);
- to = null;
- m = 1;
- s.val(s.$.val());
- }
- } else {
- // kval postcond
- (s.$.val() > s.o.max && s.$.val(s.o.max))
- || (s.$.val() < s.o.min && s.$.val(s.o.min));
- }
-
- }
- );
-
- this.$c.bind("mousewheel DOMMouseScroll", mw);
- this.$.bind("mousewheel DOMMouseScroll", mw)
- };
-
- this.init = function () {
-
- if (
- this.v < this.o.min
- || this.v > this.o.max
- ) this.v = this.o.min;
-
- this.$.val(this.v);
- this.w2 = this.o.width / 2;
- this.cursorExt = this.o.cursor / 100;
- this.xy = this.w2;
- this.lineWidth = this.xy * this.o.thickness;
- this.radius = this.xy - this.lineWidth / 2;
-
- this.o.angleOffset
- && (this.o.angleOffset = isNaN(this.o.angleOffset) ? 0 : this.o.angleOffset);
-
- this.o.angleArc
- && (this.o.angleArc = isNaN(this.o.angleArc) ? this.PI2 : this.o.angleArc);
-
- // deg to rad
- this.angleOffset = this.o.angleOffset * Math.PI / 180;
- this.angleArc = this.o.angleArc * Math.PI / 180;
-
- // compute start and end angles
- this.startAngle = 1.5 * Math.PI + this.angleOffset;
- this.endAngle = 1.5 * Math.PI + this.angleOffset + this.angleArc;
-
- var s = max(
- String(Math.abs(this.o.max)).length
- , String(Math.abs(this.o.min)).length
- , 2
- ) + 2;
-
- this.o.displayInput
- && this.i.css({
- 'width' : ((this.o.width / 2 + 4) >> 0) + 'px'
- ,'height' : ((this.o.width / 3) >> 0) + 'px'
- ,'position' : 'absolute'
- ,'vertical-align' : 'middle'
- ,'margin-top' : ((this.o.width / 3) >> 0) + 'px'
- ,'margin-left' : '-' + ((this.o.width * 3 / 4 + 2) >> 0) + 'px'
- ,'border' : 0
- ,'background' : 'none'
- ,'font' : 'bold ' + ((this.o.width / s) >> 0) + 'px Arial'
- ,'text-align' : 'center'
- ,'color' : this.o.fgColor
- ,'padding' : '0px'
- ,'-webkit-appearance': 'none'
- })
- || this.i.css({
- 'width' : '0px'
- ,'visibility' : 'hidden'
- });
- };
-
- this.change = function (v) {
- this.cv = v;
- this.$.val(v);
- };
-
- this.angle = function (v) {
- return (v - this.o.min) * this.angleArc / (this.o.max - this.o.min);
- };
-
- this.draw = function () {
-
- var c = this.g, // context
- a = this.angle(this.cv) // Angle
- , sat = this.startAngle // Start angle
- , eat = sat + a // End angle
- , sa, ea // Previous angles
- , r = 1;
-
- c.lineWidth = this.lineWidth;
-
- this.o.cursor
- && (sat = eat - this.cursorExt)
- && (eat = eat + this.cursorExt);
-
- c.beginPath();
- c.strokeStyle = this.o.bgColor;
- c.arc(this.xy, this.xy, this.radius, this.endAngle, this.startAngle, true);
- c.stroke();
-
- if (this.o.displayPrevious) {
- ea = this.startAngle + this.angle(this.v);
- sa = this.startAngle;
- this.o.cursor
- && (sa = ea - this.cursorExt)
- && (ea = ea + this.cursorExt);
-
- c.beginPath();
- c.strokeStyle = this.pColor;
- c.arc(this.xy, this.xy, this.radius, sa, ea, false);
- c.stroke();
- r = (this.cv == this.v);
- }
-
- c.beginPath();
- c.strokeStyle = r ? this.o.fgColor : this.fgColor ;
- c.arc(this.xy, this.xy, this.radius, sat, eat, false);
- c.stroke();
- };
-
- this.cancel = function () {
- this.val(this.v);
- };
- };
-
- $.fn.dial = $.fn.knob = function (o) {
- return this.each(
- function () {
- var d = new k.Dial();
- d.o = o;
- d.$ = $(this);
- d.run();
- }
- ).parent();
- };
-
-}); \ No newline at end of file
+$(function(){"use strict";var k={},max=Math.max,min=Math.min;k.c={};k.c.d=$(document);k.c.t=function(e){return e.originalEvent.touches.length-1;};k.o=function(){var s=this;this.o=null;this.$=null;this.i=null;this.g=null;this.v=null;this.cv=null;this.x=0;this.y=0;this.$c=null;this.c=null;this.t=0;this.isInit=false;this.fgColor=null;this.pColor=null;this.dH=null;this.cH=null;this.eH=null;this.rH=null;this.run=function(){var cf=function(e,conf){var k;for(k in conf){s.o[k]=conf[k];}
+s.init();s._configure()._draw();};if(this.$.data('kontroled'))return;this.$.data('kontroled',true);this.extend();this.o=$.extend({min:this.$.data('min')||0,max:this.$.data('max')||100,stopper:true,readOnly:this.$.data('readonly'),cursor:(this.$.data('cursor')===true&&30)||this.$.data('cursor')||0,thickness:this.$.data('thickness')||0.35,width:this.$.data('width')||200,height:this.$.data('height')||200,displayInput:this.$.data('displayinput')==null||this.$.data('displayinput'),displayPrevious:this.$.data('displayprevious'),fgColor:this.$.data('fgcolor')||'#87CEEB',inline:false,draw:null,change:null,cancel:null,release:null},this.o);if(this.$.is('fieldset')){this.v={};this.i=this.$.find('input')
+this.i.each(function(k){var $this=$(this);s.i[k]=$this;s.v[k]=$this.val();$this.bind('change',function(){var val={};val[k]=$this.val();s.val(val);});});this.$.find('legend').remove();}else{this.i=this.$;this.v=this.$.val();(this.v=='')&&(this.v=this.o.min);this.$.bind('change',function(){s.val(s.$.val());});}
+(!this.o.displayInput)&&this.$.hide();this.$c=$('<canvas width="'+
+this.o.width+'px" height="'+
+this.o.height+'px"></canvas>');this.c=this.$c[0].getContext("2d");this.$.wrap($('<div style="'+(this.o.inline?'display:inline;':'')+'width:'+this.o.width+'px;height:'+
+this.o.height+'px;"></div>')).before(this.$c);if(this.v instanceof Object){this.cv={};this.copy(this.v,this.cv);}else{this.cv=this.v;}
+this.$.bind("configure",cf).parent().bind("configure",cf);this._listen()._configure()._xy().init();this.isInit=true;this._draw();return this;};this._draw=function(){var d=true,c=document.createElement('canvas');c.width=s.o.width;c.height=s.o.height;s.g=c.getContext('2d');s.clear();s.dH&&(d=s.dH());(d!==false)&&s.draw();s.c.drawImage(c,0,0);c=null;};this._touch=function(e){var touchMove=function(e){var v=s.xy2val(e.originalEvent.touches[s.t].pageX,e.originalEvent.touches[s.t].pageY);if(v==s.cv)return;if(s.cH&&(s.cH(v)===false))return;s.change(v);s._draw();};this.t=k.c.t(e);touchMove(e);k.c.d.bind("touchmove.k",touchMove).bind("touchend.k",function(){k.c.d.unbind('touchmove.k touchend.k');if(s.rH&&(s.rH(s.cv)===false))return;s.val(s.cv);});return this;};this._mouse=function(e){var mouseMove=function(e){var v=s.xy2val(e.pageX,e.pageY);if(v==s.cv)return;if(s.cH&&(s.cH(v)===false))return;s.change(v);s._draw();};mouseMove(e);k.c.d.bind("mousemove.k",mouseMove).bind("keyup.k",function(e){if(e.keyCode===27){k.c.d.unbind("mouseup.k mousemove.k keyup.k");if(s.eH&&(s.eH()===false))return;s.cancel();}}).bind("mouseup.k",function(e){k.c.d.unbind('mousemove.k mouseup.k keyup.k');if(s.rH&&(s.rH(s.cv)===false))return;s.val(s.cv);});return this;};this._xy=function(){var o=this.$c.offset();this.x=o.left;this.y=o.top;return this;};this._listen=function(){if(!this.o.readOnly){this.$c.bind("mousedown",function(e){e.preventDefault();s._xy()._mouse(e);}).bind("touchstart",function(e){e.preventDefault();s._xy()._touch(e);});this.listen();}else{this.$.attr('readonly','readonly');}
+return this;};this._configure=function(){if(this.o.draw)this.dH=this.o.draw;if(this.o.change)this.cH=this.o.change;if(this.o.cancel)this.eH=this.o.cancel;if(this.o.release)this.rH=this.o.release;if(this.o.displayPrevious){this.pColor=this.h2rgba(this.o.fgColor,"0.4");this.fgColor=this.h2rgba(this.o.fgColor,"0.6");}else{this.fgColor=this.o.fgColor;}
+return this;};this._clear=function(){this.$c[0].width=this.$c[0].width;};this.listen=function(){};this.extend=function(){};this.init=function(){};this.change=function(v){};this.val=function(v){};this.xy2val=function(x,y){};this.draw=function(){};this.clear=function(){this._clear();};this.h2rgba=function(h,a){var rgb;h=h.substring(1,7)
+rgb=[parseInt(h.substring(0,2),16),parseInt(h.substring(2,4),16),parseInt(h.substring(4,6),16)];return"rgba("+rgb[0]+","+rgb[1]+","+rgb[2]+","+a+")";};this.copy=function(f,t){for(var i in f){t[i]=f[i];}};};k.Dial=function(){k.o.call(this);this.startAngle=null;this.xy=null;this.radius=null;this.lineWidth=null;this.cursorExt=null;this.w2=null;this.PI2=2*Math.PI;this.extend=function(){this.o=$.extend({bgColor:this.$.data('bgcolor')||'#EEEEEE',angleOffset:this.$.data('angleoffset')||0,angleArc:this.$.data('anglearc')||360,inline:true},this.o);};this.val=function(v){if(null!=v){this.cv=this.o.stopper?max(min(v,this.o.max),this.o.min):v;this.v=this.cv;this.$.val(this.v);this._draw();}else{return this.v;}};this.xy2val=function(x,y){var a,ret;a=Math.atan2(x-(this.x+this.w2),-(y-this.y-this.w2))-this.angleOffset;if(this.angleArc!=this.PI2&&(a<0)&&(a>-0.5)){a=0;}else if(a<0){a+=this.PI2;}
+ret=~~(0.5+(a*(this.o.max-this.o.min)/this.angleArc))
++this.o.min;this.o.stopper&&(ret=max(min(ret,this.o.max),this.o.min));return ret;};this.listen=function(){var s=this,mw=function(e){e.preventDefault();var ori=e.originalEvent,deltaX=ori.detail||ori.wheelDeltaX,deltaY=ori.detail||ori.wheelDeltaY,v=parseInt(s.$.val())+(deltaX>0||deltaY>0?1:deltaX<0||deltaY<0?-1:0);if(s.cH&&(s.cH(v)===false))return;s.val(v);},kval,to,m=1,kv={37:-1,38:1,39:1,40:-1};this.$.bind("keydown",function(e){var kc=e.keyCode;kval=parseInt(String.fromCharCode(kc));if(isNaN(kval)){(kc!==13)&&(kc!==8)&&(kc!==9)&&(kc!==189)&&e.preventDefault();if($.inArray(kc,[37,38,39,40])>-1){e.preventDefault();var v=parseInt(s.$.val())+kv[kc]*m;s.o.stopper&&(v=max(min(v,s.o.max),s.o.min));s.change(v);s._draw();to=window.setTimeout(function(){m*=2;},30);}}}).bind("keyup",function(e){if(isNaN(kval)){if(to){window.clearTimeout(to);to=null;m=1;s.val(s.$.val());}}else{(s.$.val()>s.o.max&&s.$.val(s.o.max))||(s.$.val()<s.o.min&&s.$.val(s.o.min));}});this.$c.bind("mousewheel DOMMouseScroll",mw);this.$.bind("mousewheel DOMMouseScroll",mw)};this.init=function(){if(this.v<this.o.min||this.v>this.o.max)this.v=this.o.min;this.$.val(this.v);this.w2=this.o.width/2;this.cursorExt=this.o.cursor/100;this.xy=this.w2;this.lineWidth=this.xy*this.o.thickness;this.radius=this.xy-this.lineWidth/2;this.o.angleOffset&&(this.o.angleOffset=isNaN(this.o.angleOffset)?0:this.o.angleOffset);this.o.angleArc&&(this.o.angleArc=isNaN(this.o.angleArc)?this.PI2:this.o.angleArc);this.angleOffset=this.o.angleOffset*Math.PI/180;this.angleArc=this.o.angleArc*Math.PI/180;this.startAngle=1.5*Math.PI+this.angleOffset;this.endAngle=1.5*Math.PI+this.angleOffset+this.angleArc;var s=max(String(Math.abs(this.o.max)).length,String(Math.abs(this.o.min)).length,2)+2;this.o.displayInput&&this.i.css({'width':((this.o.width/2+4)>>0)+'px','height':((this.o.width/3)>>0)+'px','position':'absolute','vertical-align':'middle','margin-top':((this.o.width/3)>>0)+'px','margin-left':'-'+((this.o.width*3/4+2)>>0)+'px','border':0,'background':'none','font':'bold '+((this.o.width/s)>>0)+'px Arial','text-align':'center','color':this.o.fgColor,'padding':'0px','-webkit-appearance':'none'})||this.i.css({'width':'0px','visibility':'hidden'});};this.change=function(v){this.cv=v;this.$.val(v);};this.angle=function(v){return(v-this.o.min)*this.angleArc/(this.o.max-this.o.min);};this.draw=function(){var c=this.g,a=this.angle(this.cv),sat=this.startAngle,eat=sat+a,sa,ea,r=1;c.lineWidth=this.lineWidth;this.o.cursor&&(sat=eat-this.cursorExt)&&(eat=eat+this.cursorExt);c.beginPath();c.strokeStyle=this.o.bgColor;c.arc(this.xy,this.xy,this.radius,this.endAngle,this.startAngle,true);c.stroke();if(this.o.displayPrevious){ea=this.startAngle+this.angle(this.v);sa=this.startAngle;this.o.cursor&&(sa=ea-this.cursorExt)&&(ea=ea+this.cursorExt);c.beginPath();c.strokeStyle=this.pColor;c.arc(this.xy,this.xy,this.radius,sa,ea,false);c.stroke();r=(this.cv==this.v);}
+c.beginPath();c.strokeStyle=r?this.o.fgColor:this.fgColor;c.arc(this.xy,this.xy,this.radius,sat,eat,false);c.stroke();};this.cancel=function(){this.val(this.v);};};$.fn.dial=$.fn.knob=function(o){return this.each(function(){var d=new k.Dial();d.o=o;d.$=$(this);d.run();}).parent();};}); \ No newline at end of file
diff --git a/templates/project/widgets/list/list.coffee b/templates/project/widgets/list/list.coffee
index 6b1cc50..3ca892b 100644
--- a/templates/project/widgets/list/list.coffee
+++ b/templates/project/widgets/list/list.coffee
@@ -1,7 +1,5 @@
-class AllTheThings.List extends AllTheThings.Widget
- source: 'list'
-
- @accessor 'current', Batman.Property.EasingSetter
+class Dashing.List extends Dashing.Widget
+ @accessor 'current', Dashing.AnimatedValue
@accessor 'arrow', ->
if @get('last')
diff --git a/templates/project/widgets/meter/meter.coffee b/templates/project/widgets/meter/meter.coffee
index 4dbc2da..0e0a8ad 100644
--- a/templates/project/widgets/meter/meter.coffee
+++ b/templates/project/widgets/meter/meter.coffee
@@ -1,7 +1,6 @@
-class AllTheThings.Meter extends AllTheThings.Widget
- source: 'meter'
+class Dashing.Meter extends Dashing.Widget
- @accessor 'value', Batman.Property.EasingSetter
+ @accessor 'value', Dashing.AnimatedValue
constructor: ->
super
@@ -9,8 +8,7 @@ class AllTheThings.Meter extends AllTheThings.Widget
$(@node).find(".meter").val(value).trigger('change')
ready: ->
- Batman.setImmediate =>
- meter = $(@node).find(".meter")
- meter.attr("data-bgcolor", meter.css("background-color"))
- meter.attr("data-fgcolor", meter.css("color"))
- meter.knob() \ No newline at end of file
+ meter = $(@node).find(".meter")
+ meter.attr("data-bgcolor", meter.css("background-color"))
+ meter.attr("data-fgcolor", meter.css("color"))
+ meter.knob() \ No newline at end of file
diff --git a/templates/project/widgets/number/number.coffee b/templates/project/widgets/number/number.coffee
index aa7cf8b..cb8376e 100644
--- a/templates/project/widgets/number/number.coffee
+++ b/templates/project/widgets/number/number.coffee
@@ -1,9 +1,5 @@
-class AllTheThings.Number extends AllTheThings.Widget
- source: 'number'
-
- @accessor 'current', Batman.Property.EasingSetter
-
- ready: ->
+class Dashing.Number extends Dashing.Widget
+ @accessor 'current', Dashing.AnimatedValue
@accessor 'difference', ->
if @get('last')
diff --git a/templates/project/widgets/table/table.coffee b/templates/project/widgets/table/table.coffee
deleted file mode 100644
index 5735316..0000000
--- a/templates/project/widgets/table/table.coffee
+++ /dev/null
@@ -1,2 +0,0 @@
-class AllTheThings.Table extends AllTheThings.Widget
- source: 'table' \ No newline at end of file
diff --git a/templates/project/widgets/table/table.html b/templates/project/widgets/table/table.html
deleted file mode 100644
index e5aeb99..0000000
--- a/templates/project/widgets/table/table.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<h1 class="title" data-bind="title"></h1>
-
-<table>
- <tr data-foreach-item="items">
- <td class="label" data-bind="item.label"></td>
- <td class="value" data-bind="item.value | shortenedNumber"></td>
- </tr>
-</table> \ No newline at end of file
diff --git a/templates/project/widgets/table/table.scss b/templates/project/widgets/table/table.scss
deleted file mode 100644
index 0d38164..0000000
--- a/templates/project/widgets/table/table.scss
+++ /dev/null
@@ -1,42 +0,0 @@
-// ----------------------------------------------------------------------------
-// Sass declarations
-// ----------------------------------------------------------------------------
-$widget-table_background-color: #82b53d;
-$widget-table_value-color: #fff;
-
-$widget-table_title-color: lighten($widget-table_background-color, 45%);
-$widget-table_label-color: lighten($widget-table_background-color, 45%);
-
-// ----------------------------------------------------------------------------
-// Widget-table styles
-// ----------------------------------------------------------------------------
-.widget-table {
-
- background-color: $widget-table_background-color;
-
- th {
- font-weight: 400;
- font-size: 16px;
- }
-
- td.label {
- vertical-align: middle;
- text-align: left;
- font-size: 23px;
- }
-
- .title {
- color: $widget-table_title-color;
- }
-
- .label {
- color: $widget-table_label-color;
- }
-
- .value {
- font-weight: 700;
- font-size: 54px;
- color: $widget-table_value-color;
- }
-
-} \ No newline at end of file
diff --git a/templates/project/widgets/text/text.coffee b/templates/project/widgets/text/text.coffee
index 754644e..05974b8 100644
--- a/templates/project/widgets/text/text.coffee
+++ b/templates/project/widgets/text/text.coffee
@@ -1,2 +1 @@
-class AllTheThings.Text extends AllTheThings.Widget
- source: 'text' \ No newline at end of file
+class Dashing.Text extends Dashing.Widget \ No newline at end of file
diff --git a/templates/widget/%name%/%name%.coffee.tt b/templates/widget/%name%/%name%.coffee.tt
index 5ddfb1b..9105f9a 100644
--- a/templates/widget/%name%/%name%.coffee.tt
+++ b/templates/widget/%name%/%name%.coffee.tt
@@ -1,5 +1,4 @@
-class AllTheThings.<%= Thor::Util.camel_case(name) %> extends AllTheThings.Widget
- source: '<%= name %>'
+class Dashing.<%= Thor::Util.camel_case(name) %> extends Dashing.Widget
ready: ->
# This is fired when the widget is done being rendered
@@ -7,5 +6,5 @@ class AllTheThings.<%= Thor::Util.camel_case(name) %> extends AllTheThings.Widge
onData: (data) ->
# Handle incoming data
# You can access the html node of this widget with `@node`
- # Example: $(@node).effect("pulsate") will make the node flash each time data comes in.
+ # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in.
super \ No newline at end of file
diff --git a/templates/widget/%name%/%name%.html b/templates/widget/%name%/%name%.html
index e69de29..789f2e3 100644
--- a/templates/widget/%name%/%name%.html
+++ b/templates/widget/%name%/%name%.html
@@ -0,0 +1 @@
+<div data-bind="value"></div> \ No newline at end of file