Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e0ab55dbc | ||
|
|
7d8c1b9b63 | ||
|
|
c119fde387 | ||
|
|
98a1c25452 | ||
|
|
69221eb7eb | ||
|
|
46f7c743d0 | ||
|
|
1da2758e29 | ||
|
|
f41ff62794 | ||
|
|
8e1d3170b4 | ||
|
|
8a2efefa74 | ||
|
|
6b8d2a2fee | ||
|
|
7aaf95b05c | ||
|
|
3d066126fd | ||
|
|
5e866af345 | ||
|
|
8a114f3459 | ||
|
|
166aa05f02 | ||
|
|
efd5188e6b | ||
|
|
3868975a9c | ||
|
|
d66840a9cc | ||
|
|
9b0dcfbc76 | ||
|
|
b1d79e8fc5 | ||
|
|
5d8ecf3507 | ||
|
|
ce857e479d | ||
|
|
8042bf393d | ||
|
|
eb82f6ba85 | ||
|
|
b19cbe7ac8 | ||
|
|
e3333dc723 | ||
|
|
f30f1a866a | ||
|
|
56c8b5d552 | ||
|
|
e5e765891e | ||
|
|
115a656b93 | ||
|
|
764eb666a8 | ||
|
|
95d147a553 | ||
|
|
f74605d782 | ||
|
|
c51bbdb745 | ||
|
|
4fbac11f62 | ||
|
|
53d675cb64 |
+2
-1
@@ -1,4 +1,5 @@
|
||||
node_modules
|
||||
test/instrumented/
|
||||
*.nupkg
|
||||
*.orig
|
||||
*.orig
|
||||
/roadmap.txt
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
## How to contribute
|
||||
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 machine:
|
||||
````
|
||||
git clone https://github.com/<your-github-name>/x-editable.git
|
||||
````
|
||||
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 `develop` branch).
|
||||
|
||||
Thanks for your support!
|
||||
|
||||
### Local build
|
||||
To build x-editable locally please run:
|
||||
````
|
||||
grunt build
|
||||
````
|
||||
Result will appear in `dist` directory.
|
||||
@@ -1,25 +1,27 @@
|
||||
# X-editable
|
||||
|
||||
In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery.
|
||||
|
||||
PLEASE SUBMIT ALL PULL REQUESTS TO THE 'dev' BRANCH!
|
||||
## Contents
|
||||
* [Live Demo](#live-demo)
|
||||
* [Installation](#installation)
|
||||
* [Manual download](#manual-download)
|
||||
* [Bower](#bower)
|
||||
* [CDN](#cdn)
|
||||
* [Getting Started](#getting-started)
|
||||
* [Documentation](#documentation)
|
||||
* [Issue Tracker](#issue-tracker)
|
||||
* [Project Status](#project-status)
|
||||
* [Contribution](#contribution)
|
||||
* [Backers](#backers)
|
||||
* [License](#license)
|
||||
|
||||
## 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
|
||||
Visit [X-editable demo](http://vitalets.github.io/x-editable/demo.html) to see all controls in action.
|
||||
|
||||
## Live demo
|
||||
**http://vitalets.github.io/x-editable/demo.html**
|
||||
|
||||
## Documentation
|
||||
**http://vitalets.github.io/x-editable**
|
||||
|
||||
## How to get it
|
||||
## Installation
|
||||
|
||||
### Manual download
|
||||
Use **http://vitalets.github.io/x-editable** main page.
|
||||
Use links on [X-editable home page](http://vitalets.github.io/x-editable).
|
||||
|
||||
### Bower
|
||||
````
|
||||
@@ -51,81 +53,31 @@ jQuery only build:
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/jquery-editable/js/jquery-editable-poshytip.min.js"></script>
|
||||
````
|
||||
|
||||
## Getting Started
|
||||
How to start using X-editable is described on [X-editable website](http://vitalets.github.io/x-editable/docs.html).
|
||||
|
||||
## 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/)
|
||||
## Documentation
|
||||
Documentation on all available widgets and code samples can be found on [X-editable website](http://vitalets.github.io/x-editable/docs.html).
|
||||
|
||||
## Issue Tracker
|
||||
Feel free to open [issues](https://github.com/vitalets/x-editable/issues).
|
||||
Please include working code sample in issue body. To save the time use these jsFiddle templates:
|
||||
1. [jsFiddle Bootstrap 3](http://jsfiddle.net/xBB5x/15155/)
|
||||
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!
|
||||
|
||||
## Project Status
|
||||
Not actively maintained.
|
||||
|
||||
## Contribution
|
||||
A few steps how to start contributing.
|
||||
Assuming you have [Node.js](http://nodejs.org/) already installed.
|
||||
Please submit all Pull Requests to the **develop** branch. More details are in [CONTRIBUTING.md](/CONTRIBUTING.md).
|
||||
|
||||
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:
|
||||
## Backers
|
||||
[](https://flatlogic.com/admin-dashboards)
|
||||
|
||||
* 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.
|
||||
Admin Dashboard Templates made with Vue, React and Angular by [Flatlogic](https://flatlogic.com/admin-dashboards).
|
||||
|
||||
## License
|
||||
Copyright (c) 2012 Vitaliy Potapov
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"src",
|
||||
"test"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jquery": ">=1.6"
|
||||
}
|
||||
|
||||
+26
-5
@@ -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
@@ -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
@@ -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
@@ -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));
|
||||
|
||||
Generated
+2893
File diff suppressed because it is too large
Load Diff
+20
-14
@@ -15,23 +15,29 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/vitalets/x-editable/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"precommit": "grunt jshint",
|
||||
"prepush": "grunt jshint"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-cli": "^1.3.2",
|
||||
"grunt-contrib-clean": "~0.5.0",
|
||||
"grunt-contrib-concat": "~0.3.0",
|
||||
"grunt-contrib-connect": "~0.3.0",
|
||||
"grunt-contrib-copy": "~0.4.1",
|
||||
"grunt-contrib-jshint": "~0.6.4",
|
||||
"grunt-contrib-qunit": "~0.2.2",
|
||||
"grunt-contrib-requirejs": "~0.4.1",
|
||||
"grunt-contrib-uglify": "~0.2.2",
|
||||
"husky": "^0.14.3"
|
||||
},
|
||||
"keywords": [],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/vitalets/x-editable/blob/master/LICENSE-MIT"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"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": []
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,9 @@ $(function(){
|
||||
//e.g. '<img>', '<br>', '<p></p>'
|
||||
return !$element.height() || !$element.width();
|
||||
}
|
||||
},
|
||||
destroy:function (){
|
||||
this.$input.data('wysihtml5').editor.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ $(function(){
|
||||
template: 'D / MMMM / YYYY',
|
||||
combodate: {
|
||||
minYear: 2000,
|
||||
maxYear: 2015,
|
||||
maxYear: new Date().getFullYear(),
|
||||
minuteStep: 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
Vendored
+7
-7
@@ -88,7 +88,7 @@ $(function(){
|
||||
options.select2 = options.select2 || {};
|
||||
|
||||
this.sourceData = null;
|
||||
|
||||
|
||||
//placeholder
|
||||
if(options.placeholder) {
|
||||
options.select2.placeholder = options.placeholder;
|
||||
@@ -294,15 +294,15 @@ $(function(){
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
this.$input.select2('open');
|
||||
this.$input.select2('open');
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
if(this.$input) {
|
||||
if(this.$input.data('select2')) {
|
||||
this.$input.select2('destroy');
|
||||
}
|
||||
}
|
||||
if(this.$input) {
|
||||
if(this.$input.data('select2')) {
|
||||
this.$input.select2('destroy');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ $(function () {
|
||||
|
||||
});
|
||||
|
||||
// usefull functions
|
||||
// useful functions
|
||||
|
||||
function tip(e) {
|
||||
return e.data('editableContainer').tip();
|
||||
|
||||
+5
-2
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user