Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
[
'controller' => 'Listings',
'action' => 'list',
'sc25',
'production',
]
);
$builder->connect(
Expand Down
26 changes: 25 additions & 1 deletion src/Controller/ListingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,34 @@ public function list($bof = null, $url = null)
{
$limit = Configure::read('IO500.pagination');

if ($url === null) {
$url = 'production';
}
// When the homepage route is hit (no $bof), serve the most recent BoF
// that already has a published listing for the requested type. This
// skips a release whose listing hasn't been built yet so the homepage
// doesn't fall over between release-date and listing-creation.
if ($bof === null) {
$latest = $this->Listings->find('all')
->contain(['Types', 'Releases'])
->where([
'Types.url' => $url,
'Releases.release_date <=' => date('Y-m-d'),
])
->order(['Releases.release_date' => 'DESC'])
->first();
if ($latest === null) {
throw new \Cake\Http\Exception\NotFoundException(
__('No published lists yet')
);
}
$bof = $latest->release->acronym;
}

$release = $this->Listings->Releases->find('all')
->contain([
'Listings' => [
'Types',
'Types',
'sort'=> [
'Types.position' => 'ASC'
]
Expand Down
14 changes: 7 additions & 7 deletions templates/Listings/list.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php $this->assign('title', strtoupper($this->request->getParam('pass')[0]) . ' - ' . $type->name . ' List'); ?>
<?php $this->assign('title', strtoupper($release->acronym) . ' - ' . $type->name . ' List'); ?>

<nav id="breadcrumb">
<p>YOU ARE HERE</p>

<?php
$this->Breadcrumbs->add(_('LISTS'), ['controller' => 'releases', 'action' => 'index']);
$this->Breadcrumbs->add(strtoupper($this->request->getParam('pass')[0]), ['controller' => 'releases', 'action' => 'index']);
$this->Breadcrumbs->add($type->name . _(' LIST'), ['controller' => 'listings', 'action' => 'list', $this->request->getParam('pass')[0], $type->url]);
$this->Breadcrumbs->add(strtoupper($release->acronym), ['controller' => 'releases', 'action' => 'index']);
$this->Breadcrumbs->add($type->name . _(' LIST'), ['controller' => 'listings', 'action' => 'list', $release->acronym, $type->url]);

echo $this->Breadcrumbs->render([], ['separator' => ' / ']);
?>
Expand All @@ -15,14 +15,14 @@
<?php echo $this->element('call'); ?>

<div class="submissions index content">
<h2><?php echo $type->name . ' ' . strtoupper($this->request->getParam('pass')[0]); ?> List</h2>
<h2><?php echo $type->name . ' ' . strtoupper($release->acronym); ?> List</h2>

<div class="submissions-action">
<?php
echo $this->Html->link(_('Customize'), [
'controller' => 'submissions',
'action' => 'customize',
strtolower($this->request->getParam('pass')[0]),
strtolower($release->acronym),
strtolower($type->url)
], [
'class' => 'button'
Expand All @@ -31,7 +31,7 @@
echo $this->Html->link('Download', [
'controller' => 'listings',
'action' => 'download',
strtolower($this->request->getParam('pass')[0]),
strtolower($release->acronym),
strtolower($type->url),
'?' => $this->request->getQueryParams()
], [
Expand All @@ -56,7 +56,7 @@
echo $this->Html->link($icon . '<b>' . $list->type->name . '</b>', [
'controller' => 'listings',
'action' => 'list',
strtolower($this->request->getParam('pass')[0]),
strtolower($release->acronym),
strtolower($list->type->url)
], [
'class' => 'button-navigation' . $state,
Expand Down