From 5bc6186447dae801369db223402d9ebcd0a4be52 Mon Sep 17 00:00:00 2001 From: Roger Espinosa Date: Wed, 29 Nov 2023 16:05:55 -0500 Subject: [PATCH] fixing picklists + headers + extra browse --- src/js/text/handlers/action-toggle-tree.js | 21 +++ src/js/text/main.js | 1 + styles/styles.css | 119 +++++++++++++++-- templates/text/browse.xml | 3 + templates/text/dlxsclassglobals.xml | 1 + templates/text/picklist.xml | 5 +- templates/text/qbat/qbat.pageviewer.xsl | 2 +- templates/text/qbat/qbat.picklist.xsl | 124 +++++++++--------- templates/text/qbat/qbat.static.xsl | 68 +++++++++- .../text/qui/includes/qui.header-common.xsl | 2 +- templates/text/qui/qui.browse.xsl | 25 +++- templates/text/qui/qui.picklist.xsl | 10 +- templates/text/qui/qui.static.xsl | 31 +++++ templates/text/staticincl.xml | 2 + 14 files changed, 327 insertions(+), 87 deletions(-) create mode 100644 src/js/text/handlers/action-toggle-tree.js diff --git a/src/js/text/handlers/action-toggle-tree.js b/src/js/text/handlers/action-toggle-tree.js new file mode 100644 index 0000000..cc36124 --- /dev/null +++ b/src/js/text/handlers/action-toggle-tree.js @@ -0,0 +1,21 @@ +window.addEventListener('DOMContentLoaded', (event) => { + + const toggleDetails = function(value) { + detailsEls.forEach((el) => { + el.open = value; + }) + } + + const detailsEls = document.querySelectorAll('details.tree'); + const btnExpandAll = document.querySelector('button[data-action="expand-all"]'); + const btnCollapseAll = document.querySelector('button[data-action="collapse-all"]'); + + btnExpandAll.addEventListener('click', () => { + toggleDetails(true); + }) + + btnCollapseAll.addEventListener('click', () => { + toggleDetails(false); + }) + +}); \ No newline at end of file diff --git a/src/js/text/main.js b/src/js/text/main.js index b67207d..42c9142 100644 --- a/src/js/text/main.js +++ b/src/js/text/main.js @@ -16,6 +16,7 @@ import "./handlers/action-bookbag-form.js"; import "./handlers/action-copy-text.js"; import "./handlers/action-item-download.js"; +import "./handlers/action-toggle-tree.js"; import "./handlers/item-page-navigator.js"; import "./viewers/viewer-mirador.js"; // import "./viewers/viewer-plaintext.js"; diff --git a/styles/styles.css b/styles/styles.css index 00fd0b1..3bc1826 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -75,16 +75,119 @@ ul ul { } -ul.list-bulleted, .text-block ul { +ul.list-bulleted { list-style: initial; padding: revert; } -ol.list-numbered, text-block ol { +ol.list-numbered, text-block ol:not([class]) { list-style: decimal; padding: revert; } +/* TREE */ +.list-tree{ + --spacing : 1.5rem; + --radius : 12px; +} + +.list-tree li{ + display : block; + position : relative; + padding: 1rem 0; + padding-left : calc(2 * var(--spacing) - var(--radius) - 2px); + margin-top: -4px; +} + +.xxlist-tree li:last-child { + margin-top: -4px; /* magic! */ +} + +.list-tree ul{ + margin-left : calc(var(--radius) - var(--spacing)); + padding-left : 0; +} + +.list-tree ul li{ + border-left : 2px solid #ddd; +} + +.list-tree ul li:last-child{ + border-color : transparent; +} + +.list-tree ul li::before{ + content : ''; + display : block; + position : absolute; + top : calc(var(--spacing) / -2 + 1rem); + left : -2px; + width : calc(var(--spacing) + 2px); + height : calc(var(--spacing) + 1px); + border : solid #ddd; + border-width : 0 0 2px 2px; +} + +.list-tree summary{ + display : block; + cursor : pointer; +} + +.list-tree summary::marker, +.list-tree summary::-webkit-details-marker{ + display : none; +} + +.list-tree summary:focus{ + outline : none; +} + +.list-tree summary:focus-visible{ + outline : 1px dotted #000; +} + +.list-tree li::after, +.list-tree summary::before{ + content : ''; + display : block; + position : absolute; + top : calc(var(--spacing) / 2 - var(--radius) + 1rem); + left : calc(var(--spacing) - var(--radius) - 1px); + width : calc(2 * var(--radius)); + height : calc(2 * var(--radius)); + border-radius : 50%; + background : #ddd; +} + +.list-tree summary::before{ + z-index : 1; + /* background : #696 url('expand-collapse.svg') 0 0; */ + display: flex; + align-items: center; + justify-content: center; + font-family: "Material Icons"; + font-size: 24px; + content: "\e5ce"; + content: "\e409"; + content: "\e145"; + background: var(--color-teal-300); + color: white; +} + +.list-tree details[open] > summary::before{ + background-position : calc(-2 * var(--radius)) 0; + content: "\e5cf"; + content: "\e15b"; +} + +.list-tree a, .list-tree details { + margin-left: 1rem; +} + +.list-tree a { + display: block; +} + svg { display: inline-block; vertical-align: middle; @@ -128,7 +231,7 @@ main { /** Details **/ -details > summary { +details.panel > summary { list-style: none; cursor: pointer; padding: 0.25em 0.5em; @@ -142,31 +245,31 @@ details.panel > summary { border-left: 2px solid transparent; } -details[open] { +details.panel[open] { padding: 0.25em 0.5em; } -details[open] > summary:first-of-type { +details.panel[open] > summary:first-of-type { font-weight: var(--semibold); color: var(--color-teal-400); border-left: 2px solid var(--color-teal-400); padding: 0.25em 0.5em; } -details > summary::after { +details.panel > summary::after { font-family: "Material Icons"; font-size: 24px; content: "\e5cf"; color: var(--color-teal-400); } -details[open] > summary::after { +details.panel[open] > summary::after { font-family: "Material Icons"; content: "\e5ce"; color: var(--color-teal-400); } /* Removes the default arrow on Chrome */ -details > summary::-webkit-details-marker { +details.panel > summary::-webkit-details-marker { display: none; } diff --git a/templates/text/browse.xml b/templates/text/browse.xml index f7836d4..40d5256 100644 --- a/templates/text/browse.xml +++ b/templates/text/browse.xml @@ -34,6 +34,9 @@ + + + diff --git a/templates/text/dlxsclassglobals.xml b/templates/text/dlxsclassglobals.xml index 9ff4e22..d279e13 100644 --- a/templates/text/dlxsclassglobals.xml +++ b/templates/text/dlxsclassglobals.xml @@ -16,5 +16,6 @@ + \ No newline at end of file diff --git a/templates/text/picklist.xml b/templates/text/picklist.xml index 64741b1..e4702fd 100644 --- a/templates/text/picklist.xml +++ b/templates/text/picklist.xml @@ -9,8 +9,9 @@ ../vendor/str.split.function.xsl ../vendor/xslfunctions.xsl qui/components/*.xsl - qui/includes/qui.results-item.xsl - qui/includes/qui.scopedivs.xsl + qui/includes/qui.header-common.xsl + qui/includes/qui.header-reslist.xsl + qui/qui.picklist.xsl diff --git a/templates/text/qbat/qbat.pageviewer.xsl b/templates/text/qbat/qbat.pageviewer.xsl index 9700150..3d2031d 100644 --- a/templates/text/qbat/qbat.pageviewer.xsl +++ b/templates/text/qbat/qbat.pageviewer.xsl @@ -5,7 +5,7 @@ diff --git a/templates/text/qbat/qbat.picklist.xsl b/templates/text/qbat/qbat.picklist.xsl index b09857f..14df3e8 100644 --- a/templates/text/qbat/qbat.picklist.xsl +++ b/templates/text/qbat/qbat.picklist.xsl @@ -340,35 +340,37 @@ -
+
+
-

