diff --git a/controllers/ViewPhotoAlbum.php b/controllers/ViewPhotoAlbum.php index 036eab5..32b2ece 100644 --- a/controllers/ViewPhotoAlbum.php +++ b/controllers/ViewPhotoAlbum.php @@ -26,32 +26,36 @@ class ViewPhotoAlbum extends HTMLController $tag = Tag::fromSlug($_GET['tag']); $id_tag = $tag->id_tag; $title = $tag->tag; - $description = !empty($tag->description) ? '

' . $tag->description . '

' : ''; + $description = !empty($tag->description) ? $tag->description : ''; // Can we go up a level? if ($tag->id_parent != 0) { $ptag = Tag::fromId($tag->id_parent); - $description .= '

« Go back to "' . $ptag->tag . '"

'; + $back_link = BASEURL . '/' . (!empty($ptag->slug) ? $ptag->slug . '/' : ''); + $back_link_title = 'Back to "' . $ptag->tag . '"'; } elseif ($tag->kind === 'Person') - $description .= '

« Go back to "People"

'; + { + $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. else { $id_tag = 1; $title = 'Albums'; - $description = ''; } // What page are we at? $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; parent::__construct($title . ' - Page ' . $page . ' - ' . SITE_TITLE); - - if ($id_tag !== 1) - $this->page->adopt(new DummyBox($title, $description, 'page_title_box')); + if (isset($header_box)) + $this->page->adopt($header_box); // Fetch subalbums, but only if we're on the first page. if ($page === 1) diff --git a/public/css/default.css b/public/css/default.css index d5d3092..3e870b5 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -141,10 +141,11 @@ ul#nav li a:hover { /* Tiled grid ---------------*/ -.tiled_header, .page_title_box { +.tiled_header { background: #fff; box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); color: #000; + clear: both; float: left; margin: 0 0 1.5% 0; font: 400 18px/2.2 "Open Sans", sans-serif; @@ -153,19 +154,6 @@ ul#nav li a:hover { white-space: nowrap; 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 { margin: 0; @@ -291,6 +279,43 @@ ul#nav li a:hover { 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 { background: #fff; padding: 25px; diff --git a/templates/AlbumHeaderBox.php b/templates/AlbumHeaderBox.php new file mode 100644 index 0000000..409d99a --- /dev/null +++ b/templates/AlbumHeaderBox.php @@ -0,0 +1,35 @@ +title = $title; + $this->description = $description; + $this->back_link = $back_link; + $this->back_link_title = $back_link_title; + } + + protected function html_content() + { + echo ' +
+ +
+

', $this->title, '

'; + + if (!empty($this->description)) + echo ' +

', $this->description, '

'; + + echo ' +
+
'; + } +}