Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Oct 5, 2023
1 parent 935b022 commit 0b5f1be
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
16 changes: 5 additions & 11 deletions library/Notifications/Widget/Calendar/BaseGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
[
Expand Down
10 changes: 4 additions & 6 deletions library/Notifications/Widget/Calendar/MonthGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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
];
}

Expand Down
2 changes: 0 additions & 2 deletions library/Notifications/Widget/Calendar/WeekGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 10 additions & 0 deletions public/css/calendar.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}

Expand Down

0 comments on commit 0b5f1be

Please sign in to comment.