Created
March 22, 2011 04:24
-
-
Save AGoblinKing/880770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Widget = new Class({ | |
initialize: function(options) { | |
this.options = Object.merge(this.options, options); | |
}, | |
members: {}, | |
options: {}, | |
update: function() { | |
this.destroy(); | |
this.render(); | |
}, | |
render: function() { | |
var self = this; | |
this.options.memberHTML = $('<div/>',{class:'memberHTML'}); | |
Object.each(this.members, function(member) { | |
self.options.memberHTML.append(member.render()); | |
}); | |
this.html = $('#base.tpl').tmpl(this.options); | |
return this.html; | |
}, | |
destroy: function() { | |
Object.each(this.members, function(member) { | |
member.destroy(); | |
}); | |
this.html.remove(); | |
} | |
}); | |
var DialogWidget = new Class({ | |
Extends: Widget, | |
options: { | |
resizable: false, | |
closeText: '', | |
closeOnEscape: false, | |
open: function() { | |
$(this).find('.msg').remove(); | |
} | |
}, | |
render: function() { | |
this.parent(); | |
this.html.dialog(options); | |
}, | |
destroy: function() { | |
this.html.dialog('close'); | |
this.parent(); | |
} | |
}); | |
var LoginWidget = Class({ | |
Extends: DialogWidget, | |
initialize: function() { | |
this.parent({ | |
title: 'Login to Jixel', | |
buttons: { | |
'Login': function() { | |
}, | |
'Create': function() { | |
} | |
} | |
}); | |
this.members = { | |
'name': new InputField({title: 'Name'}), | |
'password': new InputField({title: 'Name', attri: {type:'password'}}) | |
}; | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment