Skip to content

Instantly share code, notes, and snippets.

@tritchey
Created May 5, 2011 19:02
Show Gist options
  • Save tritchey/957666 to your computer and use it in GitHub Desktop.
Save tritchey/957666 to your computer and use it in GitHub Desktop.
view
systemStatus: SC.View.design(SC.ContentDisplay, {
layout: { bottom: 24, left: 24, width: 109, height: 141 },
contentBinding: 'ScaleUI.statusController',
contentDisplayProperties: 'dataOnline dataMirrored systemOK'.w(),
render: function(context, firstTime) {
var dataOnline = null;
var dataMirrored = null;
var systemOK = null;
var content = this.get('content');
if(content != null) {
dataOnline = content.get('dataOnline');
dataMirrored = content.get('dataMirrored');
systemOK = content.get('systemOK');
}
context = context.begin('div').addClass('status-label');
if(dataOnline) {
context = context.addClass('good');
} else {
context = context.addClass('bad');
}
context = context.begin('span').addClass('status-item').text('_Data'.loc()).end();
context = context.begin('span').addClass('status-value');
if(dataOnline == null) {
context = context.text('_UNKNOWN'.loc());
} else if(dataOnline) {
context = context.text('_ONLINE'.loc());
} else {
context = context.text('_OFFLINE'.loc());
}
context = context.end().end();
context = context.begin('div').addClass('status-label');
if(dataMirrored) {
context = context.addClass('good');
} else {
context = context.addClass('bad');
}
context = context.begin('span').addClass('status-item').text('_Data'.loc()).end();
context = context.begin('span').addClass('status-value');
if(dataMirrored == null) {
context = context.text('_UNKNOWN'.loc());
} else if(dataMirrored) {
context = context.text('_MIRRORED'.loc());
} else {
context = context.text('_NOT_MIRRORED'.loc());
}
context = context.end().end();
context = context.begin('div').addClass('status-label');
if(systemOK) {
context = context.addClass('good');
} else {
context = context.addClass('bad');
}
context = context.begin('span').addClass('status-item').text('_System'.loc()).end();
context = context.begin('span').addClass('status-value');
if(systemOK == null) {
context = context.text('_UNKNOWN'.loc());
} else if(systemOK) {
context = context.text('_ONLINE'.loc());
} else {
context = context.text('_OFFLINE'.loc());
}
context = context.end().end();
sc_super();
}
}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment