From 0b5f1be3ba6fe543458f469447227d9f7eaf0731 Mon Sep 17 00:00:00 2001 From: raviks789 <33730024+raviks789@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:58:10 +0200 Subject: [PATCH] WIP --- .../Notifications/Widget/Calendar/BaseGrid.php | 16 +++++----------- .../Notifications/Widget/Calendar/MonthGrid.php | 10 ++++------ .../Notifications/Widget/Calendar/WeekGrid.php | 2 -- public/css/calendar.less | 10 ++++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/library/Notifications/Widget/Calendar/BaseGrid.php b/library/Notifications/Widget/Calendar/BaseGrid.php index 766e0d17f..d5dd7fb1a 100644 --- a/library/Notifications/Widget/Calendar/BaseGrid.php +++ b/library/Notifications/Widget/Calendar/BaseGrid.php @@ -11,7 +11,9 @@ use Icinga\Util\Csp; use ipl\Html\Attributes; use ipl\Html\BaseHtmlElement; +use ipl\Html\Html; use ipl\Html\HtmlElement; +use ipl\Html\HtmlString; use ipl\Html\Text; use ipl\I18n\Translation; use ipl\Web\Style; @@ -294,29 +296,21 @@ protected function assembleGridOverlay(BaseHtmlElement $overlay): void foreach ($extraEntriesCount as $dayOffset => $count) { $start = clone $this->getGridStart(); $start->add(new DateInterval("P$dayOffset" . "D")); - if ($count === 0) { - continue; - } elseif ($removedEntry[$dayOffset][0] !== null) { - $overlay->remove($removedEntry[$dayOffset][0]); - } $countStyle = [ - 'grid-row-start' => $removedEntry[$dayOffset][1], + 'grid-row-start' => $removedEntry[$dayOffset][1], 'grid-column-start' => $removedEntry[$dayOffset][2], - 'pointer-events' => 'all', - 'text-align' => 'end', - 'margin-right' => '0.2em' ]; $style->add(".additional-$dayOffset", $countStyle); $entryHtml = new HtmlElement( 'div', Attributes::create( [ - 'class' => ["additional-$dayOffset"] + 'class' => ['entry-count', "additional-$dayOffset"] ] ), new Link( - "+$count", + "+$count entries", Url::fromPath( 'notifications/schedules', [ diff --git a/library/Notifications/Widget/Calendar/MonthGrid.php b/library/Notifications/Widget/Calendar/MonthGrid.php index e207dc31c..7280bf3fe 100644 --- a/library/Notifications/Widget/Calendar/MonthGrid.php +++ b/library/Notifications/Widget/Calendar/MonthGrid.php @@ -146,7 +146,7 @@ protected function assemble() protected function getDaysOffset(int $row, int $col): int { - return (intval($row / $this->getSectionsPerStep()) - 1) * 7 + intval($col / 48); + return (intval($row / $this->getSectionsPerStep())) * 7 + intval($col / 48); } protected function updateExtraEntriesCount(array $gridArea, array &$extraEntriesCount, array &$removedEntry): void @@ -166,12 +166,10 @@ protected function updateExtraEntriesCount(array $gridArea, array &$extraEntries $removedEntry[$startDay] = [ null, $gridArea[0] - 1, - (intval($col / $colSpan) + 1) * $colSpan - 3 + (intval($col / $colSpan) + 1) * $colSpan ]; $extraEntriesCount[$startDay] = 1; - } elseif ($extraEntriesCount[$startDay] === 0) { - $extraEntriesCount[$startDay] += 2; } else { $extraEntriesCount[$startDay] += 1; } @@ -204,13 +202,13 @@ protected function removeRowLastEntry( $removedEntry[$startDay] = [ $entryHtml, $gridArea[0], - (intval($col / $colSpan) + 1) * $colSpan - 3 + (intval($col / $colSpan) + 1) * $colSpan ]; } else { $removedEntry[$startDay] = [ null, $gridArea[0], - (intval($col / $colSpan) + 1) * $colSpan - 3 + (intval($col / $colSpan) + 1) * $colSpan ]; } diff --git a/library/Notifications/Widget/Calendar/WeekGrid.php b/library/Notifications/Widget/Calendar/WeekGrid.php index ea836e8f3..5e0402d58 100644 --- a/library/Notifications/Widget/Calendar/WeekGrid.php +++ b/library/Notifications/Widget/Calendar/WeekGrid.php @@ -144,8 +144,6 @@ protected function updateExtraEntriesCount(array $gridArea, array &$extraEntries if (! isset($extraEntriesCount[$day])) { $extraEntriesCount[$day] = 1; - } elseif ($extraEntriesCount[$day] === 0) { - $extraEntriesCount[$day] += 2; } else { $extraEntriesCount[$day] += 1; } diff --git a/public/css/calendar.less b/public/css/calendar.less index 92156a562..5fac8b778 100644 --- a/public/css/calendar.less +++ b/public/css/calendar.less @@ -219,6 +219,16 @@ .grid, .overlay { grid-area: ~"2 / 2 / 3 / 3"; + .entry-count { + display: flex; + flex-direction: row-reverse; + pointer-events: all; + white-space: nowrap; + + a { + color: @icinga-blue; + } + } } }