From 86e0b60386eba3f3652f706cc64112e74f1feb6d Mon Sep 17 00:00:00 2001 From: "chris.watts90@outlook.com" Date: Sun, 9 Apr 2017 22:05:18 +0100 Subject: [PATCH] added create and create+edit context menus with options. created stub methods for performing the edit/create actions. #29 --- .../WindowsDataCenter/www/spa.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/spa.js b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/spa.js index c62c7de..cdc8192 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/spa.js +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/spa.js @@ -12,6 +12,7 @@ self.chosenTimeLogUserId = -1; self.selectedCalendarWeek = ko.observable(0); self.errorData = ko.observable(null); + self.manualLog = ko.observable(null); self.apiEndpoints = { root: "http://localhost:8800", getUserList: "/api/users", @@ -382,6 +383,32 @@ self.assignErrorObject(errObj.errorCode, errObj.errorMessage, "getGroups"); }); }; + self.createContextMenu = ko.observableArray([ + { text: "Create", action: createlog } + ]); + self.editContextMenu = ko.observableArray([ + { text: "text", action: clicked }, + { text: "Edit", action: editlog }, + { text: "Create", action: createlog } + ]); + function editlog (data) { + alert("edit"); + } + function createlog(data) { + self.manualLog({ + CalendarWeek:-1, + Direction:-1, + EventTime: "2017-03-01T07:44:41.0861152+00:00", + Id: -1, + IdentifierId: -1, + UserId: self.chosenTimeLogUserId(), + Year: 0 + }); + $('#manualLogDialog').modal("show"); + } + function clicked(data) { + alert('oh, you clicked me! ah, and you typed "' + data.value() + '"'); + } Sammy(function () { this.get("#users", function () { var query = this.params.query;