primo commit
This commit is contained in:
21
media/com_categories/css/shared-categories-accordion.css
Normal file
21
media/com_categories/css/shared-categories-accordion.css
Normal file
@ -0,0 +1,21 @@
|
||||
@charset "UTF-8";
|
||||
.com-content-categories__item {
|
||||
border-bottom: 1px solid #dfe3e7;
|
||||
}
|
||||
|
||||
.com-content-categories__item-title-wrapper {
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
padding: .5rem 0;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.com-content-categories__children {
|
||||
border-top: 1px solid #dfe3e7;
|
||||
flex-basis: 100%;
|
||||
padding-inline-start: 1.5rem;
|
||||
}
|
||||
|
||||
.com-content-categories__children .com-content-categories__item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
1
media/com_categories/css/shared-categories-accordion.min.css
vendored
Normal file
1
media/com_categories/css/shared-categories-accordion.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";.com-content-categories__item{border-bottom:1px solid #dfe3e7}.com-content-categories__item-title-wrapper{flex-wrap:wrap;justify-content:space-between;padding:.5rem 0;display:flex}.com-content-categories__children{border-top:1px solid #dfe3e7;flex-basis:100%;padding-inline-start:1.5rem}.com-content-categories__children .com-content-categories__item:last-child{border-bottom:none}
|
||||
BIN
media/com_categories/css/shared-categories-accordion.min.css.gz
Normal file
BIN
media/com_categories/css/shared-categories-accordion.min.css.gz
Normal file
Binary file not shown.
35
media/com_categories/joomla.asset.json
Normal file
35
media/com_categories/joomla.asset.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
|
||||
"name": "com_categories",
|
||||
"version": "4.0.0",
|
||||
"description": "Joomla CMS",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"assets": [
|
||||
{
|
||||
"name": "com_categories.shared-categories-accordion",
|
||||
"type": "preset",
|
||||
"dependencies": [
|
||||
"com_categories.shared-categories-accordion#style",
|
||||
"com_categories.shared-categories-accordion#script"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "com_categories.shared-categories-accordion",
|
||||
"type": "script",
|
||||
"uri": "com_categories/shared-categories-accordion.min.js",
|
||||
"dependencies": [
|
||||
"core"
|
||||
],
|
||||
"attributes": {
|
||||
"type": "module"
|
||||
},
|
||||
"version": "587c3d"
|
||||
},
|
||||
{
|
||||
"name": "com_categories.shared-categories-accordion",
|
||||
"type": "style",
|
||||
"uri": "com_categories/shared-categories-accordion.min.css",
|
||||
"version": "0dc781"
|
||||
}
|
||||
]
|
||||
}
|
||||
38
media/com_categories/js/shared-categories-accordion.js
Normal file
38
media/com_categories/js/shared-categories-accordion.js
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
if (!Joomla || !Joomla.Text) {
|
||||
throw new Error('core.js was not properly initialised');
|
||||
}
|
||||
|
||||
// Selectors used by this script
|
||||
const buttonsSelector = '[id^=category-btn-]';
|
||||
|
||||
/**
|
||||
* Handle the category toggle button click event
|
||||
* @param event
|
||||
*/
|
||||
const handleCategoryToggleButtonClick = ({
|
||||
currentTarget
|
||||
}) => {
|
||||
const button = currentTarget;
|
||||
const icon = button.querySelector('span');
|
||||
|
||||
// Toggle icon class
|
||||
icon.classList.toggle('icon-plus');
|
||||
icon.classList.toggle('icon-minus');
|
||||
|
||||
// Toggle aria label, aria-expanded
|
||||
const ariaLabel = button.getAttribute('aria-label');
|
||||
const ariaExpanded = button.getAttribute('aria-expanded');
|
||||
button.setAttribute('aria-label', ariaLabel === Joomla.Text._('JGLOBAL_EXPAND_CATEGORIES') ? Joomla.Text._('JGLOBAL_COLLAPSE_CATEGORIES') : Joomla.Text._('JGLOBAL_EXPAND_CATEGORIES'));
|
||||
button.setAttribute('aria-expanded', ariaExpanded === 'false' ? 'true' : 'false');
|
||||
const {
|
||||
categoryId
|
||||
} = button.dataset;
|
||||
const target = document.getElementById(`category-${categoryId}`);
|
||||
target.toggleAttribute('hidden');
|
||||
};
|
||||
document.querySelectorAll(buttonsSelector).forEach(button => button.addEventListener('click', handleCategoryToggleButtonClick));
|
||||
4
media/com_categories/js/shared-categories-accordion.min.js
vendored
Normal file
4
media/com_categories/js/shared-categories-accordion.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/if(!Joomla||!Joomla.Text)throw new Error("core.js was not properly initialised");const buttonsSelector="[id^=category-btn-]",handleCategoryToggleButtonClick=({currentTarget:e})=>{const t=e,o=t.querySelector("span");o.classList.toggle("icon-plus"),o.classList.toggle("icon-minus");const a=t.getAttribute("aria-label"),r=t.getAttribute("aria-expanded");t.setAttribute("aria-label",a===Joomla.Text._("JGLOBAL_EXPAND_CATEGORIES")?Joomla.Text._("JGLOBAL_COLLAPSE_CATEGORIES"):Joomla.Text._("JGLOBAL_EXPAND_CATEGORIES")),t.setAttribute("aria-expanded",r==="false"?"true":"false");const{categoryId:l}=t.dataset;document.getElementById(`category-${l}`).toggleAttribute("hidden")};document.querySelectorAll(buttonsSelector).forEach(e=>e.addEventListener("click",handleCategoryToggleButtonClick));
|
||||
BIN
media/com_categories/js/shared-categories-accordion.min.js.gz
Normal file
BIN
media/com_categories/js/shared-categories-accordion.min.js.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user