-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move common admin UI CSS/JS to static files (#2619)
Move the shared CSS properties to a separate CSS file rather than including them in every page's HTML. Make the persistent expandable section functionality available to all admin UI pages. In dev environments, if you're working on the admin UI, you'll want to be able to see edits to these files right away; add options to disable static-content caching to the example application config file for dev environments.
- Loading branch information
Showing
5 changed files
with
54 additions
and
52 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
details.section { | ||
margin-left: 32px; | ||
} | ||
|
||
details.section summary { | ||
margin-top: 16px; | ||
margin-left: -32px; | ||
font-size: 18pt; | ||
font-weight: bold; | ||
} | ||
|
||
input { | ||
margin-top: 4px; | ||
} | ||
|
||
select { | ||
margin-top: 4px; | ||
} | ||
|
||
tr.striped:nth-child(even) { | ||
background-color: lightgray; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function rememberSectionExpansions() { | ||
const detailsElements = document.querySelectorAll('details.section'); | ||
const detailsState = JSON.parse(localStorage.getItem('adminSectionsExpanded')) || {}; | ||
|
||
detailsElements.forEach(details => { | ||
// Expand previously-expanded sections on initial load. | ||
if (details.id in detailsState) { | ||
details.open = detailsState[details.id]; | ||
} | ||
|
||
// As sections are toggled, update local storage to reflect their states. | ||
details.addEventListener('toggle', () => { | ||
detailsState[details.id] = details.open; | ||
localStorage.setItem('adminSectionsExpanded', JSON.stringify(detailsState)); | ||
}); | ||
}); | ||
} | ||
|
||
// Expand previously-opened sections on page load. | ||
document.addEventListener('DOMContentLoaded', rememberSectionExpansions); |
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