-
-
-
Issues
- -
- - - -
-
-
-
+
+
+
+
Issues
+ +
+ + + +
+
+
+
+
-
+
@@ -386,63 +388,65 @@ - + + + + + + + + +
- - - - - - - -

-
- - - -
-
Links
- - - - -
-
- -
- - -
+
+
+ + + +
+
Links
+ + + + +
+
+ +
+ + + +
diff --git a/templates/text/qbat/qbat.static.xsl b/templates/text/qbat/qbat.static.xsl index 38e662b..665bdea 100644 --- a/templates/text/qbat/qbat.static.xsl +++ b/templates/text/qbat/qbat.static.xsl @@ -5,6 +5,7 @@ + @@ -39,6 +40,9 @@
+ +
+
+ +
+ tree + + +
+
+
panel w-100 @@ -94,9 +109,32 @@ + +
+ + +
+
    + +
+
+
    - list-unstyled + + + + + + list-unstyled + +
@@ -104,7 +142,12 @@
  • - mb-1 +
  • @@ -128,4 +171,23 @@
    + + + + + + \ No newline at end of file diff --git a/templates/text/qui/includes/qui.header-common.xsl b/templates/text/qui/includes/qui.header-common.xsl index 9883889..b2aa060 100644 --- a/templates/text/qui/includes/qui.header-common.xsl +++ b/templates/text/qui/includes/qui.header-common.xsl @@ -450,7 +450,7 @@ - + pubinfo diff --git a/templates/text/qui/qui.browse.xsl b/templates/text/qui/qui.browse.xsl index 438f094..bb689f2 100644 --- a/templates/text/qui/qui.browse.xsl +++ b/templates/text/qui/qui.browse.xsl @@ -105,13 +105,24 @@ - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/templates/text/qui/qui.picklist.xsl b/templates/text/qui/qui.picklist.xsl index 3042e75..f3e8d1d 100644 --- a/templates/text/qui/qui.picklist.xsl +++ b/templates/text/qui/qui.picklist.xsl @@ -99,13 +99,13 @@ - + - - + + metadata @@ -157,7 +157,7 @@ - + @@ -199,7 +199,7 @@ - + diff --git a/templates/text/qui/qui.static.xsl b/templates/text/qui/qui.static.xsl index 67d417c..80b431e 100644 --- a/templates/text/qui/qui.static.xsl +++ b/templates/text/qui/qui.static.xsl @@ -5,6 +5,9 @@ + + + @@ -24,6 +27,9 @@ + + + @@ -42,6 +48,31 @@ + + + + + + + true + + + + + + + + + + + + + + + + + + diff --git a/templates/text/staticincl.xml b/templates/text/staticincl.xml index 22bcde5..e3b24d0 100644 --- a/templates/text/staticincl.xml +++ b/templates/text/staticincl.xml @@ -21,6 +21,8 @@ + +