29 Commits
Author SHA1 Message Date
MarQuis Knox 1737ddd3d3 Update README.md 2017-09-28 10:51:22 +02:00
MarQuis Knox 8a2efefa74 Merge pull request #1042 from gregmolnar/fix_bs4_datepicker
Fix bs4 datepicker
2017-09-19 14:11:55 +02:00
MarQuis Knox 6b8d2a2fee Merge pull request #1047 from transopac/develop
Fix for scenario with data-value="null" & no text content. Instead of "null", "Empty" is shown on UI.
2017-09-19 14:10:19 +02:00
Arpit Srivastava 7aaf95b05c Modified test case for scenario in which value "null" is picked up from the data-attribute 'data-value' of the HTML element (which has no text content). 2017-09-18 22:12:27 +05:30
Arpit Srivastava 3d066126fd When the editable HTML element has blank textContent, but has an attribute 'data-value' with the value "null", the editable shows the 'Empty' placeholder string. Instead, the string "null" should be visible on UI. This is occurring because the jQuery data() function used to retrieve the data attributes automatically converts the string "null" into a null value which gets ignored. The fix involves instead using the HTML Element's 'dataset' property for retrieving the map of data attribute keys & values - all as strings. 2017-09-18 22:12:07 +05:30
Greg Molnar 5e866af345 BS4 datepicker needs to be called on the input rather than container 2017-08-31 18:29:30 +02:00
Greg Molnar 8a114f3459 remove blank spaces 2017-08-31 18:28:49 +02:00
MarQuis Knox 166aa05f02 Merge pull request #993 from arichnad/develop
the license must be in the bower file for some tools to use it.
2017-04-19 19:39:38 +02:00
adrian efd5188e6b the license must be in the bower file for some tools to use it. 2017-04-18 17:43:24 -04:00
MarQuis Knox 3868975a9c Merge pull request #990 from Multithread/develop
Added maxLength Attribute to options
2017-04-13 19:49:55 +02:00
Multithread d66840a9cc Added Maxlength attribute to options 2017-04-13 17:00:08 +02:00
Multithread 9b0dcfbc76 Added Textarea Attrribute to options 2017-04-13 16:56:58 +02:00
MarQuis Knox b1d79e8fc5 Update README.md 2017-02-15 11:57:32 +01:00
MarQuis Knox 5d8ecf3507 Merge pull request #858 from PerformanceHorizonGroup/added-destroy-handler
handle the .destroy() call to properly remove the editor
2017-01-25 08:04:45 +01:00
MarQuis Knox ce857e479d Update bootstrap-editable.js 2017-01-24 13:46:31 +01:00
MarQuis Knox 8042bf393d Merge pull request #969 from galebnas/patch-2
Fix to work with select2 V 4.0.3 inline url source
2017-01-24 13:44:26 +01:00
MarQuis Knox eb82f6ba85 FIXED: styling 2017-01-24 13:43:47 +01:00
MarQuis Knox b19cbe7ac8 FIXED: maxYear 2017-01-24 13:40:51 +01:00
MarQuis Knox e3333dc723 Update combodate.js 2017-01-24 13:40:02 +01:00
galebnas f30f1a866a Fix to work with select2 V 4.0.3 inline url source
Fix to work with select2 V 4.0.3 inline url source
data-source="backend url"
2017-01-24 16:39:09 +04:00
MarQuis Knox 56c8b5d552 Update jquery-editable-poshytip.js 2017-01-24 13:39:02 +01:00
MarQuis Knox e5e765891e FIXED: maxYear 2017-01-24 13:38:07 +01:00
MarQuis Knox 115a656b93 FIXED: maxYear 2017-01-24 13:37:00 +01:00
MarQuis Knox 764eb666a8 FIXED: maxYear 2017-01-24 13:32:47 +01:00
MarQuis Knox 95d147a553 Update README.md 2017-01-21 16:24:16 +01:00
MarQuis Knox f74605d782 Merge pull request #966 from EdwardBetts/develop
FIXED:  misspelling of useful
2017-01-14 17:04:46 +01:00
Edward Betts c51bbdb745 fix misspelling of useful 2017-01-14 12:58:49 +00:00
MarQuis Knox 4fbac11f62 Update README.md 2017-01-10 15:50:02 +01:00
Georgi Kostov 53d675cb64 handle the .destroy() call to properly remove the editor 2016-01-21 12:23:22 +02:00
14 changed files with 97 additions and 187 deletions
+2 -131
View File
@@ -1,132 +1,3 @@
# X-editable
# X-editable Docker
In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery.
PLEASE SUBMIT ALL PULL REQUESTS TO THE 'dev' BRANCH!
## Project status
Unfortunately, **project is currently frozen**, as I don't have enough time for it.
You could try use it as is, but there may be some bugs with newer versions of dependend libraries (e.g. bootstrap).
I would really appreciate if someone take care of it.. See [#610](https://github.com/vitalets/x-editable/issues/610).
Vitalets.
## Live demo
**http://vitalets.github.io/x-editable/demo.html**
## Documentation
**http://vitalets.github.io/x-editable**
## How to get it
### Manual download
Use **http://vitalets.github.io/x-editable** main page.
### Bower
````
bower install x-editable
````
### CDN
Bootstrap 3 build:
````html
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/js/bootstrap-editable.min.js"></script>
````
Bootstrap 2 build:
````html
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap-editable/js/bootstrap-editable.min.js"></script>
````
jQuery UI build:
````html
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/jqueryui-editable/css/jqueryui-editable.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/jqueryui-editable/js/jqueryui-editable.min.js"></script>
````
jQuery only build:
````html
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/jquery-editable/css/jquery-editable.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/jquery-editable/js/jquery-editable-poshytip.min.js"></script>
````
## Reporting issues
Please **provide jsFiddle** when creating issues!
It's really saves much time. Use these as template:
1. [jsFiddle Bootstrap 3](http://jsfiddle.net/xBB5x/2265/)
2. [jsFiddle Bootstrap 2](http://jsfiddle.net/xBB5x/1817/)
3. [jsFiddle jQuery-ui](http://jsfiddle.net/xBB5x/2511/)
4. [jsFiddle jQuery](http://jsfiddle.net/xBB5x/197)
Your feedback is very appreciated!
## Contribution
A few steps how to start contributing.
Assuming you have [Node.js](http://nodejs.org/) already installed.
1.Fork *X-editable* on github and clone it to your local mashine:
````
git clone https://github.com/<your-github-name>/x-editable.git -b dev
````
2.Install *grunt-cli* globally (if not yet):
````
npm i -g grunt-cli
````
3.Install dependencies:
````
cd x-editable
npm i
````
4.Make your changes:
````
vim editable-form.js
````
5.Write some tests for your changes:
````
vim /test/unit/*.js
````
6.Run tests in cli:
````
grunt test
````
or directly in browser:
````
grunt server
````
and open http://127.0.0.1:8000/test
By default test run on bootstrap 3 popup version, but you can test any other build:
* bootstrap 3
* popup: http://127.0.0.1:8000/test/?f=bootstrap3&c=popup
* inline: http://127.0.0.1:8000/test/?f=bootstrap3&c=inline
* bootstrap 2
* popup: http://127.0.0.1:8000/test/?f=bootstrap2&c=popup
* inline: http://127.0.0.1:8000/test/?f=bootstrap2&c=inline
* jquery-ui
* popup: http://127.0.0.1:8000/test/?f=jqueryui&c=popup
* inline: http://127.0.0.1:8000/test/?f=jqueryui&c=inline
* jquery + poshytip
* popup: http://127.0.0.1:8000/test/?f=plain&c=popup
* inline: http://127.0.0.1:8000/test/?f=plain&c=inline
7.Commit and push back on github:
````
git add .
git commit -m'refactor editable form, fix #123'
git push origin
````
8.Make pull request on github (to `dev` branch).
Thanks for your support!
### Local build
To build x-editable locally please run:
````
grunt build
````
Result will appear in `dist` directory.
## License
Copyright (c) 2012 Vitaliy Potapov
Licensed under the MIT license.
A Docker-based version of X-editable
+1
View File
@@ -26,6 +26,7 @@
"src",
"test"
],
"license": "MIT",
"dependencies": {
"jquery": ">=1.6"
}
+26 -5
View File
@@ -261,7 +261,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
}
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
//it is usefull if you want to chnage value in url-function
//it is useful if you want to chnage value in url-function
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
newValue = res.newValue;
}
@@ -2925,6 +2925,7 @@ $(function(){
this.renderClear();
this.setClass();
this.setAttr('placeholder');
this.setAttr('maxlength');
},
activate: function() {
@@ -3016,7 +3017,16 @@ $(function(){
@default null
**/
placeholder: null,
/**
maxlength attribute of input.
@property placeholder
@type string
@default null
**/
maxlength: null,
/**
Whether to show `clear` button
@@ -3062,7 +3072,8 @@ $(function(){
render: function () {
this.setClass();
this.setAttr('placeholder');
this.setAttr('rows');
this.setAttr('rows');
this.setAttr('maxlength');
//ctrl + enter
this.$input.keydown(function (e) {
@@ -3129,6 +3140,16 @@ $(function(){
@default null
**/
placeholder: null,
/**
maxlength attribute of input.
@property placeholder
@type string
@default null
**/
maxlength: null,
/**
Number of rows in textarea
@@ -4445,7 +4466,7 @@ $(function(){
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
maxYear: new Date().getFullYear(),
yearDescending: true,
minuteStep: 5,
secondStep: 1,
@@ -7031,4 +7052,4 @@ $(function(){
$.fn.editabletypes.typeahead = Constructor;
}(window.jQuery));
}(window.jQuery));
+20 -9
View File
@@ -1,7 +1,7 @@
/*! X-editable - v1.5.3
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2015 Vitaliy Potapov; Licensed MIT */
* Copyright (c) 2015 - 2016 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.
@@ -261,7 +261,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
}
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
//it is usefull if you want to chnage value in url-function
//it is useful if you want to chnage value in url-function
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
newValue = res.newValue;
}
@@ -3727,13 +3727,24 @@ $(function(){
if (typeof source === 'string') {
options.select2.ajax = options.select2.ajax || {};
//some default ajax params
// default ajax params
if(!options.select2.ajax.dataType) {
options.select2.ajax.dataType = 'json';
}
if(!options.select2.ajax.data) {
options.select2.ajax.data = function(term) {return { query:term };};
options.select2.ajax.data = function(term) {
return {
query:term
};
};
}
if(!options.select2.ajax.results) {
options.select2.ajax.results = function(data) { return {results:data };};
if(!options.select2.ajax.processResults) {
options.select2.ajax.processResults = function(data) { return {results:data };};
}
options.select2.ajax.url = source;
} else {
//check format and convert x-editable format to select2 format (if needed)
@@ -4445,7 +4456,7 @@ $(function(){
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
maxYear: new Date().getFullYear(),
yearDescending: true,
minuteStep: 5,
secondStep: 1,
@@ -4485,7 +4496,7 @@ $(function(){
template: 'D / MMMM / YYYY',
combodate: {
minYear: 2000,
maxYear: 2015,
maxYear: new Date().getFullYear(),
minuteStep: 1
}
}
@@ -6831,4 +6842,4 @@ Automatically shown in inline mode.
$.fn.editabletypes.datetimefield = DateTimeField;
}(window.jQuery));
}(window.jQuery));
+4 -4
View File
@@ -261,7 +261,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
}
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
//it is usefull if you want to chnage value in url-function
//it is useful if you want to chnage value in url-function
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
newValue = res.newValue;
}
@@ -4445,7 +4445,7 @@ $(function(){
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
maxYear: new Date().getFullYear(),
yearDescending: true,
minuteStep: 5,
secondStep: 1,
@@ -4485,7 +4485,7 @@ $(function(){
template: 'D / MMMM / YYYY',
combodate: {
minYear: 2000,
maxYear: 2015,
maxYear: new Date().getFullYear(),
minuteStep: 1
}
}
@@ -5142,4 +5142,4 @@ Automatically shown in inline mode.
$.fn.editabletypes.dateuifield = DateUIField;
}(window.jQuery));
}(window.jQuery));
+4 -4
View File
@@ -261,7 +261,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
}
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
//it is usefull if you want to chnage value in url-function
//it is useful if you want to chnage value in url-function
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
newValue = res.newValue;
}
@@ -4445,7 +4445,7 @@ $(function(){
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
maxYear: new Date().getFullYear(),
yearDescending: true,
minuteStep: 5,
secondStep: 1,
@@ -4485,7 +4485,7 @@ $(function(){
template: 'D / MMMM / YYYY',
combodate: {
minYear: 2000,
maxYear: 2015,
maxYear: new Date().getFullYear(),
minuteStep: 1
}
}
@@ -5089,4 +5089,4 @@ Automatically shown in inline mode.
$.fn.editabletypes.dateuifield = DateUIField;
}(window.jQuery));
}(window.jQuery));
+1 -1
View File
@@ -95,7 +95,7 @@
*/
getConfigData: function($element) {
var data = {};
$.each($element.data(), function(k, v) {
$.each($element[0].dataset, function(k, v) {
if(typeof v !== 'object' || (v && typeof v === 'object' && (v.constructor === Object || v.constructor === Array))) {
data[k] = v;
}
+1 -1
View File
@@ -257,7 +257,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
}
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
//it is usefull if you want to chnage value in url-function
//it is useful if you want to chnage value in url-function
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
newValue = res.newValue;
}
+3
View File
@@ -98,6 +98,9 @@ $(function(){
//e.g. '<img>', '<br>', '<p></p>'
return !$element.height() || !$element.width();
}
},
destroy:function (){
this.$input.data('wysihtml5').editor.destroy();
}
});
+1 -1
View File
@@ -27,7 +27,7 @@ $(function(){
template: 'D / MMMM / YYYY',
combodate: {
minYear: 2000,
maxYear: 2015,
maxYear: new Date().getFullYear(),
minuteStep: 1
}
}
+2 -2
View File
@@ -510,7 +510,7 @@
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
maxYear: new Date().getFullYear(),
yearDescending: true,
minuteStep: 5,
secondStep: 1,
@@ -521,4 +521,4 @@
smartDays: false // whether days in combo depend on selected month: 31, 30, 28
};
}(window.jQuery));
}(window.jQuery));
+26 -26
View File
@@ -1,6 +1,6 @@
/**
Bootstrap datefield input - modification for inline mode.
Shows normal <input type="text"> and binds popup datepicker.
Shows normal <input type="text"> and binds popup datepicker.
Automatically shown in inline mode.
@class datefield
@@ -10,63 +10,63 @@ Automatically shown in inline mode.
**/
(function ($) {
"use strict";
var DateField = function (options) {
this.init('datefield', options, DateField.defaults);
this.initPicker(options, DateField.defaults);
};
$.fn.editableutils.inherit(DateField, $.fn.editabletypes.date);
$.fn.editableutils.inherit(DateField, $.fn.editabletypes.date);
$.extend(DateField.prototype, {
render: function () {
this.$input = this.$tpl.find('input');
this.setClass();
this.setAttr('placeholder');
//bootstrap-datepicker is set `bdateicker` to exclude conflict with jQuery UI one. (in date.js)
this.$tpl.bdatepicker(this.options.datepicker);
//bootstrap-datepicker is set `bdateicker` to exclude conflict with jQuery UI one. (in date.js)
this.$input.bdatepicker(this.options.datepicker);
//need to disable original event handlers
this.$input.off('focus keydown');
//update value of datepicker
this.$input.keyup($.proxy(function(){
this.$tpl.removeData('date');
this.$tpl.bdatepicker('update');
}, this));
},
},
value2input: function(value) {
this.$input.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '');
this.$tpl.bdatepicker('update');
},
input2value: function() {
input2value: function() {
return this.html2value(this.$input.val());
},
},
activate: function() {
$.fn.editabletypes.text.prototype.activate.call(this);
},
autosubmit: function() {
//reset autosubmit to empty
//reset autosubmit to empty
}
});
DateField.defaults = $.extend({}, $.fn.editabletypes.date.defaults, {
/**
@property tpl
**/
@property tpl
**/
tpl:'<div class="input-append date"><input type="text"/><span class="add-on"><i class="icon-th"></i></span></div>',
/**
@property inputclass
@property inputclass
@default 'input-small'
**/
**/
inputclass: 'input-small',
/* datepicker config */
datepicker: {
weekStart: 0,
@@ -75,7 +75,7 @@ Automatically shown in inline mode.
autoclose: true
}
});
$.fn.editabletypes.datefield = DateField;
}(window.jQuery));
}(window.jQuery));
+1 -1
View File
@@ -67,7 +67,7 @@ $(function () {
});
// usefull functions
// useful functions
function tip(e) {
return e.data('editableContainer').tip();
+5 -2
View File
@@ -49,7 +49,8 @@
esc_v = $('<div>').text(v).html(),
e = $('<a href="#123" data-name="abc" data-value="123">qwe</a>').appendTo('#qunit-fixture').editable(),
e2 = $('<a href="#" id="a2">'+v+'</a>').appendTo('#qunit-fixture').editable(),
e3 = $('<a href="#" id="a3">'+esc_v+'</a>').appendTo('#qunit-fixture').editable();
e3 = $('<a href="#" id="a3">'+esc_v+'</a>').appendTo('#qunit-fixture').editable(),
e4 = $('<a href="#" id="a4" data-value="null"></a>').appendTo('#qunit-fixture').editable();
equal(e.data('editable').options.name, 'abc', 'name exists');
equal(e.data('editable').value, '123', 'value exists');
@@ -59,7 +60,9 @@
// equal(e2.data('editable').lastSavedValue, visible_v, 'lastSavedValue taken from text correctly');
equal(e3.data('editable').value, v, 'value taken from elem content correctly (escaped)');
// equal(e3.data('editable').lastSavedValue, v, 'lastSavedValue taken from text correctly (escaped)');
// equal(e3.data('editable').lastSavedValue, v, 'lastSavedValue taken from text correctly (escaped)');
equal(e4.data('editable').value, "null", 'value "null" taken from elem\'s data-attribute "data-value" correctly');
});
test("container's title and placement from json options", function () {