Skip to content

Commit

Permalink
Add base target _main to list controller tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Oct 17, 2023
1 parent 2e1c59a commit 66c836c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/controllers/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ReportsController extends Controller
public function indexAction()
{
$this->createTabs()->activate('reports');
$this->getTabs()->getAttributes()->set('data-base-target', '_main');
$this->setTabsBaseTarget('_main');

if ($this->hasPermission('reporting/reports')) {
$this->addControl(
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/TemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TemplatesController extends Controller
public function indexAction()
{
$this->createTabs()->activate('templates');
$this->setTabsBaseTarget('_main');

$canManage = $this->hasPermission('reporting/templates');

Expand Down Expand Up @@ -50,7 +51,6 @@ public function indexAction()

$this->addControl($sortControl);


$tableRows = [];

/** @var Model\Template $template */
Expand Down
1 change: 1 addition & 0 deletions application/controllers/TimeframesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TimeframesController extends Controller
public function indexAction()
{
$this->createTabs()->activate('timeframes');
$this->setTabsBaseTarget('_main');

$canManage = $this->hasPermission('reporting/timeframes');

Expand Down
13 changes: 13 additions & 0 deletions library/Reporting/Web/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@

class Controller extends CompatController
{
/**
* Set the database target of the tabs to the given value
*
* @param string $target
*
* @return $this
*/
protected function setTabsBaseTarget(string $target): self
{
$this->getTabs()->getAttributes()->set('data-base-target', $target);

return $this;
}
}

0 comments on commit 66c836c

Please sign in to comment.