Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-30090: As an editor I would like content tree panel staying opene…
…d until clicking on a Content Tree button again (#826) * EZP-30090: As an editor I would like content tree panel staying opened until clicking on a Content Tree button again * fixup
- Loading branch information
Showing
5 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
21 changes: 19 additions & 2 deletions
21
src/bundle/Resources/public/js/scripts/admin.location.content.tree.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
(function(doc, React, ReactDOM, eZ) { | ||
(function(doc, React, ReactDOM, eZ, localStorage) { | ||
const KEY_CONTENT_TREE_EXPANDED = 'ez-content-tree-expanded'; | ||
const CLASS_CONTENT_TREE_EXPANDED = 'ez-content-tree-container--expanded'; | ||
const CLASS_BTN_CONTENT_TREE_EXPANDED = 'ez-btn--content-tree-expanded'; | ||
const contentTreeContainer = doc.querySelector('.ez-content-tree-container'); | ||
const btn = doc.querySelector('.ez-btn--toggle-content-tree'); | ||
const toggleContentTreePanel = () => { | ||
contentTreeContainer.classList.toggle(CLASS_CONTENT_TREE_EXPANDED); | ||
btn.classList.toggle(CLASS_BTN_CONTENT_TREE_EXPANDED); | ||
|
||
localStorage.setItem(KEY_CONTENT_TREE_EXPANDED, contentTreeContainer.classList.contains(CLASS_CONTENT_TREE_EXPANDED)); | ||
}; | ||
|
||
ReactDOM.render(React.createElement(eZ.modules.ContentTree, {}), contentTreeContainer); | ||
})(window.document, window.React, window.ReactDOM, window.eZ); | ||
|
||
btn.addEventListener('click', toggleContentTreePanel, false); | ||
|
||
if (localStorage.getItem(KEY_CONTENT_TREE_EXPANDED) === 'true') { | ||
contentTreeContainer.classList.add(CLASS_CONTENT_TREE_EXPANDED); | ||
btn.classList.add(CLASS_BTN_CONTENT_TREE_EXPANDED); | ||
} | ||
})(window.document, window.React, window.ReactDOM, window.eZ, window.localStorage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,3 +181,9 @@ | |
} | ||
} | ||
} | ||
|
||
.ez-btn--content-tree-expanded { | ||
background: $ez-white; | ||
border-color: $ez-white; | ||
color: $ez-black; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters