forked from Public/pics
EditTag: introduce featured thumbnail manager
This commit is contained in:
parent
a9a347c638
commit
edc857f6fd
@ -105,6 +105,17 @@ class EditTag extends HTMLController
|
|||||||
$formview = new FormView($form, $form_title ?? '');
|
$formview = new FormView($form, $form_title ?? '');
|
||||||
$this->page->adopt($formview);
|
$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))
|
if (!empty($_POST))
|
||||||
{
|
{
|
||||||
$form->verify($_POST);
|
$form->verify($_POST);
|
||||||
|
@ -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
|
||||||
-----------*/
|
-----------*/
|
||||||
footer {
|
footer {
|
||||||
|
42
templates/FeaturedThumbnailManager.php
Normal file
42
templates/FeaturedThumbnailManager.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/*****************************************************************************
|
||||||
|
* FeaturedThumbnailManager.php
|
||||||
|
* Contains the featured thumbnail manager template.
|
||||||
|
*
|
||||||
|
* Kabuki CMS (C) 2013-2021, Aaron van Geffen
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
class FeaturedThumbnailManager extends SubTemplate
|
||||||
|
{
|
||||||
|
private $assets;
|
||||||
|
private $currentThumbnailId;
|
||||||
|
|
||||||
|
public function __construct(AssetIterator $assets, $currentThumbnailId)
|
||||||
|
{
|
||||||
|
$this->assets = $assets;
|
||||||
|
$this->currentThumbnailId = $currentThumbnailId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function html_content()
|
||||||
|
{
|
||||||
|
echo '
|
||||||
|
<h2>Select thumbnail</h2>
|
||||||
|
<ul id="featuredThumbnail">';
|
||||||
|
|
||||||
|
while ($asset = $this->assets->next())
|
||||||
|
{
|
||||||
|
$image = $asset->getImage();
|
||||||
|
echo '
|
||||||
|
<li>
|
||||||
|
<input class="form-check-input" type="radio" name="featuredThumbnail" value="', $image->getId(), '"',
|
||||||
|
$this->currentThumbnailId == $image->getId() ? ' checked' : '', '>
|
||||||
|
<img src="', $image->getThumbnailUrl(150, 100, 'top'), '" alt="" title="', $image->getTitle(), '" onclick="this.parentNode.children[0].checked = true">
|
||||||
|
</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assets->clean();
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</ul>';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user