Skip to content

Commit

Permalink
Sub- and superordination links 2.0 in details and search (#24, #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Jan 26, 2017
1 parent f3bc0ed commit 50e0c93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions app/views/query.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}

@labelRaw = @{
if(raw.contains("multiVolumeWork")) {select(("Band","Bände"))} else if (raw.contains("series")) {select(("Serienband","Serienbände"))} else if (raw.contains("containedIn")) {select(("Beitrag","Beiträge"))} else {""}
if(q.contains("multiVolumeWork")) {select(("Band","Bände"))} else if (q.contains("series")) {select(("Serienband","Serienbände"))} else if (q.contains("containedIn")) {select(("Beitrag","Beiträge"))} else {""}
}

@main("lobid-resources - Ergebnisliste") {
Expand Down Expand Up @@ -84,9 +84,9 @@
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-10">
@allHits @if(!raw.isEmpty && !raw.contains(Lobid.escapeUri(Application.COVERAGE_FIELD.replace(".raw","")))){
@defining(Application.CONFIG.getString("resources.api") + "/" + raw.substring(raw.lastIndexOf("/")+1)) { lobidUrl =>
@labelRaw in: <a href="@lobidUrl.replace("/resource/","/resources/")">@Html(Lobid.resourceLabel(lobidUrl))</a>}}else{Treffer},
@allHits @if(!q.isEmpty && !q.contains(Lobid.escapeUri(Application.COVERAGE_FIELD.replace(".raw","")))){
@defining("http://lobid.org/resources/" + q.substring(q.lastIndexOf("/")+1, q.length()-1)) { lobidUrl =>
@labelRaw in: <a href="@lobidUrl">@Html(Lobid.resourceLabel(lobidUrl))</a>}}else{Treffer},
zeige @(from+1) bis @(Math.min(from+hits.size,from+size)):
</div>
<div class="col-md-1" style="text-align: right; padding-right: 4px;">
Expand Down
16 changes: 8 additions & 8 deletions app/views/tags/result_doc.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
}

@subordinated(field:String, id:String, label:String, values:(String,String)) = {
@defining(new Index().queryResources(field+"\""+Lobid.escapeUri(id)+"\"",0,0,"").getTotal){ hits => @if(hits > 0) {
@defining(new Index().queryResources(field+":\""+Lobid.escapeUri(id)+"\"",0,0,"").getTotal){ hits => @if(hits > 0) {
@defining(if(hits==1){values._1} else {values._2}){ value =>
<tr><td>@label</td><td><a title="@value" href="@resources.routes.Application.query(raw=Lobid.escapeUri(field)+":"+Lobid.escapeUri(id),set="*")">@hits @value</a></td></tr>
<tr><td>@label</td><td><a title="@value" href="@resources.routes.Application.query(q=field+":\""+Lobid.escapeUri(id)+"\"")">@hits @value</a></td></tr>
}}}
}

@lobidUrl(node: JsValue) = @{
"http://lobid.org/resource/" + node.asOpt[Seq[String]].getOrElse(Seq("--"))(0)
@lobidUrl(hbzId: String) = @{
"http://lobid.org/resources/" + hbzId + "#!"
}

@lobid2_part_of(field: String, subField: String) = {
Expand Down Expand Up @@ -108,10 +108,10 @@
@result_field("Erscheinungsweise", "frequency", doc, TableRow.VALUES)
@lobid2_part_of("inSeries", "series")
@lobid2_part_of("volumeIn", "multiVolumeWork")
@defining(lobidUrl((doc \\ "hbzId")(0))){ id =>
@subordinated("@graph.http://purl.org/lobid/lv#multiVolumeWork.@id", id, "Bände", ("zugehöriger Band", "zugehörige Bände"))
@subordinated("@graph.http://purl.org/lobid/lv#series.@id", id, "Serienbände", ("zugehöriger Serienband", "zugehörige Serienbände"))
@subordinated("@graph.http://purl.org/lobid/lv#containedIn.@id", id, "Enthält", ("Beitrag", "Beiträge"))
@defining(lobidUrl((doc \ "hbzId").asOpt[String].getOrElse(""))){ id =>
@subordinated("volumeIn.multiVolumeWork.id", id, "Bände", ("zugehöriger Band", "zugehörige Bände"))
@subordinated("inSeries.series.id", id, "Serienbände", ("zugehöriger Serienband", "zugehörige Serienbände"))
@subordinated("containedIn.id", id, "Enthält", ("Beitrag", "Beiträge"))
}

@subjects((doc \ "subject").asOpt[Seq[JsValue]].getOrElse(Seq()))
Expand Down

0 comments on commit 50e0c93

Please sign in to comment.