From d8eed7a6033f645f7c158c2d385dc2354751bf2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Wed, 24 Mar 2021 11:44:52 +0000
Subject: [PATCH] Add details element

---
 CHANGELOG.md               |  2 ++
 src/core/css/webcaosdb.css |  9 +++++++++
 src/core/xsl/entity.xsl    | 12 +++++++++---
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa2da034..6677594c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   the module documentation for more information.
 
 ### Changed (for changes in existing functionality)
+- The heading attributes datatype, path, checksum and size are now placed 
+  in a `details` html element.
 
 ### Deprecated (for soon-to-be removed features) 
 
diff --git a/src/core/css/webcaosdb.css b/src/core/css/webcaosdb.css
index c4329eb2..edabd9ea 100644
--- a/src/core/css/webcaosdb.css
+++ b/src/core/css/webcaosdb.css
@@ -708,3 +708,12 @@ footer {
     margin-left: 2ch;
     margin-right: 2ch;
 }
+
+details summary { 
+    cursor: pointer;
+    display: list-item;
+}
+
+details summary > * {
+    display: inline;
+}
diff --git a/src/core/xsl/entity.xsl b/src/core/xsl/entity.xsl
index e90b841e..6605a81e 100644
--- a/src/core/xsl/entity.xsl
+++ b/src/core/xsl/entity.xsl
@@ -175,9 +175,15 @@
         </div>
         <xsl:apply-templates mode="entity-heading-attributes" select="@description"/>
         <xsl:apply-templates mode="entity-heading-attributes-datatype" select="@datatype"/>
-        <xsl:apply-templates mode="entity-heading-attributes-path" select="@path"/>
-        <xsl:apply-templates mode="entity-heading-attributes" select="@*[not(contains('+checksum+cuid+id+name+description+datatype+path+',concat('+',name(),'+')))]"/>
-        <xsl:apply-templates mode="entity-heading-attributes-checksum" select="@checksum"/>
+        <xsl:apply-templates mode="entity-heading-attributes" select="@*[not(contains('+checksum+size+cuid+id+name+description+datatype+path+',concat('+',name(),'+')))]"/>
+        <xsl:if test="@*[contains('+path+checksum+size+',concat('+',name(),'+'))]">
+          <details>
+            <summary><small>File Details</small></summary>
+            <xsl:apply-templates mode="entity-heading-attributes-path" select="@path"/>
+            <xsl:apply-templates mode="entity-heading-attributes-checksum" select="@checksum"/>
+            <xsl:apply-templates mode="entity-heading-attributes" select="@size"/>
+          </details>
+        </xsl:if>
       </div>
       <xsl:apply-templates mode="entity-action-panel" select="."/>
       <div class="panel-body caosdb-entity-panel-body">
-- 
GitLab