mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-27 22:38:28 +00:00
Borrow categories layout from com_contact
This commit is contained in:
parent
02baa68d28
commit
c2084a7ff9
@ -9,22 +9,22 @@
|
|||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
|
||||||
|
// Add strings for translations in Javascript.
|
||||||
|
Text::script('JGLOBAL_EXPAND_CATEGORIES');
|
||||||
|
Text::script('JGLOBAL_COLLAPSE_CATEGORIES');
|
||||||
|
|
||||||
|
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||||
|
$wa = $this->document->getWebAssetManager();
|
||||||
|
$wa->getRegistry()->addExtensionRegistryFile('com_categories');
|
||||||
|
$wa->useScript('com_categories.shared-categories-accordion');
|
||||||
|
|
||||||
Factory::getDocument()->addScriptDeclaration("
|
|
||||||
jQuery(function($) {
|
|
||||||
$('.categories-list').find('[id^=category-btn-]').each(function(index, btn) {
|
|
||||||
var btn = $(btn);
|
|
||||||
btn.on('click', function() {
|
|
||||||
btn.find('span').toggleClass('icon-plus');
|
|
||||||
btn.find('span').toggleClass('icon-minus');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});");
|
|
||||||
?>
|
?>
|
||||||
<div class="categories-list<?php echo $this->pageclass_sfx;?>">
|
<div class="com-weblinks-categories categories-list">
|
||||||
<?php
|
<?php
|
||||||
echo JLayoutHelper::render('joomla.content.categories_default', $this);
|
echo LayoutHelper::render('joomla.content.categories_default', $this);
|
||||||
echo $this->loadTemplate('items');
|
echo $this->loadTemplate('items');
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,59 +10,58 @@
|
|||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
use Joomla\CMS\HTML\HTMLHelper;
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
use Joomla\CMS\Router\Route;
|
use Joomla\CMS\Router\Route;
|
||||||
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||||
|
|
||||||
HTMLHelper::_('bootstrap.tooltip');
|
if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
|
||||||
|
|
||||||
$class = ' class="first"';
|
|
||||||
|
|
||||||
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
|
|
||||||
?>
|
?>
|
||||||
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
|
<?php foreach ($this->items[$this->parent->id] as $id => $item) : ?>
|
||||||
<?php
|
<?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
|
||||||
if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) :
|
<div class="com-weblinks-categories__items">
|
||||||
if (!isset($this->items[$this->parent->id][$id + 1]))
|
<h3 class="page-header item-title">
|
||||||
{
|
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
|
||||||
$class = ' class="last"';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<div <?php echo $class; ?> >
|
|
||||||
<?php $class = ''; ?>
|
|
||||||
<h3 class="page-header item-title">
|
|
||||||
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id));?>">
|
|
||||||
<?php echo $this->escape($item->title); ?></a>
|
<?php echo $this->escape($item->title); ?></a>
|
||||||
<?php if ($this->params->get('show_cat_num_links_cat') == 1) :?>
|
<?php if ($this->params->get('show_cat_items_cat') == 1) :?>
|
||||||
<span class="badge badge-info tip hasTooltip" title="<?php echo HTMLHelper::tooltipText('COM_WEBLINKS_NUM_ITEMS'); ?>">
|
<span class="badge bg-info">
|
||||||
|
<?php echo Text::_('COM_WEBLINKS_NUM_ITEMS'); ?>
|
||||||
<?php echo $item->numitems; ?>
|
<?php echo $item->numitems; ?>
|
||||||
</span>
|
</span>
|
||||||
<?php endif; ?>
|
|
||||||
<?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
|
|
||||||
<a id="category-btn-<?php echo $item->id;?>" href="#category-<?php echo $item->id;?>"
|
|
||||||
data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
|
|
||||||
<?php endif;?>
|
|
||||||
</h3>
|
|
||||||
<?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
|
|
||||||
<?php if ($item->description) : ?>
|
|
||||||
<div class="category-desc">
|
|
||||||
<?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
id="category-btn-<?php echo $item->id; ?>"
|
||||||
|
data-bs-target="#category-<?php echo $item->id; ?>"
|
||||||
|
data-bs-toggle="collapse"
|
||||||
|
class="btn btn-secondary btn-sm float-end"
|
||||||
|
aria-label="<?php echo Text::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"
|
||||||
|
>
|
||||||
|
<span class="icon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
<?php endif; ?>
|
||||||
|
</h3>
|
||||||
|
<?php if ($this->params->get('show_subcat_desc_cat') == 1) : ?>
|
||||||
|
<?php if ($item->description) : ?>
|
||||||
|
<div class="category-desc">
|
||||||
|
<?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) :?>
|
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
|
||||||
<div class="collapse fade" id="category-<?php echo $item->id;?>">
|
<div class="collapse fade" id="category-<?php echo $item->id; ?>">
|
||||||
<?php
|
<?php
|
||||||
$this->items[$item->id] = $item->getChildren();
|
$this->items[$item->id] = $item->getChildren();
|
||||||
$this->parent = $item;
|
$this->parent = $item;
|
||||||
$this->maxLevelcat--;
|
$this->maxLevelcat--;
|
||||||
echo $this->loadTemplate('items');
|
echo $this->loadTemplate('items');
|
||||||
$this->parent = $item->getParent();
|
$this->parent = $item->getParent();
|
||||||
$this->maxLevelcat++;
|
$this->maxLevelcat++;
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
Loading…
x
Reference in New Issue
Block a user