Skip to content

Commit

Permalink
Merge pull request #1042 from gregmolnar/fix_bs4_datepicker
Browse files Browse the repository at this point in the history
Fix bs4 datepicker
  • Loading branch information
MarQuisKnox authored Sep 19, 2017
2 parents 6b8d2a2 + 5e866af commit 8a2efef
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/inputs/date/datefield.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand All @@ -75,7 +75,7 @@ Automatically shown in inline mode.
autoclose: true
}
});

$.fn.editabletypes.datefield = DateField;

}(window.jQuery));
}(window.jQuery));

0 comments on commit 8a2efef

Please sign in to comment.