Skip to content

Instantly share code, notes, and snippets.

@tim-evans
Created February 23, 2011 17:52
Show Gist options
  • Save tim-evans/840811 to your computer and use it in GitHub Desktop.
Save tim-evans/840811 to your computer and use it in GitHub Desktop.
Login pane
// ==========================================================================
// Project: MO - loginPage
// Copyright: ©2010 Junction Networks
// ==========================================================================
/*globals MO */
// This page describes the main user interface for your application.
MO.loginPane = SC.Pane.create({
layout: { top: 0, bottom: 0, left: 0, right: 0 },
childViews: 'contentView'.w(),
defaultResponder: 'MO.loginController',
contentView: SC.View.extend({
layout: { width: 400, height: 150, centerX: 0, centerY: 0 },
childViews: 'sipAddress password statusLabel loginButton'.w(),
sipAddress: SC.View.design({
layout: { top: 30, height: 24 },
childViews: 'label field'.w(),
label: SC.LabelView.design({
layout: { top: 0, width: 100 },
textAlign: SC.ALIGN_RIGHT,
value: '_sip_address_label'.loc()
}),
field: SC.TextFieldView.design({
layout: { top: 0, left: 125, width: 250, height: 24 },
spellCheckEnabled: NO,
valueBinding: 'MO.loginController.username'
})
}),
password: SC.View.design({
layout: { top: 60, height: 24 },
childViews: 'label field'.w(),
label: SC.LabelView.design({
layout: { top: 0, width: 100 },
textAlign: SC.ALIGN_RIGHT,
value: '_password_label'.loc()
}),
field: SC.TextFieldView.design({
layout: { top: 0, left: 125, width: 250, height: 24 },
isPassword: YES,
spellCheckEnabled: NO,
valueBinding: 'MO.loginController.password'
})
}),
statusLabel: SC.LabelView.design({
layout: { bottom: 20, left: 25, width: 24, height: 24 },
textAlign: SC.ALIGN_LEFT,
valueBinding: SC.Binding.oneWay('MO.loginController.content.connectionStatus')
}),
loginButton: SC.ButtonView.design({
layout: { bottom: 20, right: 25, width: 80, height: 24 },
title: "_login".loc(),
titleMinWidth: 0,
buttonBehavior: SC.PUSH_BEHAVIOR,
isDefault: YES,
isEnabled: SC.Binding.not('MO.loginController.disabled'),
action: 'login'
})
}),
focus: function () {
this.contentView.sipAddress.field.becomeFirstResponder();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment