combodate options via data attribute, fixes #132
This commit is contained in:
parent
3270e5e4b7
commit
7533a0cc72
@ -5,6 +5,7 @@ X-editable changelog
|
||||
|
||||
Version 1.4.2 wip
|
||||
----------------------------
|
||||
[enh #132] combodate options can be defined via data-combodate json string (vitalets)
|
||||
[enh] source defined as function now has scope of element and can return string used as url (vitalets)
|
||||
[bug #99] select2 with Hierarchical Data (kev360)
|
||||
[bug #81] wysihtml5: fix inserting image (vitalets)
|
||||
|
@ -48,6 +48,9 @@ $(function(){
|
||||
this.options.viewformat = this.options.format;
|
||||
}
|
||||
|
||||
//try parse combodate config defined as json string in data-combodate
|
||||
options.combodate = $.fn.editableutils.tryParseJson(options.combodate, true);
|
||||
|
||||
//overriding combodate config (as by default jQuery extend() is not recursive)
|
||||
this.options.combodate = $.extend({}, Constructor.defaults.combodate, options.combodate, {
|
||||
format: this.options.format,
|
||||
|
@ -13,6 +13,20 @@ $(function () {
|
||||
}
|
||||
});
|
||||
|
||||
test("combodate options can be defined in data-combodate param", function () {
|
||||
var e = $('<a href="#" data-type="combodate" data-combodate="{minYear: 2000, maxYear: 2001}" data-pk="1" data-url="/combodate"></a>').appendTo('#qunit-fixture').editable({
|
||||
format: fd,
|
||||
viewformat: vfd,
|
||||
template: fd
|
||||
}),
|
||||
m = moment(vd, vfd);
|
||||
|
||||
e.click();
|
||||
var p = tip(e);
|
||||
equal(p.find('.year option').length, 3, 'years applied correct');
|
||||
});
|
||||
|
||||
|
||||
asyncTest("container should contain combodate and save new value (date)", function () {
|
||||
|
||||
var e = $('<a href="#" data-type="combodate" data-pk="1" data-url="/combodate">'+vd+'</a>').appendTo(fx).editable({
|
||||
|
Loading…
x
Reference in New Issue
Block a user