diff --git a/src/main/resources/application-dev.yaml.sample b/src/main/resources/application-dev.yaml.sample index 71535c08bd8..e69c7e68c34 100644 --- a/src/main/resources/application-dev.yaml.sample +++ b/src/main/resources/application-dev.yaml.sample @@ -16,3 +16,11 @@ spring: datasource: username: password: + + web: + resources: + # Don't cache static resources. Local edits to admin UI static files are immediately visible. + cache: + period: 0 + chain: + cache: false diff --git a/src/main/resources/public/admin/admin.css b/src/main/resources/public/admin/admin.css new file mode 100644 index 00000000000..d7c21b68c2a --- /dev/null +++ b/src/main/resources/public/admin/admin.css @@ -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; +} diff --git a/src/main/resources/public/admin/admin.js b/src/main/resources/public/admin/admin.js new file mode 100644 index 00000000000..692e00887b4 --- /dev/null +++ b/src/main/resources/public/admin/admin.js @@ -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); diff --git a/src/main/resources/templates/admin/header.html b/src/main/resources/templates/admin/header.html index 11d3eb8db95..c658cac0c23 100644 --- a/src/main/resources/templates/admin/header.html +++ b/src/main/resources/templates/admin/header.html @@ -5,22 +5,10 @@ Terraware Administration - - - + + + diff --git a/src/main/resources/templates/admin/index.html b/src/main/resources/templates/admin/index.html index 7cb26a1dea3..2e4ee01ebd3 100644 --- a/src/main/resources/templates/admin/index.html +++ b/src/main/resources/templates/admin/index.html @@ -1,42 +1,6 @@ - - - - - +