From 2d77fbdbb7469319a0bf4d5602fb62cd8de867a8 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sun, 4 Sep 2016 14:49:13 +0200 Subject: [PATCH] Add very basic context buttons to album pages. --- controllers/ViewPhotoAlbum.php | 11 +++++++++++ public/css/default.css | 18 ++++++++++++++++++ templates/AlbumButtonBox.php | 28 ++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 templates/AlbumButtonBox.php diff --git a/controllers/ViewPhotoAlbum.php b/controllers/ViewPhotoAlbum.php index 32b2ece..3cc4876 100644 --- a/controllers/ViewPhotoAlbum.php +++ b/controllers/ViewPhotoAlbum.php @@ -57,6 +57,17 @@ class ViewPhotoAlbum extends HTMLController if (isset($header_box)) $this->page->adopt($header_box); + $this->page->adopt(new AlbumButtonBox([ + [ + 'url' => BASEURL . '/uploadmedia/?tag=' . $id_tag, + 'caption' => 'Upload new photos here', + ], + [ + 'url' => BASEURL . '/addalbum/?tag=' . $id_tag, + 'caption' => 'Create new subalbum here', + ] + ])); + // 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 4b38af8..2129e5e 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -314,6 +314,23 @@ ul#nav li a:hover { } +/* Album button box +---------------------*/ +.album_button_box { + float: right; + margin-bottom: 20px; +} +.album_button_box > a { + background: #fff; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); + display: inline-block; + float: left; + font-size: 1em; + padding: 8px 10px; + margin-left: 12px; +} + + /* Generic boxed content --------------------------*/ .boxed_content { @@ -703,6 +720,7 @@ a#previous_photo:hover, a#next_photo:hover { border-color: #aaa; } + /* Spinner animation ----------------------*/ .spinner { diff --git a/templates/AlbumButtonBox.php b/templates/AlbumButtonBox.php new file mode 100644 index 0000000..5228fe7 --- /dev/null +++ b/templates/AlbumButtonBox.php @@ -0,0 +1,28 @@ +buttons = $buttons; + } + + protected function html_content() + { + echo ' +
'; + + foreach ($this->buttons as $button) + echo ' + ', $button['caption'], ''; + + echo ' +
'; + } +}