Skip to content

Commit

Permalink
ENH Update code to reflect changes in template layer
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Oct 22, 2024
1 parent 539a527 commit 20fe9d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions code/Controller/AssetAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ public function apiHistory(HTTPRequest $request): HTTPResponse

$output[] = array(
'versionid' => (int) $version->Version,
'date_ago' => $version->dbObject('LastEdited')->Ago(),
'date_formatted' => $version->dbObject('LastEdited')->Nice(),
'date_ago' => $version->dbObject('LastEdited')?->Ago(),
'date_formatted' => $version->dbObject('LastEdited')?->Nice(),
'status' => ($version->WasPublished) ? _t(__CLASS__.'.PUBLISHED', 'Published') : '',
'author' => ($author)
? $author->Name
Expand Down Expand Up @@ -1604,10 +1604,9 @@ public function canView($member = null)
public function PreviewPanel()
{
$templates = SSViewer::get_templates_by_class(get_class($this), '_PreviewPanel', __CLASS__);
$template = SSViewer::chooseTemplate($templates);
// Only render preview panel if a template specifically for the asset admin has been provided
if ($template) {
return $this->renderWith($template);
if ($this->getTemplateEngine()->hasTemplate($templates)) {
return $this->renderWith($templates);
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion code/Forms/FileHistoryFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function getSpecsMarkup($record)
? _t(__CLASS__ . '.PUBLISHED', 'Published')
: _t(__CLASS__ . '.SAVED', 'Saved'),
Convert::raw2att($record->LastEdited),
Convert::raw2xml($record->dbObject('LastEdited')->Ago())
Convert::raw2xml($record->dbObject('LastEdited')?->Ago())
);
return sprintf(
'<div class="editor__specs">%s %s, %s %s</div>',
Expand Down

0 comments on commit 20fe9d5

Please sign in to comment.