Blame view

public/js/controllers/kendo.js 4.34 KB
21a1ff19   Apichat.Tum   fix follow smartr...
1
angular.module("KendoDemos", ["kendo.directives"])
cf86e9a3   Apichat.Tum   - ui with oauth2 ...
2
3
    .controller("MyCtrl", function ($scope, $http) {
        function getAuthURL() {
21a1ff19   Apichat.Tum   fix follow smartr...
4
5
6
7
8
9
10
            $http({
                method: 'get',
                url: '/events'
            }).then(function successCallback(response) {
                window.open(response.data, '_blank')
            }, function errorCallback(response) {
                console.error(response)
77034810   Apichat.Tum   fix REST API
11
            });
21a1ff19   Apichat.Tum   fix follow smartr...
12
13
14
15
16
17
18
19
20
21
        }
        getAuthURL()

        $scope.submitNewToken = function (valid) {
            $http({
                method: 'post',
                url: '/setToken',
                data: { "code": $scope.clientToken }
            }).then(function successCallback(response) {
                console.log(response.data)
77034810   Apichat.Tum   fix REST API
22
                schedulerStart()
21a1ff19   Apichat.Tum   fix follow smartr...
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
            }, function errorCallback(response) {
                console.error(response)
            });
        }

        function schedulerStart() {
            $scope.schedulerOptions = {
                date: new Date("2016/10/12"),
                startTime: new Date("2016/10/12 07:00 AM"),
                height: 600,
                views: [
                    "day",
                    { type: "workWeek", selected: true },
                    "week",
                    "month",
                ],
                timezone: "Etc/UTC",
                dataSource: {
                    batch: true,
                    transport: {
                        read: {
                            url: "//localhost:3001/events",
                            dataType: "jsonp"
                        },
                        update: {
                            url: "//demos.telerik.com/kendo-ui/service/tasks/update",
                            dataType: "jsonp"
                        },
                        create: {
                            url: "//demos.telerik.com/kendo-ui/service/tasks/create",
                            dataType: "jsonp"
                        },
                        destroy: {
                            url: "//demos.telerik.com/kendo-ui/service/tasks/destroy",
                            dataType: "jsonp"
                        },
                        parameterMap: function (options, operation) {
                            if (operation !== "read" && options.models) {
                                return { models: kendo.stringify(options.models) };
                            }
                        }
                    },
                    schema: {
                        model: {
                            id: "taskId",
                            fields: {
                                taskId: { from: "TaskID" },
                                title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                                start: { type: "date", from: "Start" },
                                end: { type: "date", from: "End" },
                                startTimezone: { from: "StartTimezone" },
                                endTimezone: { from: "EndTimezone" },
                                description: { from: "Description" },
                                recurrenceId: { from: "RecurrenceID" },
                                recurrenceRule: { from: "RecurrenceRule" },
                                recurrenceException: { from: "RecurrenceException" },
                                ownerId: { from: "OwnerID", defaultValue: 1 },
                                isAllDay: { type: "boolean", from: "IsAllDay" }
                            }
                        }
                    },
                    filter: {
                        logic: "or",
                        filters: [
                            { field: "ownerId", operator: "eq", value: 1 },
                            { field: "ownerId", operator: "eq", value: 2 }
                        ]
                    }
                },
                resources: [
                    {
                        field: "ownerId",
                        title: "Owner",
                        dataSource: [
                            { text: "Alex", value: 1, color: "#f8a398" },
                            { text: "Bob", value: 2, color: "#51a0ed" },
                            { text: "Charlie", value: 3, color: "#56ca85" }
                        ]
                    }
                ]
            };
7598c58f   Apichat.Tum   add eventTypeID /...
104
        }
21a1ff19   Apichat.Tum   fix follow smartr...
105
106

    })
cf86e9a3   Apichat.Tum   - ui with oauth2 ...

21a1ff19   Apichat.Tum   fix follow smartr...

cf86e9a3   Apichat.Tum   - ui with oauth2 ...

21a1ff19   Apichat.Tum   fix follow smartr...

7598c58f   Apichat.Tum   add eventTypeID /...

21a1ff19   Apichat.Tum   fix follow smartr...

7598c58f   Apichat.Tum   add eventTypeID /...

21a1ff19   Apichat.Tum   fix follow smartr...

7598c58f   Apichat.Tum   add eventTypeID /...

21a1ff19   Apichat.Tum   fix follow smartr...

7598c58f   Apichat.Tum   add eventTypeID /...

21a1ff19   Apichat.Tum   fix follow smartr...