Skip to content

Commit

Permalink
revert adding useVisibility, and extract tree_view_pages to a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilelkihal committed Oct 25, 2024
1 parent f563d2d commit 9c76426
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/javascript/controllers/simple_tree_controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Controller } from '@hotwired/stimulus'

const TREE_VIEW_PAGES = ['classes', 'properties', 'schemes', 'collections', 'instances']

// Connects to data-controller="simple-tree"
export default class extends Controller {

Expand Down Expand Up @@ -26,8 +29,8 @@ export default class extends Controller {
#centerTreeView() {
setTimeout(() => {
const location = window.location.href;
const isTreeViewPage = ['classes', 'properties', 'schemes', 'collections', 'instances']
.some(param => location.includes(`p=${param}`));

const isTreeViewPage = TREE_VIEW_PAGES.some(param => location.includes(`p=${param}`));

if (isTreeViewPage) {
const activeElem = this.element.querySelector('.tree-link.active');
Expand Down

0 comments on commit 9c76426

Please sign in to comment.