rename in form $div to $element

This commit is contained in:
vitalets 2012-11-21 15:17:23 +04:00
parent 76b4db77be
commit e288aa578d

@ -11,7 +11,7 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
var EditableForm = function (element, options) { var EditableForm = function (element, options) {
this.options = $.extend({}, $.fn.editableform.defaults, options); this.options = $.extend({}, $.fn.editableform.defaults, options);
this.$div = $(element); //div (usually), containing form this.$element = $(element); //div (usually), containing form. not form tag!
this.initInput(); this.initInput();
}; };
@ -42,7 +42,7 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
**/ **/
render: function() { render: function() {
this.$loading = $($.fn.editableform.loading); this.$loading = $($.fn.editableform.loading);
this.$div.empty().append(this.$loading); this.$element.empty().append(this.$loading);
this.showLoading(); this.showLoading();
this.initTemplate(); this.initTemplate();
@ -52,7 +52,7 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
@event rendering @event rendering
@param {Object} event event object @param {Object} event event object
**/ **/
this.$div.triggerHandler('rendering'); this.$element.triggerHandler('rendering');
//render input //render input
$.when(this.input.render()) $.when(this.input.render())
@ -62,7 +62,7 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
//attach 'cancel' handler //attach 'cancel' handler
this.$form.find('button[type=button]').click($.proxy(this.cancel, this)); this.$form.find('button[type=button]').click($.proxy(this.cancel, this));
//append form to container //append form to container
this.$div.append(this.$form); this.$element.append(this.$form);
if(this.input.error) { if(this.input.error) {
this.error(this.input.error); this.error(this.input.error);
this.$form.find('button[type=submit]').attr('disabled', true); this.$form.find('button[type=submit]').attr('disabled', true);
@ -83,7 +83,7 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
@event cancel @event cancel
@param {Object} event event object @param {Object} event event object
**/ **/
this.$div.triggerHandler('cancel'); this.$element.triggerHandler('cancel');
}, },
showLoading: function() { showLoading: function() {
var fw, fh, iw, ih; var fw, fh, iw, ih;
@ -113,7 +113,7 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
@event show @event show
@param {Object} event event object @param {Object} event event object
**/ **/
this.$div.triggerHandler('show'); this.$element.triggerHandler('show');
}, },
error: function(msg) { error: function(msg) {
@ -174,7 +174,7 @@ Editableform is linked with one of input types, e.g. 'text' or 'select'.
if(params.newValue === 'username') {...} if(params.newValue === 'username') {...}
}); });
**/ **/
this.$div.triggerHandler('save', {newValue: newValue, response: response}); this.$element.triggerHandler('save', {newValue: newValue, response: response});
}, this)) }, this))
.fail($.proxy(function(xhr) { .fail($.proxy(function(xhr) {
this.error(typeof xhr === 'string' ? xhr : xhr.responseText || xhr.statusText || 'Unknown error!'); this.error(typeof xhr === 'string' ? xhr : xhr.responseText || xhr.statusText || 'Unknown error!');