From 307d34430a18118273873904b6154261175ca60a Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sat, 11 Mar 2023 13:37:59 +0100 Subject: [PATCH] SubTemplate: use SubTemplates for boxed content only --- public/css/default.css | 22 +++++++++++++++------- templates/AdminBar.php | 4 ++-- templates/AlbumButtonBox.php | 4 ++-- templates/AlbumHeaderBox.php | 4 ++-- templates/AlbumIndex.php | 4 ++-- templates/MediaUploader.php | 6 +++--- templates/PhotoPage.php | 4 ++-- templates/PhotosIndex.php | 4 ++-- templates/SubTemplate.php | 24 +++++++++++++++++++++++- 9 files changed, 53 insertions(+), 23 deletions(-) diff --git a/public/css/default.css b/public/css/default.css index f4ecab9a..510683dc 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -8,18 +8,15 @@ @import url(//fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic); @font-face { - font-family: 'Invaders'; - src: url('fonts/invaders.ttf') format('truetype'); - font-weight: normal; - font-style: normal; + font-family: 'Invaders'; + src: url('fonts/invaders.ttf') format('truetype'); + font-weight: normal; + font-style: normal; } body { font-family: "Open Sans", sans-serif; - padding: 0 0 3em; - margin: 0; background: #aaa 0 -50% fixed; - background-image: radial-gradient(ellipse at top, #ccc 0%, #aaa 55%, #333 100%); } #wrapper, header { @@ -94,6 +91,17 @@ ul#nav li a:hover { } +/* Content boxes +------------------*/ +.content-box { + background-color: #fff; + margin: 0 auto 2rem; + padding: 2rem; + border-radius: 0.5rem; + box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1); +} + + /* Tiled grid ---------------*/ .tiled_header { diff --git a/templates/AdminBar.php b/templates/AdminBar.php index 65662fe9..daa81a8a 100644 --- a/templates/AdminBar.php +++ b/templates/AdminBar.php @@ -6,11 +6,11 @@ * Kabuki CMS (C) 2013-2015, Aaron van Geffen *****************************************************************************/ -class AdminBar extends SubTemplate +class AdminBar extends Template { private $extra_items = []; - protected function html_content() + public function html_main() { echo '
diff --git a/templates/AlbumButtonBox.php b/templates/AlbumButtonBox.php index d18ef31c..4126b726 100644 --- a/templates/AlbumButtonBox.php +++ b/templates/AlbumButtonBox.php @@ -6,7 +6,7 @@ * Kabuki CMS (C) 2013-2016, Aaron van Geffen *****************************************************************************/ -class AlbumButtonBox extends SubTemplate +class AlbumButtonBox extends Template { private $buttons; @@ -15,7 +15,7 @@ class AlbumButtonBox extends SubTemplate $this->buttons = $buttons; } - protected function html_content() + public function html_main() { echo '
'; diff --git a/templates/AlbumHeaderBox.php b/templates/AlbumHeaderBox.php index 0de991da..7dfccf17 100644 --- a/templates/AlbumHeaderBox.php +++ b/templates/AlbumHeaderBox.php @@ -6,7 +6,7 @@ * Kabuki CMS (C) 2013-2016, Aaron van Geffen *****************************************************************************/ -class AlbumHeaderBox extends SubTemplate +class AlbumHeaderBox extends Template { private $back_link_title; private $back_link; @@ -21,7 +21,7 @@ class AlbumHeaderBox extends SubTemplate $this->back_link_title = $back_link_title; } - protected function html_content() + public function html_main() { echo '
diff --git a/templates/AlbumIndex.php b/templates/AlbumIndex.php index 7fdcf646..56635a45 100644 --- a/templates/AlbumIndex.php +++ b/templates/AlbumIndex.php @@ -6,7 +6,7 @@ * Kabuki CMS (C) 2013-2015, Aaron van Geffen *****************************************************************************/ -class AlbumIndex extends SubTemplate +class AlbumIndex extends Template { protected $albums; protected $show_edit_buttons; @@ -23,7 +23,7 @@ class AlbumIndex extends SubTemplate $this->show_labels = $show_labels; } - protected function html_content() + public function html_main() { echo '
'; diff --git a/templates/MediaUploader.php b/templates/MediaUploader.php index 008cfc97..d577ec75 100644 --- a/templates/MediaUploader.php +++ b/templates/MediaUploader.php @@ -18,14 +18,14 @@ class MediaUploader extends SubTemplate protected function html_content() { echo ' -
+

Upload new photos to "', $this->tag->tag, '"

Select files

- +
- +
diff --git a/templates/PhotoPage.php b/templates/PhotoPage.php index 3ce2b550..ded285fe 100644 --- a/templates/PhotoPage.php +++ b/templates/PhotoPage.php @@ -6,7 +6,7 @@ * Kabuki CMS (C) 2013-2016, Aaron van Geffen *****************************************************************************/ -class PhotoPage extends SubTemplate +class PhotoPage extends Template { protected $photo; private $exif; @@ -34,7 +34,7 @@ class PhotoPage extends SubTemplate $this->is_asset_owner = $flag; } - protected function html_content() + public function html_main() { $this->photoNav(); $this->photo(); diff --git a/templates/PhotosIndex.php b/templates/PhotosIndex.php index c988e54f..25255c5e 100644 --- a/templates/PhotosIndex.php +++ b/templates/PhotosIndex.php @@ -6,7 +6,7 @@ * Kabuki CMS (C) 2013-2015, Aaron van Geffen *****************************************************************************/ -class PhotosIndex extends SubTemplate +class PhotosIndex extends Template { protected $mosaic; protected $show_edit_buttons; @@ -42,7 +42,7 @@ class PhotosIndex extends SubTemplate $this->show_labels = $show_labels; } - protected function html_content() + public function html_main() { echo '
'; diff --git a/templates/SubTemplate.php b/templates/SubTemplate.php index 75030de7..79f0ed0b 100644 --- a/templates/SubTemplate.php +++ b/templates/SubTemplate.php @@ -8,10 +8,32 @@ abstract class SubTemplate extends Template { + protected $_class = 'content-box container'; + protected $_id; + protected $_title; + + public function __construct($title = '') + { + $this->_title = $title; + } + public function html_main() { - echo $this->html_content(); + echo ' +
_id) ? ' id="' . $this->_id . '"' : '', '>', + $this->html_content(), ' +
'; } abstract protected function html_content(); + + public function setClassName($className) + { + $this->_class = $className; + } + + public function setDOMId($id) + { + $this->_id = $id; + } }