From 08fbc00d7a6735c4eb24112a1c16dc52fdde1e38 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 22 Sep 2015 10:17:17 -0400 Subject: [PATCH] (js) Add "today" button to Calendar module --- UI/Templates/SchedulerUI/UIxCalMainView.wox | 12 ++++++++---- .../js/Scheduler/CalendarsController.js | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index 598d43ce3..4811bdc78 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -585,14 +585,18 @@ - diff --git a/UI/WebServerResources/js/Scheduler/CalendarsController.js b/UI/WebServerResources/js/Scheduler/CalendarsController.js index e23909c56..257e47ac0 100644 --- a/UI/WebServerResources/js/Scheduler/CalendarsController.js +++ b/UI/WebServerResources/js/Scheduler/CalendarsController.js @@ -6,8 +6,8 @@ /** * @ngInject */ - CalendarsController.$inject = ['$scope', '$rootScope', '$stateParams', '$state', '$timeout', '$q', '$mdDialog', '$log', 'sgFocus', 'Dialog', 'sgSettings', 'Calendar', 'User', 'stateCalendars']; - function CalendarsController($scope, $rootScope, $stateParams, $state, $timeout, $q, $mdDialog, $log, focus, Dialog, Settings, Calendar, User, stateCalendars) { + CalendarsController.$inject = ['$scope', '$window', '$mdDialog', '$log', 'sgFocus', 'Dialog', 'sgSettings', 'Calendar', 'User', 'stateCalendars']; + function CalendarsController($scope, $window, $mdDialog, $log, focus, Dialog, Settings, Calendar, User, stateCalendars) { var vm = this; vm.activeUser = Settings.activeUser; @@ -22,6 +22,7 @@ vm.showLinks = showLinks; vm.showProperties = showProperties; vm.subscribeToFolder = subscribeToFolder; + vm.today = today; // Dispatch the event named 'calendars:list' when a calendar is activated or deactivated or // when the color of a calendar is changed @@ -204,6 +205,15 @@ Dialog.alert(l('Warning'), l('An error occured please try again.')); }); } + + function today() { + var fragments = $window.location.hash.split('/'), + state = fragments[1], + view = fragments[2], + now = new Date(), + path = ['#', state, view, now.getDayString()]; + $window.location = path.join('/'); + } } angular