From f0faf90f26180ced6045fe1c8266ca84421eea7a Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Thu, 15 Feb 2024 15:11:55 +0100 Subject: [PATCH] Update `labelled` view block to support multiple values (RPB-115) And tweak field label for `description` as discussed in RPB-115 --- app/views/tags/result_doc.scala.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/views/tags/result_doc.scala.html b/app/views/tags/result_doc.scala.html index 060a7892..5dc3dd75 100644 --- a/app/views/tags/result_doc.scala.html +++ b/app/views/tags/result_doc.scala.html @@ -7,12 +7,24 @@ @import controllers.nwbib.Application.CONFIG @import controllers.nwbib.Application.ZDB_PREFIX +@idAndLabelLink(e: JsValue) = { + @((e\"label").asOpt[String].getOrElse("--")) +} + @labelled(label: String, key: String) = { @if((doc\key).asOpt[Seq[JsValue]].isDefined) { + @defining((doc\key).asOpt[Seq[JsValue]].getOrElse(Seq(doc\key))) { elems => @label - @(((doc\key)(0)\"label").asOpt[String].getOrElse("--")) + @idAndLabelLink(elems.head.asOpt[JsValue].get) + @for(elem <- elems.tail; e <- elem.asOpt[JsValue]) { + + + @idAndLabelLink(e) + + } + } } } @@ -267,7 +279,7 @@ @result_field("Schlagwortfolge", "subjectChain", doc, TableRow.VALUES, valueLabel = Option(Seq())) - @labelled("Inhaltsangabe", "description") + @labelled("Weitere Informationen", "description") @labelled("Inhaltsverzeichnis", "tableOfContents") @labelled("Volltext", "fulltextOnline") }