Skip to content

Commit

Permalink
refactored playlists by-date use of template factory to superclass
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan committed Oct 4, 2024
1 parent ee34003 commit 5ab7b95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 4 additions & 2 deletions ui/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ public function dispatchSubaction($action, $subaction, $extra=0) {
}
}

public function render() {
public function render($block = null) {
$templateFact = new TemplateFactoryUI();
$template = $templateFact->load($this->getTemplate());
return $template->render($this->getTemplateVars());
return $block ?
$template->renderBlock($block, $this->getTemplateVars()) :
$template->render($this->getTemplateVars());
}
}
8 changes: 3 additions & 5 deletions ui/Playlists.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,11 +805,9 @@ public function handlePlaylistsByDate() {
foreach($lists as &$list)
$list['timerange'] = self::timeToLocale($list['showtime']);

$factory = new TemplateFactoryUI();
$template = $factory->load('list/bydate.html');
$tbody = $template->renderBlock('list', [
"lists" => $lists
]);
$this->setTemplate('list/bydate.html');
$this->addVar('lists', $lists);
$tbody = $this->render('list');

echo json_encode(["count" => $count, "tbody" => $tbody]);
}
Expand Down

0 comments on commit 5ab7b95

Please sign in to comment.