Skip to content

Instantly share code, notes, and snippets.

@tritchey
Created June 9, 2011 14:58
Show Gist options
  • Save tritchey/1016893 to your computer and use it in GitHub Desktop.
Save tritchey/1016893 to your computer and use it in GitHub Desktop.
collapsing textfieldviews
editView: ScaleUI.SystemSectionEditView.design({
useStaticLayout: YES,
layout: { top: 0, left: 50, right: 0 },
classNames: ['edit'],
contentBinding: 'ScaleUI.activeDirectoryController',
contentDisplayProperties: ['domain', 'server', 'username', 'password'],
childViews: 'domainField serverField usernameField passwordField'.w(),
renderChildViews: function() {},
render: function(context, firstTime) {
sc_super();
var domain = '', server = '', username = '', password = '';
var content = this.get('content');
if(!SC.none(content)) {
domain = content.get('domain');
server = content.get('server');
username = content.get('username');
password = content.get('password');
}
context = context.begin('span').addClass('label').push("_Domain".loc()).end();
context = context.begin(this.getPath('domainField.tagName'));
this.get('domainField').renderToContext(context, YES);
context = context.end();
context = context.begin('span').addClass('label').push("_Server".loc()).end();
context = context.begin(this.getPath('serverField.tagName'));
this.get('serverField').renderToContext(context, YES);
context = context.end();
context = context.begin('span').addClass('label').push("_Username".loc()).end();
context = context.begin(this.getPath('usernameField.tagName'));
this.get('usernameField').renderToContext(context, YES);
context = context.end();
context = context.begin('span').addClass('label').push("_Password".loc()).end();
context = context.begin(this.getPath('passwordField.tagName'));
this.get('passwordField').renderToContext(context, YES);
context = context.end();
this._didRenderChildViews = YES;
},
domainField: SC.TextFieldView.extend({
useStaticLayout: YES,
layout: { width: 300, height: 24 },
valueBinding: 'ScaleUI.activeDirectoryController.domain',
}),
serverField: SC.TextFieldView.extend({
useStaticLayout: YES,
layout: { width: 300, height: 24 },
valueBinding: 'ScaleUI.activeDirectoryController.server',
}),
usernameField: SC.TextFieldView.extend({
useStaticLayout: YES,
layout: { width: 300, height: 24 },
valueBinding: 'ScaleUI.activeDirectoryController.username',
}),
passwordField: SC.TextFieldView.extend({
useStaticLayout: YES,
layout: { width: 300, height: 24 },
valueBinding: 'ScaleUI.activeDirectoryController.password',
isPassword: YES,
}),
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment