Skip to content

Commit

Permalink
Don't set modal opener attrs manually
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Sep 12, 2023
1 parent 6ccb9e3 commit 141bae1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 62 deletions.
40 changes: 12 additions & 28 deletions application/controllers/ReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,56 +296,40 @@ protected function assembleActions()

if ($this->hasPermission('reporting/reports')) {
$actions->addHtml(
new ActionLink(
(new ActionLink(
$this->translate('Modify'),
Url::fromPath('reporting/report/edit', ['id' => $reportId]),
'edit',
[
'data-icinga-modal' => true,
'data-no-icinga-ajax' => true
]
)
'edit'
))->openInModal()
);

$actions->addHtml(
new ActionLink(
(new ActionLink(
$this->translate('Clone'),
Url::fromPath('reporting/report/clone', ['id' => $reportId]),
'clone',
[
'data-icinga-modal' => true,
'data-no-icinga-ajax' => true
]
)
'clone'
))->openInModal()
);
}

if ($this->hasPermission('reporting/schedules')) {
$actions->addHtml(
new ActionLink(
(new ActionLink(
$this->translate('Schedule'),
Url::fromPath('reporting/report/schedule', ['id' => $reportId]),
'calendar-empty',
[
'data-icinga-modal' => true,
'data-no-icinga-ajax' => true
]
)
'calendar-empty'
))->openInModal()
);
}

$actions
->add($download)
->addHtml(
new ActionLink(
(new ActionLink(
$this->translate('Send'),
Url::fromPath('reporting/report/send', ['id' => $reportId]),
'forward',
[
'data-icinga-modal' => true,
'data-no-icinga-ajax' => true
]
)
'forward'
))->openInModal()
);

return $actions;
Expand Down
16 changes: 7 additions & 9 deletions application/controllers/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ public function indexAction()
$this->getTabs()->getAttributes()->set('data-base-target', '_main');

if ($this->hasPermission('reporting/reports')) {
$this->addControl(new ButtonLink(
$this->translate('New Report'),
Url::fromPath('reporting/reports/new'),
'plus',
[
'data-icinga-modal' => true,
'data-no-icinga-ajax' => true
]
));
$this->addControl(
(new ButtonLink(
$this->translate('New Report'),
Url::fromPath('reporting/reports/new'),
'plus'
))->openInModal()
);
}

$tableRows = [];
Expand Down
10 changes: 3 additions & 7 deletions application/controllers/TemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,11 @@ protected function createActionBars(): ValidHtml
{
$actions = new ActionBar();
$actions->addHtml(
new ActionLink(
(new ActionLink(
$this->translate('Modify'),
Url::fromPath('reporting/template/edit', ['id' => $this->template->id]),
'edit',
[
'data-icinga-modal' => true,
'data-no-icinga-ajax' => true
]
)
'edit'
))->openInModal()
);

return $actions;
Expand Down
16 changes: 7 additions & 9 deletions application/controllers/TemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ public function indexAction()
$canManage = $this->hasPermission('reporting/templates');

if ($canManage) {
$this->addControl(new ButtonLink(
$this->translate('New Template'),
Url::fromPath('reporting/templates/new'),
'plus',
[
'data-icinga-modal' => true,
'data-no-icinga-ajax' => true
]
));
$this->addControl(
(new ButtonLink(
$this->translate('New Template'),
Url::fromPath('reporting/templates/new'),
'plus'
))->openInModal()
);
}

$templates = Model\Template::on($this->getDb());
Expand Down
16 changes: 7 additions & 9 deletions application/controllers/TimeframesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ public function indexAction()
$canManage = $this->hasPermission('reporting/timeframes');

if ($canManage) {
$this->addControl(new ButtonLink(
$this->translate('New Timeframe'),
Url::fromPath('reporting/timeframes/new'),
'plus',
[
'data-icinga-modal' => true,
'data-no-icinga-ajax' => true
]
));
$this->addControl(
(new ButtonLink(
$this->translate('New Timeframe'),
Url::fromPath('reporting/timeframes/new'),
'plus'
))->openInModal()
);
}

$tableRows = [];
Expand Down

0 comments on commit 141bae1

Please sign in to comment.