refactor containers: same render logic, fix tests

This commit is contained in:
vitalets
2013-01-11 17:07:00 +04:00
parent 775deede07
commit 0ced7f87f5
9 changed files with 230 additions and 137 deletions

@ -8,49 +8,42 @@
//extend methods
$.extend($.fn.editableContainer.Inline.prototype, $.fn.editableContainer.Popup.prototype, {
containerName: 'editableform',
innerCss: null,
innerCss: '.editable-inline',
initContainer: function(){
//no init for container
//only convert anim to miliseconds (int)
//container is <span> element
this.$tip = $('<span></span>').addClass('editable-inline');
//convert anim to miliseconds (int)
if(!this.options.anim) {
this.options.anim = 0;
}
},
splitOptions: function() {
//all options are passed to form
this.containerOptions = {};
this.formOptions = this.options;
},
tip: function() {
return this.$form;
return this.$tip;
},
innerShow: function () {
this.$element.hide();
if(this.$form) {
this.$form.remove();
}
this.initForm();
this.tip().addClass('editable-container').addClass('editable-inline');
this.$form.insertAfter(this.$element);
this.$form.show(this.options.anim);
this.$form.editableform('render');
this.tip().insertAfter(this.$element).show();
},
innerHide: function () {
this.$form.hide(this.options.anim, $.proxy(function() {
this.$tip.hide(this.options.anim, $.proxy(function() {
this.$element.show();
this.tip().empty().remove();
}, this));
},
destroy: function() {
innerDestroy: function() {
this.tip().remove();
this.$element.off('destroyed');
this.$element.removeData('editableContainer');
}
});