2014-07-06 17:37:54 +02:00
|
|
|
export default Em.View.extend({
|
2014-07-06 19:22:38 +02:00
|
|
|
classNames: ['datepicker'],
|
|
|
|
|
|
|
|
didInsertElement: function() {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
this._super();
|
|
|
|
|
|
|
|
$('.datepicker').datepicker({
|
|
|
|
format: "yyyy-mm-dd hh:mm:ss",
|
|
|
|
multidate: true,
|
|
|
|
multidateSeparator: ";",
|
|
|
|
calendarWeeks: true,
|
|
|
|
todayHighlight: true,
|
|
|
|
})
|
|
|
|
// bind date changes to option array in model
|
|
|
|
.on('changeDate', function(e){
|
|
|
|
var dates = e.dates,
|
|
|
|
newOptions = [];
|
|
|
|
|
|
|
|
// sort dates
|
|
|
|
dates.sort(function(a,b){
|
|
|
|
return new Date(a) - new Date(b);
|
|
|
|
});
|
|
|
|
|
|
|
|
// get array in correct form
|
|
|
|
dates.forEach(function(option) {
|
|
|
|
newOptions.pushObject({title: option});
|
|
|
|
});
|
|
|
|
|
|
|
|
// set options
|
|
|
|
self.set('_parentView.controller.options', newOptions);
|
|
|
|
});
|
|
|
|
}
|
2014-07-06 17:37:54 +02:00
|
|
|
});
|