Skip to content

Commit

Permalink
Merge pull request #6 from mateusz/merge-back
Browse files Browse the repository at this point in the history
BUG Fix sorting on main ReportAdmin grid ref: CWPBUG-133
  • Loading branch information
halkyon committed Aug 13, 2014
2 parents 193a2ab + 13565a5 commit 26d7728
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 9 additions & 0 deletions code/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ public function title() {
return $this->title;
}

/**
* Allows access to title as a property
*
* @return string
*/
public function getTitle() {
return $this->title();
}

/**
* Return the description of this report.
*
Expand Down
11 changes: 8 additions & 3 deletions code/ReportAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public function init() {
parent::init();

//set the report we are currently viewing from the URL
$this->reportClass = (isset($this->urlParams['ReportClass'])) ? $this->urlParams['ReportClass'] : null;
$this->reportClass = (isset($this->urlParams['ReportClass']) && $this->urlParams['ReportClass'] !== 'index')
? $this->urlParams['ReportClass']
: null;
$allReports = SS_Report::get_reports();
$this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null;

Expand Down Expand Up @@ -131,8 +133,11 @@ public function Breadcrumbs($unlinked = false) {
* @return String
*/
public function Link($action = null) {
$link = parent::Link($action);
if ($this->reportObject) $link = $this->reportObject->getLink($action);
if ($this->reportObject) {
$link = $this->reportObject->getLink($action);
} else {
$link = self::join_links(parent::Link('index'), $action);
}
return $link;
}

Expand Down

0 comments on commit 26d7728

Please sign in to comment.