Sha256: e9eaaaf9ef9a0a4bbed8edc62052e5324996cee3ddb95a8c372c89ddc3a25220
Contents?: true
Size: 1022 Bytes
Versions: 2
Compression:
Stored size: 1022 Bytes
Contents
define(['jquery', 'mustache'], function ($, Mustache) { var me , defaults , current = {} , tmpl = $('#template').html() , isCount = false ; defaults = function () { return { name: '' , line_number: '' , status: '' , duration: '' , time_or_count: isCount ? 'Examples' : 'ms' , minutes: '' , value: null }; }; function secToMin(time) { var pad = function (val) { return ('00' + val).slice(-2); } , min = parseInt(time / 60) , sec = parseInt(time % 60) ; return pad(min) + ':' + pad(sec); } function render() { if (current.value) { if (!isCount) { current.minutes = secToMin(current.value); current.value = parseInt(current.value * 1000); } } $('.example-wrapper').html(Mustache.render(tmpl, current)); } return { update: function (d) { current = $.extend({}, defaults(), d); render(); } , isCount: function (value) { isCount = value; } }; });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspectacles-0.4.1 | lib/rspectacles/app/public/js/details.js |
rspectacles-0.4.0 | lib/rspectacles/app/public/js/details.js |