From 96639b70a05cc3646939f8d2e078c6896cfc6af5 Mon Sep 17 00:00:00 2001 From: smizrahi Date: Tue, 25 Apr 2023 22:46:18 +0200 Subject: [PATCH] feat(calendar): Add week number on month view. Fixes #4457. --- .../English.lproj/Localizable.strings | 2 ++ UI/Scheduler/French.lproj/Localizable.strings | 2 ++ UI/Scheduler/UIxCalMonthView.m | 13 ++++++++++++ UI/Templates/SchedulerUI/UIxCalMonthView.wox | 6 ++++++ .../scss/views/SchedulerUI.scss | 21 +++++++++++++++++++ 5 files changed, 44 insertions(+) diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index dd5321bf6..3237da11f 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -37,6 +37,8 @@ "this month" = "this month"; "Previous Month" = "Previous Month"; "Next Month" = "Next Month"; +/* Week number prefix */ +"W" = "W"; /* Year */ "this year" = "this year"; diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index 19832b8c1..536268822 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -37,6 +37,8 @@ "this month" = "ce mois"; "Previous Month" = "Mois précédent"; "Next Month" = "Mois suivant"; +/* Week number prefix */ +"W" = "S"; /* Year */ "this year" = "Cette année"; diff --git a/UI/Scheduler/UIxCalMonthView.m b/UI/Scheduler/UIxCalMonthView.m index 1c8757318..ac4a86586 100644 --- a/UI/Scheduler/UIxCalMonthView.m +++ b/UI/Scheduler/UIxCalMonthView.m @@ -234,6 +234,19 @@ return daysNumbersToDisplay[i]; } +- (BOOL) isFirstDayOfWeek { + return 0 == [currentWeek indexOfObject: currentTableDay]; +} + +- (int) currentWeekNumber +{ + SOGoUser *user; + + user = [context activeUser]; + + return [user weekNumberForDate: currentTableDay]; +} + - (void) setCurrentWeek: (NSArray *) newCurrentWeek { ASSIGN (currentWeek, newCurrentWeek); diff --git a/UI/Templates/SchedulerUI/UIxCalMonthView.wox b/UI/Templates/SchedulerUI/UIxCalMonthView.wox index ffc481052..5595a3212 100644 --- a/UI/Templates/SchedulerUI/UIxCalMonthView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMonthView.wox @@ -89,6 +89,12 @@ var:sg-day="currentTableDay.shortDateString" var:sg-day-number="currentDayNumber" var:sg-day-string="currentTableDay.iso8601DateString"> + + +
+ +
+
diff --git a/UI/WebServerResources/scss/views/SchedulerUI.scss b/UI/WebServerResources/scss/views/SchedulerUI.scss index 3a026147c..2db8519f3 100644 --- a/UI/WebServerResources/scss/views/SchedulerUI.scss +++ b/UI/WebServerResources/scss/views/SchedulerUI.scss @@ -242,6 +242,27 @@ $quarter_height: 10px; //font-weight: $sg-font-light; } + // Header of month week + .sg-calendar-tile-week { + font-size: $sg-font-size-2; + min-height: $sg-font-size-2 + 10px; + overflow: hidden; + padding: 4px; + text-align: left; + text-overflow: ellipsis; + white-space: nowrap; + //font-weight: $sg-font-light; + position: absolute; + width: 100%; + } + .sg-calendar-tile-week span { + padding: 1%; + border-radius: 30%; + color: $colorGrey50; + } + + + // The left column of hours .hours { display: inline-block;