From edc857f6fd91d5c52c9e0b01c4f3c7b0516d7164 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sat, 11 Mar 2023 18:22:27 +0100 Subject: [PATCH] EditTag: introduce featured thumbnail manager --- controllers/EditTag.php | 11 +++++++ public/css/default.css | 30 ++++++++++++++++++ templates/FeaturedThumbnailManager.php | 42 ++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 templates/FeaturedThumbnailManager.php diff --git a/controllers/EditTag.php b/controllers/EditTag.php index adec592a..c3d1382b 100644 --- a/controllers/EditTag.php +++ b/controllers/EditTag.php @@ -105,6 +105,17 @@ class EditTag extends HTMLController $formview = new FormView($form, $form_title ?? ''); $this->page->adopt($formview); + if (!empty($id_tag)) + { + list($assets, $num_assets) = AssetIterator::getByOptions([ + 'direction' => 'desc', + 'limit' => 500, + 'id_tag' => $id_tag, + ], true); + + $this->page->adopt(new FeaturedThumbnailManager($assets, $id_tag ? $tag->id_asset_thumb : 0)); + } + if (!empty($_POST)) { $form->verify($_POST); diff --git a/public/css/default.css b/public/css/default.css index df3e65cc..1732722b 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -355,6 +355,36 @@ i.space-invader.alt-7::before { } +/* Featured thumbnail selection +---------------------------------*/ +#featuredThumbnail { + list-style: none; + margin: 2.5% 0 0; + padding: 0; + clear: both; + overflow: auto; +} +#featuredThumbnail li { + float: left; + width: 18%; + line-height: 0; + margin: 0 1% 2%; + min-width: 200px; + height: 149px; + position: relative; +} +#featuredThumbnail input { + position: absolute; + top: 0.5rem; + right: 0.5rem; + z-index: 100; +} +#featuredThumbnail img { + width: 100%; + box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.2); +} + + /* Footer -----------*/ footer { diff --git a/templates/FeaturedThumbnailManager.php b/templates/FeaturedThumbnailManager.php new file mode 100644 index 00000000..910ecdfe --- /dev/null +++ b/templates/FeaturedThumbnailManager.php @@ -0,0 +1,42 @@ +assets = $assets; + $this->currentThumbnailId = $currentThumbnailId; + } + + protected function html_content() + { + echo ' +

Select thumbnail

+ '; + } +}