Skip to content

Commit

Permalink
Update labelled view block to support multiple values (RPB-115)
Browse files Browse the repository at this point in the history
And tweak field label for `description` as discussed in RPB-115
  • Loading branch information
fsteeg committed Feb 15, 2024
1 parent 457276b commit f0faf90
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/views/tags/result_doc.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,24 @@
@import controllers.nwbib.Application.CONFIG
@import controllers.nwbib.Application.ZDB_PREFIX

@idAndLabelLink(e: JsValue) = {
<a href='@((e\"id").asOpt[String].getOrElse("--"))'>@((e\"label").asOpt[String].getOrElse("--"))</a>
}

@labelled(label: String, key: String) = {
@if((doc\key).asOpt[Seq[JsValue]].isDefined) {
@defining((doc\key).asOpt[Seq[JsValue]].getOrElse(Seq(doc\key))) { elems =>
<tr>
<td>@label</td>
<td><a href='@(((doc\key)(0)\"id").asOpt[String].getOrElse("--"))'>@(((doc\key)(0)\"label").asOpt[String].getOrElse("--"))</a></td>
<td>@idAndLabelLink(elems.head.asOpt[JsValue].get)</td>
</tr>
@for(elem <- elems.tail; e <- elem.asOpt[JsValue]) {
<tr>
<td></td>
<td>@idAndLabelLink(e)</td>
</tr>
}
}
}
}

Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit f0faf90

Please sign in to comment.