Ember.Handlebars.helper('panelBar', function(status) { var highlightClass; if (status == "passing") { highlightClass = "bg-green"; } else { highlightClass = "bg-orange"; } return new Handlebars.SafeString('
'); }); Ember.Handlebars.helper('listBar', function(status) { var highlightClass; if (status == "passing") { highlightClass = "bg-green"; } else { highlightClass = "bg-orange"; } return new Handlebars.SafeString(''); }); Ember.Handlebars.helper('sessionName', function(session) { var name; if (session.Name === "") { name = '' + Handlebars.Utils.escapeExpression(session.ID) + ''; } else { name = '' + Handlebars.Utils.escapeExpression(session.Name) + '' + ' ' + Handlebars.Utils.escapeExpression(session.ID) + ''; } return new Handlebars.SafeString(name); }); Ember.Handlebars.helper('sessionMeta', function(session) { var meta = ' '; if (session.TTL !== "") { meta = meta + ' '; } return new Handlebars.SafeString(meta); }); Ember.Handlebars.helper('aclName', function(name, id) { if (name === "") { return id; } else { return new Handlebars.SafeString(Handlebars.Utils.escapeExpression(name) + ' ' + Handlebars.Utils.escapeExpression(id) + ''); } }); Ember.Handlebars.helper('formatRules', function(rules) { if (rules === "") { return "No rules defined"; } else { return rules; } }); // We need to do this because of our global namespace properties. The // service.Tags Ember.Handlebars.helper('serviceTagMessage', function(tags) { if (tags === null) { return "No tags"; } }); // Sends a new notification to the UI function notify(message, ttl) { if (window.notifications !== undefined && window.notifications.length > 0) { $(window.notifications).each(function(i, v) { v.dismiss(); }); } var notification = new NotificationFx({ message : ''+ message + '
', layout : 'growl', effect : 'slide', type : 'notice', ttl: ttl, }); // show the notification notification.show(); // Add the notification to the queue to be closed window.notifications = []; window.notifications.push(notification); } // Tomography // TODO: not sure how to how do to this more Ember.js-y function tomographyMouseOver(el) { var buf = el.getAttribute('data-node') + ' - ' + el.getAttribute('data-distance') + 'ms'; document.getElementById('tomography-node-info').innerHTML = buf; } Ember.Handlebars.helper('tomographyGraph', function(tomography, size) { // This is ugly, but I'm working around bugs with Handlebars and templating // parts of svgs. Basically things render correctly the first time, but when // stuff is updated for subsequent go arounds the templated parts don't show. // It appears (based on google searches) that the replaced elements aren't // being interpreted as http://www.w3.org/2000/svg. Anyway, this works and // if/when Handlebars fixes the underlying issues all of this can be cleaned // up drastically. var max = -999999999; tomography.distances.forEach(function (d, i) { if (d.distance > max) { max = d.distance; } }); var insetSize = size / 2 - 8; var buf = '' + ' '; return new Handlebars.SafeString(buf); });