migrate to grunt 0.4
@ -49,33 +49,31 @@ function getFiles() {
|
||||
|
||||
//common js files
|
||||
var js = [
|
||||
'<banner:meta.banner>',
|
||||
forms+'editable-form.js',
|
||||
forms+'editable-form-utils.js',
|
||||
containers+'editable-container.js',
|
||||
containers+'editable-inline.js',
|
||||
lib+'element/editable-element.js',
|
||||
inputs+'abstract.js',
|
||||
inputs+'list.js',
|
||||
inputs+'text.js',
|
||||
inputs+'textarea.js',
|
||||
inputs+'select.js',
|
||||
inputs+'checklist.js',
|
||||
inputs+'html5types.js',
|
||||
inputs+'select2/select2.js',
|
||||
inputs+'combodate/lib/combodate.js',
|
||||
inputs+'combodate/combodate.js'
|
||||
forms+'editable-form.js',
|
||||
forms+'editable-form-utils.js',
|
||||
containers+'editable-container.js',
|
||||
containers+'editable-inline.js',
|
||||
lib+'element/editable-element.js',
|
||||
inputs+'abstract.js',
|
||||
inputs+'list.js',
|
||||
inputs+'text.js',
|
||||
inputs+'textarea.js',
|
||||
inputs+'select.js',
|
||||
inputs+'checklist.js',
|
||||
inputs+'html5types.js',
|
||||
inputs+'select2/select2.js',
|
||||
inputs+'combodate/lib/combodate.js',
|
||||
inputs+'combodate/combodate.js'
|
||||
];
|
||||
|
||||
//common css files
|
||||
var css = [
|
||||
'<banner:meta.banner>',
|
||||
forms+'editable-form.css',
|
||||
containers+'editable-container.css',
|
||||
lib+'element/editable-element.css'
|
||||
forms+'editable-form.css',
|
||||
containers+'editable-container.css',
|
||||
lib+'element/editable-element.css'
|
||||
];
|
||||
|
||||
//create 'concat' config
|
||||
//create 'concat' and 'uglify' tasks
|
||||
var task, folder, dest, concat_files = {}, min_files = {};
|
||||
for(var k in config) {
|
||||
folder = '<%= dist %>/'+k+'-editable/';
|
||||
@ -88,7 +86,7 @@ function getFiles() {
|
||||
dest: dest+'.js'
|
||||
};
|
||||
min_files[task] = {
|
||||
src: ['<banner:meta.banner>', '<config:concat.'+task+'.dest>'],
|
||||
src: ['<%= concat.'+task+'.dest %>'],
|
||||
dest: dest + '.min.js'
|
||||
};
|
||||
|
||||
@ -106,7 +104,14 @@ function getFiles() {
|
||||
/*global module:false*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
||||
|
||||
//version of jquery-ui datepicker to be copied into dist
|
||||
var dp_ui_ver = '1.10.3';
|
||||
@ -130,66 +135,75 @@ module.exports = function(grunt) {
|
||||
//get js and css for different builds
|
||||
var files = getFiles();
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: '<json:package.json>',
|
||||
dist: 'dist',
|
||||
meta: {
|
||||
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> \n' +
|
||||
var banner = '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> \n' +
|
||||
'* <%= pkg.description %>\n' +
|
||||
'* <%= pkg.homepage %>\n' +
|
||||
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
||||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
|
||||
},
|
||||
clean: ['<config:dist>'],
|
||||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n';
|
||||
|
||||
files.concat_files.options = {banner: banner};
|
||||
files.min_files.options = {banner: banner};
|
||||
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
dist: 'dist',
|
||||
|
||||
clean: ['<%= dist %>'],
|
||||
|
||||
concat: files.concat_files,
|
||||
min: files.min_files,
|
||||
|
||||
uglify: files.min_files,
|
||||
|
||||
qunit: {
|
||||
bootstrap: [
|
||||
bootstrap2: {
|
||||
options: {
|
||||
urls: [
|
||||
'http://localhost:8000/test/index.html?f=bootstrap&c=popup'+module,
|
||||
'http://localhost:8000/test/index.html?f=bootstrap&c=inline'+module
|
||||
],
|
||||
jqueryui: [
|
||||
]
|
||||
}
|
||||
},
|
||||
bootstrap3: {
|
||||
options: {
|
||||
urls: [
|
||||
'http://localhost:8000/test/index.html?f=bs3&c=popup'+module,
|
||||
'http://localhost:8000/test/index.html?f=bs3&c=inline'+module
|
||||
]
|
||||
}
|
||||
},
|
||||
jqueryui: {
|
||||
options: {
|
||||
urls:[
|
||||
'http://localhost:8000/test/index.html?f=jqueryui&c=popup'+module,
|
||||
'http://localhost:8000/test/index.html?f=jqueryui&c=inline'+module
|
||||
],
|
||||
plain: [
|
||||
]
|
||||
}
|
||||
},
|
||||
plain: {
|
||||
options: {
|
||||
urls:[
|
||||
'http://localhost:8000/test/index.html?f=plain&c=popup'+module,
|
||||
'http://localhost:8000/test/index.html?f=plain&c=inline'+module
|
||||
],
|
||||
]
|
||||
}
|
||||
},
|
||||
//test all builds under several versions of jquery
|
||||
testover: qunit_testover
|
||||
testover: {
|
||||
options: {
|
||||
urls:qunit_testover
|
||||
}
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 8000,
|
||||
base: '.'
|
||||
|
||||
connect: {
|
||||
server: {
|
||||
port: 8000,
|
||||
base: '.'
|
||||
}
|
||||
},
|
||||
|
||||
lint: {
|
||||
//TODO: lint tests files
|
||||
//files: ['grunt.js', 'src/js/*.js', 'test/**/*.js']
|
||||
files: ['grunt.js',
|
||||
'src/editable-form/*.js',
|
||||
'src/containers/*.js',
|
||||
'src/element/*.js',
|
||||
|
||||
'src/inputs/*.js',
|
||||
'src/inputs/date/*.js',
|
||||
'src/inputs/dateui/*.js',
|
||||
'src/inputs/datetime/*.js',
|
||||
'src/inputs/combodate/*.js',
|
||||
'src/inputs/select2/*.js',
|
||||
|
||||
'src/inputs-ext/address/*.js',
|
||||
'src/inputs-ext/wysihtml5/*.js'
|
||||
]
|
||||
},
|
||||
/*
|
||||
watch: {
|
||||
files: '<config:lint.files>',
|
||||
tasks: 'lint qunit'
|
||||
},
|
||||
*/
|
||||
jshint: {
|
||||
options: {
|
||||
curly: true,
|
||||
@ -203,11 +217,26 @@ module.exports = function(grunt) {
|
||||
boss: true,
|
||||
eqnull: true,
|
||||
browser: true,
|
||||
evil: false
|
||||
evil: false,
|
||||
globals: {
|
||||
jQuery: true
|
||||
},
|
||||
},
|
||||
globals: {
|
||||
jQuery: true
|
||||
}
|
||||
js: [ 'Gruntfile.js',
|
||||
'src/editable-form/*.js',
|
||||
'src/containers/*.js',
|
||||
'src/element/*.js',
|
||||
|
||||
'src/inputs/*.js',
|
||||
'src/inputs/date/*.js',
|
||||
'src/inputs/dateui/*.js',
|
||||
'src/inputs/datetime/*.js',
|
||||
'src/inputs/combodate/*.js',
|
||||
'src/inputs/select2/*.js',
|
||||
|
||||
'src/inputs-ext/address/*.js',
|
||||
'src/inputs-ext/wysihtml5/*.js'
|
||||
]
|
||||
},
|
||||
copy: {
|
||||
dist: {
|
||||
@ -238,22 +267,29 @@ module.exports = function(grunt) {
|
||||
'<%= dist %>/jquery-editable/jquery-ui-datepicker/css/redmond/images/': 'src/inputs/dateui/jquery-ui-datepicker/css/redmond/images/**'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {}
|
||||
}
|
||||
});
|
||||
|
||||
//test task
|
||||
grunt.registerTask('test', 'lint server qunit:bootstrap');
|
||||
grunt.registerTask('testall', 'lint server qunit:bootstrap qunit:jqueryui qunit:plain');
|
||||
grunt.registerTask('testover', 'lint server qunit:testover');
|
||||
grunt.registerTask('test', ['jshint', 'connect', 'qunit:bootstrap2']);
|
||||
grunt.registerTask('testall', [
|
||||
'jshint',
|
||||
'connect',
|
||||
'qunit:bootstrap2',
|
||||
'qunit:bootstrap3',
|
||||
'qunit:jqueryui',
|
||||
'qunit:plain'
|
||||
]);
|
||||
grunt.registerTask('testover', ['jshint', 'connect', 'qunit:testover']);
|
||||
|
||||
// Default task.
|
||||
// grunt.registerTask('default', 'lint qunit');
|
||||
grunt.registerTask('default', 'clean lint concat min copy');
|
||||
grunt.registerTask('default', ['clean', 'jshint', 'concat', 'uglify', 'copy']);
|
||||
|
||||
|
||||
grunt.registerTask('server', 'connect:server:keepalive');
|
||||
|
||||
// build
|
||||
grunt.registerTask('build', 'clean lint concat min copy');
|
||||
grunt.registerTask('build', ['clean', 'jshint', 'concat', 'uglify', 'copy']);
|
||||
|
||||
//to run particular task use ":", e.g. copy:libs
|
||||
};
|
4
dist/CHANGELOG.txt
vendored
@ -1,6 +1,10 @@
|
||||
X-editable changelog
|
||||
=============================
|
||||
|
||||
Version 1.4.7 wip
|
||||
----------------------------
|
||||
|
||||
|
||||
Version 1.4.6 Aug 8, 2013
|
||||
----------------------------
|
||||
[bug #312] can't apply selector more than once (vitalets)
|
||||
|
@ -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 */
|
||||
|
||||
.editableform {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
}
|
||||
|
Before ![]() (image error) Size: 509 B After ![]() (image error) Size: 509 B ![]() ![]() |
0
dist/bootstrap-editable/img/loading.gif → dist/bootstrap-editable/img/src/img/loading.gif
vendored
Before ![]() (image error) Size: 1.8 KiB After ![]() (image error) Size: 1.8 KiB ![]() ![]() |
61
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
@ -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) {
|
||||
@ -4468,15 +4480,33 @@ $(function(){
|
||||
}(window.jQuery));
|
||||
|
||||
/*
|
||||
Editableform based on Twitter Bootstrap
|
||||
Editableform based on Twitter Bootstrap 2
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
//store parent methods
|
||||
var pInitInput = $.fn.editableform.Constructor.prototype.initInput;
|
||||
|
||||
$.extend($.fn.editableform.Constructor.prototype, {
|
||||
initTemplate: function() {
|
||||
this.$form = $($.fn.editableform.template);
|
||||
this.$form.find('.editable-error-block').addClass('help-block');
|
||||
},
|
||||
initInput: function() {
|
||||
pInitInput.apply(this);
|
||||
|
||||
//for bs2 set default class `input-medium` to standard inputs
|
||||
var emptyInputClass = this.input.options.inputclass === null || this.input.options.inputclass === false;
|
||||
var defaultClass = 'input-medium';
|
||||
|
||||
//add bs2 default class to standard inputs
|
||||
//if(this.input.$input.is('input,select,textarea')) {
|
||||
var stdtypes = 'text,select,textarea,password,email,url,tel,number,range,time'.split(',');
|
||||
if(~$.inArray(this.input.type, stdtypes) && emptyInputClass) {
|
||||
this.input.options.inputclass = defaultClass;
|
||||
this.input.$input.addClass(defaultClass);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -4486,7 +4516,9 @@ Editableform based on Twitter Bootstrap
|
||||
|
||||
//error classes
|
||||
$.fn.editableform.errorGroupClass = 'error';
|
||||
$.fn.editableform.errorBlockClass = null;
|
||||
$.fn.editableform.errorBlockClass = null;
|
||||
//engine
|
||||
$.fn.editableform.engine = 'bs2';
|
||||
|
||||
}(window.jQuery));
|
||||
/**
|
||||
@ -4502,13 +4534,14 @@ Editableform based on Twitter Bootstrap
|
||||
containerName: 'popover',
|
||||
//for compatibility with bootstrap <= 2.2.1 (content inserted into <p> instead of directly .popover-content)
|
||||
innerCss: $.fn.popover && $($.fn.popover.defaults.template).find('p').length ? '.popover-content p' : '.popover-content',
|
||||
|
||||
defaults: $.fn.popover.defaults,
|
||||
|
||||
initContainer: function(){
|
||||
$.extend(this.containerOptions, {
|
||||
trigger: 'manual',
|
||||
selector: false,
|
||||
content: ' ',
|
||||
template: $.fn.popover.defaults.template
|
||||
template: this.defaults.template
|
||||
});
|
||||
|
||||
//as template property is used in inputs, hide it from popover
|
||||
|
0
dist/inputs-ext/wysihtml5/wysihtml5.js → dist/inputs-ext/src/inputs-ext/wysihtml5/wysihtml5.js
vendored
1
dist/jquery-editable/css/jquery-editable.css
vendored
@ -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 */
|
||||
|
||||
.editableform {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
}
|
||||
|
Before ![]() (image error) Size: 509 B After ![]() (image error) Size: 509 B ![]() ![]() |
Before ![]() (image error) Size: 1.8 KiB After ![]() (image error) Size: 1.8 KiB ![]() ![]() |
Before ![]() (image error) Size: 1.7 KiB After ![]() (image error) Size: 1.7 KiB ![]() ![]() |
Before ![]() (image error) Size: 212 B After ![]() (image error) Size: 212 B ![]() ![]() |
Before ![]() (image error) Size: 206 B After ![]() (image error) Size: 206 B ![]() ![]() |
Before ![]() (image error) Size: 336 B After ![]() (image error) Size: 336 B ![]() ![]() |
Before ![]() (image error) Size: 341 B After ![]() (image error) Size: 341 B ![]() ![]() |
Before ![]() (image error) Size: 332 B After ![]() (image error) Size: 332 B ![]() ![]() |
Before ![]() (image error) Size: 5.7 KiB After ![]() (image error) Size: 5.7 KiB ![]() ![]() |
Before ![]() (image error) Size: 333 B After ![]() (image error) Size: 333 B ![]() ![]() |
Before ![]() (image error) Size: 292 B After ![]() (image error) Size: 292 B ![]() ![]() |
Before ![]() (image error) Size: 4.4 KiB After ![]() (image error) Size: 4.4 KiB ![]() ![]() |
Before ![]() (image error) Size: 4.4 KiB After ![]() (image error) Size: 4.4 KiB ![]() ![]() |
Before ![]() (image error) Size: 4.4 KiB After ![]() (image error) Size: 4.4 KiB ![]() ![]() |
Before ![]() (image error) Size: 4.4 KiB After ![]() (image error) Size: 4.4 KiB ![]() ![]() |
Before ![]() (image error) Size: 4.4 KiB After ![]() (image error) Size: 4.4 KiB ![]() ![]() |
Before ![]() (image error) Size: 4.4 KiB After ![]() (image error) Size: 4.4 KiB ![]() ![]() |
Before ![]() (image error) Size: 4.4 KiB After ![]() (image error) Size: 4.4 KiB ![]() ![]() |
@ -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();
|
||||
|
@ -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 */
|
||||
|
||||
.editableform {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
}
|
||||
|
Before ![]() (image error) Size: 509 B After ![]() (image error) Size: 509 B ![]() ![]() |
Before ![]() (image error) Size: 1.8 KiB After ![]() (image error) Size: 1.8 KiB ![]() ![]() |
39
dist/jqueryui-editable/js/jqueryui-editable.js
vendored
@ -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) {
|
||||
@ -4495,6 +4507,8 @@ Editableform based on jQuery UI
|
||||
//error classes
|
||||
$.fn.editableform.errorGroupClass = null;
|
||||
$.fn.editableform.errorBlockClass = 'ui-state-error';
|
||||
//engine
|
||||
$.fn.editableform.engine = 'jqeury-ui';
|
||||
|
||||
}(window.jQuery));
|
||||
/**
|
||||
@ -4511,6 +4525,7 @@ Editableform based on jQuery UI
|
||||
//object name in element's .data()
|
||||
containerDataName: 'ui-tooltip',
|
||||
innerCss: '.ui-tooltip-content',
|
||||
defaults: $.ui.tooltip.prototype.options,
|
||||
|
||||
//split options on containerOptions and formOptions
|
||||
splitOptions: function() {
|
||||
@ -4522,10 +4537,10 @@ Editableform based on jQuery UI
|
||||
$.error('Please use jQueryUI with "tooltip" widget! http://jqueryui.com/download');
|
||||
return;
|
||||
}
|
||||
|
||||
//defaults for tooltip
|
||||
var cDef = $.ui[this.containerName].prototype.options;
|
||||
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];
|
||||
|
19
package.json
@ -21,12 +21,17 @@
|
||||
"url": "https://github.com/vitalets/x-editable/blob/master/LICENSE-MIT"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.3.11",
|
||||
"grunt-contrib": "0.1.1"
|
||||
},
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-contrib-clean": "~0.5.0",
|
||||
"grunt-contrib-concat": "~0.3.0",
|
||||
"grunt-contrib-uglify": "~0.2.2",
|
||||
"grunt-contrib-qunit": "~0.2.2",
|
||||
"grunt-contrib-connect": "~0.3.0",
|
||||
"grunt-contrib-jshint": "~0.6.4",
|
||||
"grunt-contrib-copy": "~0.4.1",
|
||||
"grunt-contrib-requirejs": "~0.4.1"
|
||||
},
|
||||
"keywords": []
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@
|
||||
/**
|
||||
* move popover to new position. This function mainly copied from bootstrap-popover.
|
||||
*/
|
||||
/*jshint laxcomma: true*/
|
||||
/*jshint laxcomma: true, eqeqeq: false*/
|
||||
setPosition: function () {
|
||||
|
||||
(function() {
|
||||
@ -192,7 +192,7 @@
|
||||
|
||||
|
||||
}).call(this.container());
|
||||
/*jshint laxcomma: false*/
|
||||
/*jshint laxcomma: false, eqeqeq: true*/
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,28 +1,27 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test X-editable</title>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
//console.log('onlonad');
|
||||
QUnit.config.autostart = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- <script data-main="main.js" src="require-jquery.js"></script>-->
|
||||
<script data-main="main.js" src="require.js"></script>
|
||||
<script data-main="main.js" src="require.js"></script>
|
||||
|
||||
<!-- qunit (should be included here, otherwise phantomjs hangs-up on several tests )-->
|
||||
<link rel="stylesheet" href="libs/qunit/qunit-1.12.0.css" type="text/css" media="screen" />
|
||||
<script src="libs/qunit/qunit-1.12.0.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="libs/qunit/qunit-1.12.0.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
<div id="qunit-fixture1"></div>
|
||||
<div id="async-fixture" style="padding-left:300px"></div>
|
||||
</div>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
<div id="qunit-fixture1"></div>
|
||||
<div id="async-fixture" style="padding-left:300px"></div>
|
||||
<script src="libs/qunit/qunit-1.12.0.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -8,7 +8,7 @@ var jqver = decodeURIComponent((new RegExp('[?|&]' + 'jquery' + '=' + '([^&;]+?)
|
||||
jqurl = jqver ? "http://code.jquery.com/jquery-"+jqver+".min.js" : "libs/jquery/jquery-1.9.1.min.js";
|
||||
|
||||
require(["loader", jqurl], function(loader) {
|
||||
|
||||
|
||||
var config = loader.getConfig("../src"),
|
||||
params = loader.getParams();
|
||||
|
||||
|