* Upgrade Stimulus to 3.0 * Remove unused variable * Bump postcss from 8.3.8 to 8.3.9 (#14956) Bumps [postcss](https://github.com/postcss/postcss) from 8.3.8 to 8.3.9. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.3.8...8.3.9) --- updated-dependencies: - dependency-name: postcss dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
31 lines
784 B
JavaScript
31 lines
784 B
JavaScript
import { Controller } from '@hotwired/stimulus';
|
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
|
export default class SidebarController extends Controller {
|
|
static targets = ['submenu'];
|
|
|
|
disableCurrentNavItem() {
|
|
if (this.submenuTargets.length > 0) {
|
|
const activeMenuId = this.submenuTargets.filter((item) =>
|
|
item.classList.contains('show'),
|
|
)[0]?.id;
|
|
|
|
if (activeMenuId) {
|
|
const activeButton = document.getElementById(`${activeMenuId}_button`);
|
|
activeButton.setAttribute('disabled', true);
|
|
}
|
|
}
|
|
}
|
|
|
|
expandDropdown() {
|
|
this.closeOtherMenus();
|
|
}
|
|
|
|
closeOtherMenus() {
|
|
this.submenuTargets.map((item) => {
|
|
if (item.classList.contains('show')) {
|
|
item.classList.remove('show');
|
|
}
|
|
});
|
|
}
|
|
}
|