Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:winton/stutools
Browse files Browse the repository at this point in the history
  • Loading branch information
Winton Welsh committed Apr 28, 2008
2 parents 066e187 + 3d82018 commit a1fc104
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Dialog.js
Expand Up @@ -70,30 +70,31 @@ Example:
*/

var Dialog = Base.extend({
elements: {
load: {}, container: {}, dialog: { close: '.close', form: 'form', submit: '.submit' }
},
options: {
elements: {}, events: {},

onShow: Class.empty, // must call dialog.show(), this.ready()
onHide: Class.empty,
onSubmit: Class.empty,
onRespond: Class.empty,
onRespond: Class.empty,

onValidationFailed: Class.empty,
onValidationReset: Class.empty,

centered: false,
lightbox: false,

inside: null,
inside: null,
trigger: null,

dialog_template: '#template_dialog',
method: 'post'
},
initialize: function(template, options) {
this.elements = {
load: {}, container: {}, dialog: { close: '.close', form: 'form', submit: '.submit' }
};

this.options.trigger = '#' + template;
this.elements.load.template = '#template_' + template;
this.elements.load.dialog_template = this.options.dialog_template;
Expand Down Expand Up @@ -121,7 +122,7 @@ var Dialog = Base.extend({
this.hide();
},
onFormKeyDown: function(e) {
if (e.key == 'esc') this.hide();
if (e.key == 'esc') this.hide();
if (e.key == 'enter' && e.target.tagName != 'TEXTAREA') this.submit(e);
},
onFormSubmit: function(e) {
Expand Down Expand Up @@ -210,6 +211,11 @@ var Dialog = Base.extend({
return this;
},

reset: function() {
this.el.form.reset();
$ES('input, textarea', this.el.form).each(function(item) { this.fireEvent('onValidationReset', item); }, this);
},

resize: function() {
if (!this.el.dialog) return false;
if (this.el.dialog && this.el.dialog.visible())
Expand Down

0 comments on commit a1fc104

Please sign in to comment.