Skip to content

Instantly share code, notes, and snippets.

@alastair-mcdonald
Last active March 21, 2017 13:51
Show Gist options
  • Select an option

  • Save alastair-mcdonald/98569a62c3d07bff645ceb6373ab2392 to your computer and use it in GitHub Desktop.

Select an option

Save alastair-mcdonald/98569a62c3d07bff645ceb6373ab2392 to your computer and use it in GitHub Desktop.
Show missing endTime property from scheduler view object
<template>
<require from="aurelia-kendoui-bridge/scheduler/scheduler"></require>
<ak-scheduler
k-timezone.bind="Etc/UTC"
k-date.bind="date"
k-views.bind="[
{type: 'month', selected: true},
'week',
'day',
'agenda'
]"
k-height.bind="650"
k-editable.bind="true"
k-widget.bind="scheduler">
</ak-scheduler>
</template>
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
define(["require", "exports", "aurelia-framework", "aurelia-dependency-injection", "DiaryService"], function (require, exports, aurelia_framework_1, aurelia_dependency_injection_1, fake_diary_service_1) {
"use strict";
var Diary = (function () {
function Diary(taskQueue, diaryService) {
this.taskQueue = taskQueue;
this.date = new Date();
this.diaryService = diaryService;
}
Diary.prototype.getAppointments = function () {
var self = this;
return this.diaryService.fetchAppointments()
.then(function (appointments) {
return Promise.resolve(appointments);
});
};
Diary.prototype.setKendoDataSource = function () {
var self = this;
self.dataSource = new kendo.data.SchedulerDataSource({
transport: {
read: function (options) {
self.getAppointments()
.then(function (data) {
options.success(data);
});
},
update: {},
create: {},
destroy: {},
parameterMap: function (options, operation) {
if (operation == "read") {
var result = {
startDate: self.scheduler().view().startDate(),
endDate: self.scheduler().view().endDate()
};
return kendo.stringify(result);
}
else if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
serverFiltering: true
});
self.scheduler.setDataSource(this.dataSource);
};
Diary.prototype.attached = function () {
var _this = this;
this.taskQueue.queueTask(function () {
_this.setKendoDataSource();
_this.scheduler.refresh();
});
};
return Diary;
}());
Diary = __decorate([
aurelia_dependency_injection_1.inject(aurelia_framework_1.TaskQueue, fake_diary_service_1.DiaryService),
__metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object])
], Diary);
exports.Diary = Diary;
});
//# sourceMappingURL=diary.js.map
define(["require", "exports"], function (require, exports) {
"use strict";
var DiaryService = (function () {
function DiaryService() {
}
DiaryService.prototype.fetchAppointments = function () {
var year = 2017;
var march = 2;
var startDay = 13;
var startDate = new Date(2017, march, startDay);
var appointmentDates;
appointmentDates = new Array();
var n = 0;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay, 10, 0);
appointmentDates[n].setEndTime(year, march, startDay, 10, 30);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay, 10, 30);
appointmentDates[n].setEndTime(year, march, startDay, 11, 0);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay, 11, 0);
appointmentDates[n].setEndTime(year, march, startDay, 11, 30);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay + 1, 10, 30);
appointmentDates[n].setEndTime(year, march, startDay + 1, 11, 0);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay + 1, 11, 0);
appointmentDates[n].setEndTime(year, march, startDay + 1, 11, 30);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay + 2, 10, 0);
appointmentDates[n].setEndTime(year, march, startDay + 2, 10, 30);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay + 2, 12, 30);
appointmentDates[n].setEndTime(year, march, startDay + 2, 13, 0);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay + 3, 11, 0);
appointmentDates[n].setEndTime(year, march, startDay + 3, 11, 30);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay + 3, 11, 30);
appointmentDates[n].setEndTime(year, march, startDay + 3, 12, 0);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay + 4, 10, 0);
appointmentDates[n].setEndTime(year, march, startDay + 4, 10, 30);
n++;
appointmentDates.push(new AppointmentDate());
appointmentDates[n].setStartTime(year, march, startDay + 4, 10, 30);
appointmentDates[n].setEndTime(year, march, startDay + 4, 11, 0);
var dataPromise = new Promise(function (resolve, reject) {
var appointments = [
{ id: 1, start: appointmentDates[0].startTime, end: appointmentDates[0].endTime, title: 'John Doe', description: 'review directions' },
{ id: 2, start: appointmentDates[1].startTime, end: appointmentDates[1].endTime, title: 'Jane Docherty', description: '' },
{ id: 3, start: appointmentDates[2].startTime, end: appointmentDates[2].endTime, title: 'Fran Morrison', description: '' },
{ id: 4, start: appointmentDates[3].startTime, end: appointmentDates[3].endTime, title: 'Mary Smith', description: 'work with directions' },
{ id: 5, start: appointmentDates[4].startTime, end: appointmentDates[4].endTime, title: 'Peter Jones', description: 'work with inhibition' },
{ id: 6, start: appointmentDates[5].startTime, end: appointmentDates[5].endTime, title: 'David Jacobs', description: '' },
{ id: 7, start: appointmentDates[6].startTime, end: appointmentDates[6].endTime, title: 'Erica Knighton', description: '' },
{ id: 8, start: appointmentDates[7].startTime, end: appointmentDates[7].endTime, title: 'Ian Sommerville', description: '' },
{ id: 9, start: appointmentDates[8].startTime, end: appointmentDates[8].endTime, title: 'James Jackson', description: '' },
{ id: 10, start: appointmentDates[9].startTime, end: appointmentDates[9].endTime, title: 'Brian McBrains', description: '' },
{ id: 11, start: appointmentDates[10].startTime, end: appointmentDates[10].endTime, title: 'Roger Keating', description: '' }
];
resolve(appointments);
});
return dataPromise;
};
return DiaryService;
}());
exports.DiaryService = DiaryService;
var AppointmentDate = (function () {
function AppointmentDate() {
}
AppointmentDate.prototype.setStartTime = function (year, month, day, hour, minutes) {
this.startTime = new Date(year, month, day, hour, minutes);
};
AppointmentDate.prototype.setEndTime = function (year, month, day, hour, minutes) {
this.endTime = new Date(year, month, day, hour, minutes);
};
return AppointmentDate;
}());
exports.AppointmentDate = AppointmentDate;
});
<!doctype html>
<html>
<head>
<title>Aurelia KendoUI bridge</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.mobile.all.min.css">
<script src="https://kendo.cdn.telerik.com/2016.1.226/js/jszip.min.js"></script>
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script>
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-kendoui-bundles/0.3.5/config2.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-kendoui-bridge', kendo => kendo.pro());
aurelia.start().then(a => a.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment