New bootstrap-based layout #30

Merged
Roflin merged 79 commits from bootstrap into master 2023-03-14 19:11:25 +01:00
3 changed files with 83 additions and 0 deletions
Showing only changes of commit edc857f6fd - Show all commits

View File

@ -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);

View File

@ -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 {

View 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>';
}
}