mode beta ready
This commit is contained in:
@@ -9,12 +9,16 @@ Applied as jQuery method.
|
||||
**/
|
||||
(function ($) {
|
||||
|
||||
var EditableContainer = function (element, options) {
|
||||
var Popup = function (element, options) {
|
||||
this.init(element, options);
|
||||
};
|
||||
|
||||
var Inline = function (element, options) {
|
||||
this.init(element, options);
|
||||
};
|
||||
|
||||
//methods
|
||||
EditableContainer.prototype = {
|
||||
Popup.prototype = {
|
||||
containerName: null, //tbd in child class
|
||||
innerCss: null, //tbd in child class
|
||||
init: function(element, options) {
|
||||
@@ -48,7 +52,7 @@ Applied as jQuery method.
|
||||
return;
|
||||
} else {
|
||||
//close all open containers (except one)
|
||||
EditableContainer.prototype.closeOthers(e.target);
|
||||
Popup.prototype.closeOthers(e.target);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -310,11 +314,12 @@ Applied as jQuery method.
|
||||
return this.each(function () {
|
||||
var $this = $(this),
|
||||
dataKey = 'editableContainer',
|
||||
data = $this.data(dataKey),
|
||||
options = typeof option === 'object' && option;
|
||||
data = $this.data(dataKey),
|
||||
options = typeof option === 'object' && option,
|
||||
Constructor = (options.mode === 'inline') ? Inline : Popup;
|
||||
|
||||
if (!data) {
|
||||
$this.data(dataKey, (data = new EditableContainer(this, options)));
|
||||
$this.data(dataKey, (data = new Constructor(this, options)));
|
||||
}
|
||||
|
||||
if (typeof option === 'string') { //call method
|
||||
@@ -323,8 +328,9 @@ Applied as jQuery method.
|
||||
});
|
||||
};
|
||||
|
||||
//store constructor
|
||||
$.fn.editableContainer.Constructor = EditableContainer;
|
||||
//store constructors
|
||||
$.fn.editableContainer.Popup = Popup;
|
||||
$.fn.editableContainer.Inline = Inline;
|
||||
|
||||
//defaults
|
||||
$.fn.editableContainer.defaults = {
|
||||
@@ -363,7 +369,25 @@ Applied as jQuery method.
|
||||
@default 'cancel'
|
||||
@since 1.1.1
|
||||
**/
|
||||
onblur: 'cancel'
|
||||
onblur: 'cancel',
|
||||
|
||||
/**
|
||||
Animation speed (inline mode)
|
||||
@property anim
|
||||
@type string
|
||||
@default 'fast'
|
||||
**/
|
||||
anim: 'fast',
|
||||
|
||||
/**
|
||||
Mode of editable, can be `popup` or `inline`
|
||||
|
||||
@property mode
|
||||
@type string
|
||||
@default 'popup'
|
||||
@since 1.4.0
|
||||
**/
|
||||
mode: 'popup'
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -3,9 +3,10 @@
|
||||
* ---------------------
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
|
||||
//copy prototype from EditableContainer
|
||||
//extend methods
|
||||
$.extend($.fn.editableContainer.Constructor.prototype, {
|
||||
$.extend($.fn.editableContainer.Inline.prototype, $.fn.editableContainer.Popup.prototype, {
|
||||
containerName: 'editableform',
|
||||
innerCss: null,
|
||||
|
||||
@@ -51,10 +52,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
//defaults
|
||||
$.fn.editableContainer.defaults = $.extend({}, $.fn.editableContainer.defaults, {
|
||||
anim: 'fast'
|
||||
});
|
||||
|
||||
|
||||
}(window.jQuery));
|
@@ -6,7 +6,7 @@
|
||||
(function ($) {
|
||||
|
||||
//extend methods
|
||||
$.extend($.fn.editableContainer.Constructor.prototype, {
|
||||
$.extend($.fn.editableContainer.Popup.prototype, {
|
||||
containerName: 'popover',
|
||||
//for compatibility with bootstrap <= 2.2.1 (content inserted into <p> instead of directly .popover-content)
|
||||
innerCss: $($.fn.popover.defaults.template).find('p').length ? '.popover-content p' : '.popover-content',
|
||||
@@ -82,11 +82,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
//defaults
|
||||
/*
|
||||
$.fn.editableContainer.defaults = $.extend({}, $.fn.popover.defaults, $.fn.editableContainer.defaults, {
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
}(window.jQuery));
|
@@ -6,7 +6,7 @@
|
||||
(function ($) {
|
||||
|
||||
//extend methods
|
||||
$.extend($.fn.editableContainer.Constructor.prototype, {
|
||||
$.extend($.fn.editableContainer.Popup.prototype, {
|
||||
containerName: 'poshytip',
|
||||
innerCss: 'div.tip-inner',
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
(function ($) {
|
||||
|
||||
//extend methods
|
||||
$.extend($.fn.editableContainer.Constructor.prototype, {
|
||||
$.extend($.fn.editableContainer.Popup.prototype, {
|
||||
containerName: 'tooltip',
|
||||
innerCss: '.ui-tooltip-content',
|
||||
|
||||
@@ -109,12 +109,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
//defaults
|
||||
/*
|
||||
$.fn.editableContainer.defaults = $.extend({}, $.fn.tooltip.defaults, $.fn.editableContainer.defaults, {
|
||||
items: '*',
|
||||
content: ' ',
|
||||
});
|
||||
*/
|
||||
|
||||
}(window.jQuery));
|
Reference in New Issue
Block a user