From e8ec8180a8c36c634d384521f71ce2f13fd8cb23 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 22 Jun 2017 11:55:53 -0400 Subject: [PATCH] (js) Use more one-time bindings in Calendar module --- .../UIxAppointmentViewTemplate.wox | 66 +++++++++---------- UI/Templates/SchedulerUI/UIxCalMainView.wox | 37 +++++------ .../SchedulerUI/UIxCalendarProperties.wox | 2 +- .../SchedulerUI/UIxTaskViewTemplate.wox | 64 +++++++++--------- .../js/Scheduler/CalendarListController.js | 42 +++++++----- .../js/Scheduler/Component.service.js | 15 ++++- .../js/Scheduler/ComponentController.js | 23 +++---- 7 files changed, 134 insertions(+), 115 deletions(-) diff --git a/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox b/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox index 9e38f1b02..85f94ff9a 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox @@ -5,17 +5,17 @@ xmlns:const="http://www.skyrix.com/od/constant" xmlns:label="OGo:label"> - +
event
- visibility_off - vpn_key - - {{::editor.component.summary}} + visibility_off + vpn_key - star + priority_high + +
@@ -38,7 +38,7 @@ - {{calendar.name}} +
@@ -56,7 +56,7 @@ - {{calendar.name}} + @@ -84,48 +84,48 @@ - {{$chip}} + place -

{{::editor.component.location}}

+

event -

{{editor.component.calendar}}

+

access_time
-

{{::editor.component.localizedStartDate}}

-

{{::editor.component.localizedStartTime}}

+

+

-

{{::editor.component.localizedEndDate}}

-

{{::editor.component.localizedEndTime}}

+

+

- + event_available

- + send

- + link -

{{url.value}}

+

@@ -133,20 +133,20 @@

- + repeat -

{{editor.component.repeatDescription()}}

+

- + alarm_on -

{{editor.component.alarmDescription()}}

+

- + people
-
+
-
+
@@ -187,7 +187,7 @@ - + @@ -225,7 +225,7 @@ - + alarm

-

+
@@ -242,7 +242,7 @@ - + @@ -254,7 +254,7 @@ - + - + @@ -317,7 +317,7 @@ - + - {{calendar.name}} - {{calendar.name}} - {{calendar.activeTasks}} + + +

@@ -75,7 +75,7 @@ label:aria-label="Name of the Calendar" ng-model="calendar.name" ng-blur="app.renameFolder(calendar)" - sg-focus-on="calendarName_{{calendar.id}}" + sg-focus-on="calendarName_{{::calendar.id}}" sg-enter="app.renameFolder(calendar)" sg-escape="app.revertEditing(calendar)"/> @@ -170,9 +170,9 @@

- {{calendar.name}} - {{calendar.name}} - {{calendar.activeTasks}} + + +

@@ -180,7 +180,7 @@ label:aria-label="Name of the Calendar" ng-model="calendar.name" ng-blur="app.renameFolder(calendar)" - sg-focus-on="calendarName_{{calendar.id}}" + sg-focus-on="calendarName_{{::calendar.id}}" sg-enter="app.renameFolder(calendar)" sg-escape="app.revertEditing(calendar)"/> @@ -259,10 +259,10 @@ ng-show="app.editMode != calendar.id"> warning - {{ calendar.$error }} + - {{calendar.name}} - {{calendar.name}} + +

@@ -342,11 +342,6 @@ ng-controller="CalendarListController as list"> -
@@ -562,7 +557,7 @@ arrow_back - +
@@ -583,7 +578,7 @@ - {{list.filterpopup() | loc}} + @@ -604,12 +599,12 @@
- {{::event.c_priority}} - {{::event.c_title}} + +
-
{{::event.c_location}}
+
diff --git a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox index e6ee175ee..6b045234a 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox @@ -78,7 +78,7 @@ - diff --git a/UI/Templates/SchedulerUI/UIxTaskViewTemplate.wox b/UI/Templates/SchedulerUI/UIxTaskViewTemplate.wox index 677576c45..e9cfcf150 100644 --- a/UI/Templates/SchedulerUI/UIxTaskViewTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxTaskViewTemplate.wox @@ -5,17 +5,17 @@ xmlns:const="http://www.skyrix.com/od/constant" xmlns:label="OGo:label"> - +
assignment_turned_in
- visibility_off - vpn_key - - {{::editor.component.summary}} + visibility_off + vpn_key - star + priority_high + +
@@ -38,77 +38,77 @@ - + - {{$chip}} + - + place -

{{::editor.component.location}}

+

event -

{{editor.component.calendar}}

+

+ ng-show="::(editor.component.startDate || editor.component.dueDate)"> access_time -
+
-

{{::editor.component.localizedStartDate}}

-

{{::editor.component.localizedStartTime}}

+

+

-
+
-

{{::editor.component.localizedDueDate}}

-

{{::editor.component.localizedDueTime}}

+

+

- + check -

{{editor.component.localizedCompletedDate}} {{editor.component.localizedCompletedTime}}

+

{{::editor.component.localizedCompletedDate}} {{::editor.component.localizedCompletedTime}}

- + timelapse -

{{editor.component.percentComplete}} %

+

{{::editor.component.percentComplete}} %

- + close

- + error_outline

link -

{{url.value}}

+

mode_comment -

+

- + repeat -

{{editor.component.repeatDescription()}}

+

- + alarm_on -

{{editor.component.alarmDescription()}}

+

@@ -116,7 +116,7 @@ - + @@ -127,7 +127,7 @@ - + 0 && + this.status != 'cancelled'); + }; + /** * @function enablePercentComplete * @memberof Component.prototype @@ -681,7 +694,7 @@ */ Component.prototype.enablePercentComplete = function() { return (this.type == 'task' && - this.percentComplete > 0 && + this.status != 'not-specified' && this.status != 'cancelled'); }; diff --git a/UI/WebServerResources/js/Scheduler/ComponentController.js b/UI/WebServerResources/js/Scheduler/ComponentController.js index 91b07f72c..110bc4db2 100644 --- a/UI/WebServerResources/js/Scheduler/ComponentController.js +++ b/UI/WebServerResources/js/Scheduler/ComponentController.js @@ -14,6 +14,7 @@ vm.service = Component; vm.component = stateComponent; vm.close = close; + vm.highPriority = highPriority; vm.cardFilter = cardFilter; vm.newMessageWithAllRecipients = newMessageWithAllRecipients; vm.newMessageWithRecipient = newMessageWithRecipient; @@ -27,19 +28,19 @@ vm.copySelectedComponent = copySelectedComponent; vm.moveSelectedComponent = moveSelectedComponent; - // Load all attributes of component - if (angular.isUndefined(vm.component.$futureComponentData)) { - component = Calendar.$get(vm.component.pid).$getComponent(vm.component.id, vm.component.occurrenceId); - component.$futureComponentData.then(function() { - vm.component = component; - vm.organizer = [vm.component.organizer]; - }); - } + // Put organizer in an array to display it as an mdChip + vm.organizer = [stateComponent.organizer]; function close() { $mdDialog.hide(); } + function highPriority() { + return (vm.component && + vm.component.priority && + vm.component.priority < 5); + } + // Autocomplete cards for attendees function cardFilter($query) { return AddressBook.$filterAll($query); @@ -302,11 +303,11 @@ function priorityLevel() { if (vm.component && vm.component.priority) { if (vm.component.priority > 5) - return l('low'); + return l('low'); // 6-7-8-9 else if (vm.component.priority > 4) - return l('normal'); + return l('normal'); // 5 else - return l('high'); + return l('high'); // 1-2-3-4 } }