From d081f3c6eb9cab5a782fb8d1400bb5bf9b33900a Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 12 Nov 2015 12:29:10 -0500 Subject: [PATCH] Display description for alarm & repeat definitions This is not the perfect solution has the localization may be unsuitable in some languages. --- .../UIxAppointmentViewTemplate.wox | 6 +-- .../SchedulerUI/UIxTaskViewTemplate.wox | 10 ++--- .../js/Scheduler/Component.service.js | 40 +++++++++++++++++++ 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox b/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox index 837c28c90..1c42cf81b 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox @@ -120,12 +120,12 @@ repeat -

+

{{editor.component.repeatDescription()}}

- + alarm_on -

+

{{editor.component.alarmDescription()}}

people diff --git a/UI/Templates/SchedulerUI/UIxTaskViewTemplate.wox b/UI/Templates/SchedulerUI/UIxTaskViewTemplate.wox index 53ff9407f..324190d1d 100644 --- a/UI/Templates/SchedulerUI/UIxTaskViewTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxTaskViewTemplate.wox @@ -111,24 +111,24 @@

{{editor.component.percentComplete}} %

- + link

{{url.value}}

mode_comment -

{{editor.component.comment}}

+

{{::editor.component.comment}}

repeat -

+

{{editor.component.repeatDescription()}}

- alarm -

+ alarm_on +

{{editor.component.alarmDescription()}}

diff --git a/UI/WebServerResources/js/Scheduler/Component.service.js b/UI/WebServerResources/js/Scheduler/Component.service.js index 61b54a86d..f309d3045 100644 --- a/UI/WebServerResources/js/Scheduler/Component.service.js +++ b/UI/WebServerResources/js/Scheduler/Component.service.js @@ -1114,4 +1114,44 @@ return component; }; + /** + * @function repeatDescription + * @memberof Component.prototype + * @desc Return a localized description of the recurrence definition + * @return a localized string + */ + Component.prototype.repeatDescription = function() { + var localizedString = null; + if (this.repeat) + localizedString = l('repeat_' + this.repeat.frequency.toUpperCase()); + + return localizedString; + }; + + /** + * @function alarmDescription + * @memberof Component.prototype + * @desc Return a localized description of the reminder definition + * @return a localized string + */ + Component.prototype.alarmDescription = function() { + var key, localizedString = null; + if (this.alarm) { + key = ['reminder' + this.alarm.quantity, this.alarm.unit, this.alarm.reference].join('_'); + localizedString = l(key); + if (key === localizedString) + // No localized string for this reminder definition + localizedString = [this.alarm.quantity, + l('reminder_' + this.alarm.unit), + l('reminder_' + this.alarm.reference)].join(' '); + } + + return localizedString; + }; + + Component.prototype.toString = function() { + return '[Component ' + this.id + ']'; + }; + + })();