rename cancelnochange into savenochange

This commit is contained in:
vitalets
2012-12-06 21:19:33 +04:00
parent 19a6dabbae
commit 48a665c7f2
4 changed files with 11 additions and 11 deletions

@ -18,7 +18,7 @@ Version 1.2.0 wip
[enh] new option: 'display' callback. Makes far more flexible rendering value into element's text. (vitalets) [enh] new option: 'display' callback. Makes far more flexible rendering value into element's text. (vitalets)
[bug] fix typos (atrophic) [bug] fix typos (atrophic)
[enh] all callbacks scope changed to element (vitalets) [enh] all callbacks scope changed to element (vitalets)
[enh] new option: 'cancelnochange' to cancel or submit value when it was not changed in form (vitalets) [enh] new option: 'savenochange' to save or cancel value when it was not changed in form (vitalets)
[enh] composite pk can be defined as JSON in data-pk attribute (vitalets) [enh] composite pk can be defined as JSON in data-pk attribute (vitalets)
[enh #30] new option 'sourceCache' true|false to disable cache for select (vitalets) [enh #30] new option 'sourceCache' true|false to disable cache for select (vitalets)
[bug #34] inputclass span* broken with fluid bootstrap layout. Classes changed to 'input-*'. (vitalets) [bug #34] inputclass span* broken with fluid bootstrap layout. Classes changed to 'input-*'. (vitalets)

@ -181,7 +181,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
//if value not changed --> cancel //if value not changed --> cancel
/*jslint eqeq: true*/ /*jslint eqeq: true*/
if (this.options.cancelnochange && this.input.value2str(newValue) == this.input.value2str(this.value)) { if (!this.options.savenochange && this.input.value2str(newValue) == this.input.value2str(this.value)) {
/*jslint eqeq: false*/ /*jslint eqeq: false*/
this.cancel(); this.cancel();
return; return;
@ -484,14 +484,14 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
**/ **/
scope: null, scope: null,
/** /**
Whether to cancel or submit value when it was not changed. Whether to save or cancel value when it was not changed but form was submitted
@property cancelnochange @property savenochange
@type boolean @type boolean
@default true @default false
@since 1.2.0 @since 1.2.0
**/ **/
cancelnochange: true savenochange: false
}; };
/* /*

@ -97,6 +97,7 @@ Makes editable any HTML element on the page. Applied as jQuery method.
@event init @event init
@param {Object} event event object @param {Object} event event object
@param {Object} editable editable instance @param {Object} editable editable instance
@since 1.2.0
**/ **/
this.$element.triggerHandler('init', this); this.$element.triggerHandler('init', this);
}, this)); }, this));
@ -522,7 +523,6 @@ Makes editable any HTML element on the page. Applied as jQuery method.
@default 'click' @default 'click'
**/ **/
toggle: 'click', toggle: 'click',
/** /**
Text shown when element is empty. Text shown when element is empty.

@ -390,10 +390,10 @@
}); });
asyncTest("cancelnochange: true", function () { asyncTest("savenochange: false", function () {
var v = 'abc', var v = 'abc',
e = $('<a href="#" data-type="text" data-pk="1" data-url="post-no.php" data-name="text1">'+v+'</a>').appendTo(fx).editable({ e = $('<a href="#" data-type="text" data-pk="1" data-url="post-no.php" data-name="text1">'+v+'</a>').appendTo(fx).editable({
cancelnochange: true savenochange: false
}), }),
req = 0; req = 0;
@ -418,10 +418,10 @@
}, timeout); }, timeout);
}); });
asyncTest("cancelnochange: false", function () { asyncTest("savenochange: true", function () {
var v = 'abc', var v = 'abc',
e = $('<a href="#" data-type="text" data-pk="1" data-url="post-yes.php" data-name="text1">'+v+'</a>').appendTo(fx).editable({ e = $('<a href="#" data-type="text" data-pk="1" data-url="post-yes.php" data-name="text1">'+v+'</a>').appendTo(fx).editable({
cancelnochange: false savenochange: true
}), }),
req = 0; req = 0;