diff --git a/src/components/com_weblinks/tmpl/categories/default.php b/src/components/com_weblinks/tmpl/categories/default.php index 7e89cb1..63ad1f6 100644 --- a/src/components/com_weblinks/tmpl/categories/default.php +++ b/src/components/com_weblinks/tmpl/categories/default.php @@ -9,22 +9,22 @@ 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'); - }); - }); -});"); ?> -
+ diff --git a/src/components/com_weblinks/tmpl/categories/default_items.php b/src/components/com_weblinks/tmpl/categories/default_items.php index b64c3b2..374999a 100644 --- a/src/components/com_weblinks/tmpl/categories/default_items.php +++ b/src/components/com_weblinks/tmpl/categories/default_items.php @@ -10,59 +10,58 @@ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; use Joomla\Component\Weblinks\Site\Helper\RouteHelper; -HTMLHelper::_('bootstrap.tooltip'); - -$class = ' class="first"'; - -if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) : +if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) : ?> - items[$this->parent->id] as $id => $item) : ?> - params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : - if (!isset($this->items[$this->parent->id][$id + 1])) - { - $class = ' class="last"'; - } - ?> -
> - - + params->get('show_subcat_desc_cat') == 1) : ?> + description) : ?> +
+ description, '', 'com_weblinks.categories'); ?> +
+ + - getChildren()) > 0 && $this->maxLevelcat > 1) :?> -
- items[$item->id] = $item->getChildren(); - $this->parent = $item; - $this->maxLevelcat--; - echo $this->loadTemplate('items'); - $this->parent = $item->getParent(); - $this->maxLevelcat++; - ?> -
- -
- - - + maxLevelcat > 1 && count($item->getChildren()) > 0) : ?> +
+ items[$item->id] = $item->getChildren(); + $this->parent = $item; + $this->maxLevelcat--; + echo $this->loadTemplate('items'); + $this->parent = $item->getParent(); + $this->maxLevelcat++; + ?> +
+ +
+ + + \ No newline at end of file