Fix ReportAdmin::Link() not returning correct home url (#38)

This commit is contained in:
Damian Mooyman 2016-07-14 17:51:20 +12:00 committed by Sam Minnée
parent 39b6d12969
commit 2d47fed75d

View File

@ -41,6 +41,9 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
*/ */
protected $reportClass; protected $reportClass;
/**
* @var SS_Report
*/
protected $reportObject; protected $reportObject;
public function init() public function init()
@ -82,7 +85,6 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
return false; return false;
} }
$hasViewableSubclasses = false;
foreach ($this->Reports() as $report) { foreach ($this->Reports() as $report) {
if ($report->canView($member)) { if ($report->canView($member)) {
return true; return true;
@ -157,11 +159,16 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
public function Link($action = null) public function Link($action = null)
{ {
if ($this->reportObject) { if ($this->reportObject) {
$link = $this->reportObject->getLink($action); return $this->reportObject->getLink($action);
} else {
$link = self::join_links(parent::Link('index'), $action);
} }
return $link;
// Join parent action
if($action) {
return static::join_links(parent::Link('index'), $action);
}
// Basic link to this cms section
return parent::Link();
} }
public function providePermissions() public function providePermissions()