Introducing the AlbumHeaderBox. Removes a hack.
This commit is contained in:
parent
fdc437b29c
commit
3220d361c3
@ -26,32 +26,36 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
$tag = Tag::fromSlug($_GET['tag']);
|
$tag = Tag::fromSlug($_GET['tag']);
|
||||||
$id_tag = $tag->id_tag;
|
$id_tag = $tag->id_tag;
|
||||||
$title = $tag->tag;
|
$title = $tag->tag;
|
||||||
$description = !empty($tag->description) ? '<p>' . $tag->description . '</p>' : '';
|
$description = !empty($tag->description) ? $tag->description : '';
|
||||||
|
|
||||||
// Can we go up a level?
|
// Can we go up a level?
|
||||||
if ($tag->id_parent != 0)
|
if ($tag->id_parent != 0)
|
||||||
{
|
{
|
||||||
$ptag = Tag::fromId($tag->id_parent);
|
$ptag = Tag::fromId($tag->id_parent);
|
||||||
$description .= '<p><a href="' . BASEURL . '/' . (!empty($ptag->slug) ? $ptag->slug . '/' : '') . '">« Go back to "' . $ptag->tag . '"</a></p>';
|
$back_link = BASEURL . '/' . (!empty($ptag->slug) ? $ptag->slug . '/' : '');
|
||||||
|
$back_link_title = 'Back to "' . $ptag->tag . '"';
|
||||||
}
|
}
|
||||||
elseif ($tag->kind === 'Person')
|
elseif ($tag->kind === 'Person')
|
||||||
$description .= '<p><a href="' . BASEURL . '/people/">« Go back to "People"</a></p>';
|
{
|
||||||
|
$back_link = BASEURL . '/people/';
|
||||||
|
$back_link_title = 'Back to "People"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$header_box = new AlbumHeaderBox($title, $description, $back_link, $back_link_title);
|
||||||
}
|
}
|
||||||
// View the album root.
|
// View the album root.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$id_tag = 1;
|
$id_tag = 1;
|
||||||
$title = 'Albums';
|
$title = 'Albums';
|
||||||
$description = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// What page are we at?
|
// What page are we at?
|
||||||
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
|
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
|
||||||
|
|
||||||
parent::__construct($title . ' - Page ' . $page . ' - ' . SITE_TITLE);
|
parent::__construct($title . ' - Page ' . $page . ' - ' . SITE_TITLE);
|
||||||
|
if (isset($header_box))
|
||||||
if ($id_tag !== 1)
|
$this->page->adopt($header_box);
|
||||||
$this->page->adopt(new DummyBox($title, $description, 'page_title_box'));
|
|
||||||
|
|
||||||
// Fetch subalbums, but only if we're on the first page.
|
// Fetch subalbums, but only if we're on the first page.
|
||||||
if ($page === 1)
|
if ($page === 1)
|
||||||
|
@ -141,10 +141,11 @@ ul#nav li a:hover {
|
|||||||
|
|
||||||
/* Tiled grid
|
/* Tiled grid
|
||||||
---------------*/
|
---------------*/
|
||||||
.tiled_header, .page_title_box {
|
.tiled_header {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
||||||
color: #000;
|
color: #000;
|
||||||
|
clear: both;
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0 0 1.5% 0;
|
margin: 0 0 1.5% 0;
|
||||||
font: 400 18px/2.2 "Open Sans", sans-serif;
|
font: 400 18px/2.2 "Open Sans", sans-serif;
|
||||||
@ -153,19 +154,6 @@ ul#nav li a:hover {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.page_title_box {
|
|
||||||
padding: 6px 22px !important;
|
|
||||||
clear: both;
|
|
||||||
display: inline-block;
|
|
||||||
float: none;
|
|
||||||
font: inherit;
|
|
||||||
}
|
|
||||||
.page_title_box h2 {
|
|
||||||
font: 400 18px/2.2 "Open Sans", sans-serif !important;
|
|
||||||
}
|
|
||||||
.page_title_box p {
|
|
||||||
margin: 0 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tiled_grid {
|
.tiled_grid {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -291,6 +279,43 @@ ul#nav li a:hover {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Album title boxes
|
||||||
|
----------------------*/
|
||||||
|
.album_title_box {
|
||||||
|
margin-left: -46px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.album_title_box > a {
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
font-size: 2em;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 8px 10px 14px;
|
||||||
|
}
|
||||||
|
.album_title_box > div {
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
||||||
|
float: left;
|
||||||
|
font: inherit;
|
||||||
|
padding: 6px 22px;
|
||||||
|
max-width: 90%;
|
||||||
|
margin: 0 0 1.5% 0;
|
||||||
|
}
|
||||||
|
.album_title_box h2 {
|
||||||
|
color: #487C96;
|
||||||
|
font: 400 18px/2 "Open Sans", sans-serif !important;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.album_title_box p {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Generic boxed content
|
||||||
|
--------------------------*/
|
||||||
.boxed_content {
|
.boxed_content {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 25px;
|
padding: 25px;
|
||||||
|
35
templates/AlbumHeaderBox.php
Normal file
35
templates/AlbumHeaderBox.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/*****************************************************************************
|
||||||
|
* AlbumHeaderBox.php
|
||||||
|
* Defines the AlbumHeaderBox template.
|
||||||
|
*
|
||||||
|
* Kabuki CMS (C) 2013-2016, Aaron van Geffen
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
class AlbumHeaderBox extends SubTemplate
|
||||||
|
{
|
||||||
|
public function __construct($title, $description, $back_link, $back_link_title)
|
||||||
|
{
|
||||||
|
$this->title = $title;
|
||||||
|
$this->description = $description;
|
||||||
|
$this->back_link = $back_link;
|
||||||
|
$this->back_link_title = $back_link_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function html_content()
|
||||||
|
{
|
||||||
|
echo '
|
||||||
|
<div class="album_title_box">
|
||||||
|
<a class="back_button" href="', $this->back_link, '" title="', $this->back_link_title, '">←</a>
|
||||||
|
<div>
|
||||||
|
<h2>', $this->title, '</h2>';
|
||||||
|
|
||||||
|
if (!empty($this->description))
|
||||||
|
echo '
|
||||||
|
<p>', $this->description, '</p>';
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user