Files
src
containers
editable-container.css
editable-container.js
editable-inline.js
editable-popover.js
editable-poshytip.js
editable-tooltip.js
editable-form
element
inputs
test
.gitignore
CHANGELOG.txt
LICENSE-MIT
README.md
grunt.js
package.json
x-editable/src/containers/editable-inline.js
2012-11-28 21:24:51 +04:00

65 lines
1.7 KiB
JavaScript

/**
* Editable Inline
* ---------------------
*/
(function ($) {
//extend methods
$.extend($.fn.editableContainer.Constructor.prototype, {
containerName: 'editableform',
innerCss: null,
initContainer: function(){
//no init for container
//only convert anim to miliseconds (int)
if(!this.options.anim) {
this.options.anim = 0;
}
},
splitOptions: function() {
this.containerOptions = {};
this.formOptions = this.options;
},
tip: function() {
return this.$form;
},
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');
},
innerHide: function () {
this.$form.hide(this.options.anim, $.proxy(function() {
this.$element.show();
//return focus on element
if (this.options.enablefocus) {
this.$element.focus();
}
}, this));
},
destroy: function() {
this.tip().remove();
}
});
//defaults
$.fn.editableContainer.defaults = $.extend({}, $.fn.editableContainer.defaults, {
anim: 'fast',
enablefocus: false
});
}(window.jQuery));