migrate to grunt 0.4

This commit is contained in:
vitalets
2013-08-31 13:15:19 +04:00
parent 0c1ea90005
commit 0abd9831ae
50 changed files with 250 additions and 144 deletions

@@ -2,7 +2,6 @@
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
/**
Form with single input element, two buttons and two states: normal/loading.
Applied as jQuery method to DIV tag (not to form tag!). This is because form can be in loading state when spinner shown.
@@ -33,6 +32,9 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
//set initial value
//todo: may be add check: typeof str === 'string' ?
this.value = this.input.str2value(this.options.value);
//prerender: get input.$input
this.input.prerender();
},
initTemplate: function() {
this.$form = $($.fn.editableform.template);
@@ -80,9 +82,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
this.initInput();
//append input to form
this.input.prerender();
this.$form.find('div.editable-input').append(this.input.$tpl);
//append form to container
this.$div.append(this.$form);
@@ -620,6 +621,9 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
//error class attached to editable-error-block
$.fn.editableform.errorBlockClass = 'editable-error';
//engine
$.fn.editableform.engine = 'jqeury';
}(window.jQuery));
/**
@@ -898,6 +902,8 @@ Applied as jQuery method.
containerDataName: null, //object name in element's .data()
innerCss: null, //tbd in child class
containerClass: 'editable-container editable-popup', //css class applied to container element
defaults: {}, //container itself defaults
init: function(element, options) {
this.$element = $(element);
//since 1.4.1 container do not use data-* directly as they already merged into options.
@@ -975,10 +981,9 @@ Applied as jQuery method.
throw new Error(this.containerName + ' not found. Have you included corresponding js file?');
}
var cDef = $.fn[this.containerName].defaults;
//keys defined in container defaults go to container, others go to form
for(var k in this.options) {
if(k in cDef) {
if(k in this.defaults) {
this.containerOptions[k] = this.options[k];
} else {
this.formOptions[k] = this.options[k];
@@ -2249,7 +2254,7 @@ Makes editable any HTML element on the page. Applied as jQuery method.
@since 1.4.5
@default #FFFF80
**/
highlight: '#FFFF80'
highlight: '#FFFF80'
};
}(window.jQuery));
@@ -2415,7 +2420,7 @@ To create your own input you can inherit from this class.
},
// -------- helper functions --------
setClass: function() {
setClass: function() {
if(this.options.inputclass) {
this.$input.addClass(this.options.inputclass);
}
@@ -2447,9 +2452,9 @@ To create your own input you can inherit from this class.
@property inputclass
@type string
@default input-medium
@default null
**/
inputclass: 'input-medium',
inputclass: null,
//scope for external methods (e.g. source defined as function)
//for internal use only
scope: null,
@@ -3817,7 +3822,7 @@ $(function(){
@type string
@default ', '
**/
viewseparator: ', '
viewseparator: ', '
});
$.fn.editabletypes.select2 = Constructor;
@@ -4343,7 +4348,14 @@ $(function(){
$.extend(Constructor.prototype, {
render: function () {
this.$input.combodate(this.options.combodate);
if($.fn.editableform.engine === 'bs3') {
this.$input.siblings().find('select').addClass('form-control');
}
if(this.options.inputclass) {
this.$input.siblings().find('select').addClass(this.options.inputclass);
}
//"clear" link
/*
if(this.options.clear) {
@@ -4479,6 +4491,7 @@ $(function(){
$.extend($.fn.editableContainer.Popup.prototype, {
containerName: 'poshytip',
innerCss: 'div.tip-inner',
defaults: $.fn.poshytip.defaults,
initContainer: function(){
this.handlePlacement();