Skip to content

Commit

Permalink
Merge branch 'rpb-152-ui' of https://github.com/hbz/lobid-gnd into rppd
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Mar 27, 2024
2 parents b9b8565 + 89febee commit ed59e71
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 115 deletions.
8 changes: 8 additions & 0 deletions app/controllers/HomeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,14 @@ public static String formatCount(long count) {
return df.format(count);
}

public static String formatName(String name) {
String[] lastAndFirst = name.split(", ");
if (lastAndFirst.length != 2) {
return name;
}
return lastAndFirst[1] + " " + lastAndFirst[0];
}

private String attribution(String url) {
try {
return requestInfo(httpClient, url).thenApply(info -> {
Expand Down
34 changes: 16 additions & 18 deletions app/views/details.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,27 +218,25 @@
}

@if(resource == null){
@main("", "lobid-gnd") {
<div id="search-results" class="alert alert-info text-center">Ein Titel mit der ID @request.uri.toString.split("/").last konnte nicht gefunden werden.</div>
@main("", "RPPD", allHits) {
<div class="alert alert-warning text-center">Eine Person mit der ID '@request.uri.toString.split("/").last' konnte nicht gefunden werden.</div>
}
} else {
@main("", resource.preferredName, allHits) {
<div class="page-header">
<h1>
@defining("Namen in die Zwischenablage kopieren") { title =>
<a class="invisible-link" data-toggle="tooltip" data-placement="right" title="@title" href="#" onclick="copyToClipboard('@(resource.title)', $(this), '@title'); return false;">
@resource.title
</a>
}
<small>
/ @resource.lifeDates
<div class='pull-right'>
<a title="JSON-LD-Indexdaten anzeigen" href='@routes.HomeController.authorityDotFormat(resource.getId, "json")'>
<img class='json-ld-icon' src='@routes.Assets.versioned("images/json-ld.png")' alt='JSON'/></a>
</div>
</small>
</h1>
</div>
<h1 style="margin-top:0px">
@defining("Namen in die Zwischenablage kopieren") { title =>
<a class="invisible-link" data-toggle="tooltip" data-placement="right" title="@title" href="#" onclick="copyToClipboard('@(resource.title)', $(this), '@title'); return false;">
@resource.title
</a>
}
<small>
/ @resource.lifeDates
<div class='pull-right'>
<a title="JSON-LD-Indexdaten anzeigen" href='@routes.HomeController.authorityDotFormat(resource.getId, "json")'>
<img class='json-ld-icon' src='@routes.Assets.versioned("images/json-ld.png")' alt='JSON'/></a>
</div>
</small>
</h1>
@*
@if(resource.gndRelationEdges != "[]"){
<ul class="nav nav-tabs" role="tablist">
Expand Down
7 changes: 2 additions & 5 deletions app/views/index.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@

@import helper._
@import controllers.HomeController.formatCount
@import controllers.HomeController.formatName
@import controllers.HomeController.thisDay
@import play.api.libs.json._
@import controllers.HomeController.CONFIG

@main("", "RPPD", allHits) {
<div class="page-header">
<img class="media-object nrw-logo pull-right" src="@controllers.routes.Assets.versioned("images/wappen.png")" alt="NRW">
<h1>@dataset.get("alternateName").get("de").asText()<br/><small>@formatCount(allHits) Personen aus allen Wissensgebieten <span class="badge">beta</span></small></h1>
</div>
<div class="row">
<div class="col-md-3">
<p><strong>Jubiläen</strong></p>
Expand All @@ -37,7 +34,7 @@ <h1>@dataset.get("alternateName").get("de").asText()<br/><small>@formatCount(all
@if(entity!=null){<div class="col-md-3">
<figure>
<a href='@routes.HomeController.authority(entity.getId)'><img width="200px" id="index-image" src='https://lobid.org/[email protected]' alt="Darstellung von @entity.preferredName"/></a>
<figcaption><a href='@routes.HomeController.authority(entity.getId)'>@entity.preferredName</a><br/>@if(entity.imageAttribution!=null){<small>(@Html(entity.imageAttribution))</small>}</figcaption>
<figcaption><a href='@routes.HomeController.authority(entity.getId)'>@formatName(entity.preferredName)</a><br/>@if(entity.imageAttribution!=null){<small>(@Html(entity.imageAttribution))</small>}</figcaption>
</figure>
</div>}
</div>
Expand Down
17 changes: 8 additions & 9 deletions app/views/main.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</div>
<div class="page-header">
<img class="media-object nrw-logo pull-right" src="@controllers.routes.Assets.versioned("images/wappen.png")" alt="RPB">
<h1>Die Rheinland-Pfälzische Personendatenbank<br/><small>@formatCount(allHits) Personen aus allen Wissensgebieten</small></h1>
</div>
@if(!title.contains("API") && !title.contains("Reconcile")){
@helper.form(action = controllers.routes.HomeController.search(q), 'id -> "search-form") {
<div class="input-group" id="search-simple">
Expand Down Expand Up @@ -150,18 +154,13 @@
</script>
}
}
<br/>
<div class="alert alert-warning">
Aufgrund einer technischen Störung musste die Rheinland-Pfälzische Personendatenbank (RPPD) in ihrer bisherigen Form abgeschaltet
werden und auf eine neue Oberfläche umziehen. Bitte beachten Sie, dass es sich hierbei um eine Version handelt, in der
noch nicht alle Funktionen umgesetzt sind. Wir sind bestrebt, dies fortlaufend zu verbessern.
</div>
<hr style="border-top: 2px solid #861a22; margin-top:0px;"/>
@content
<div class="panel panel-default nwbib-footer">
<div class="panel-body">
<img class="media-object pull-left nrw-wappen" src="@controllers.routes.Assets.versioned("images/wappen.png")" alt="NRW-Wappen">
<img class="media-object pull-right hbz-logo" src="@controllers.routes.Assets.versioned("images/hbz.png")" alt="hbz-Logo">
Die RPPD enthält aktuell @formatCount(allHits) Personen | Ein Entwicklungsprojekt von <a href="https://lbz.rlp.de/">lbz</a> &amp; <a href="http://www.hbz-nrw.de/">hbz</a>
<a href="https://lbz.rlp.de/"><img class="media-object pull-left nrw-wappen" src="@controllers.routes.Assets.versioned("images/wappen.png")" alt="RLP-Wappen"></a>
<a href="http://www.hbz-nrw.de/"><img class="media-object pull-right hbz-logo" src="@controllers.routes.Assets.versioned("images/hbz.png")" alt="hbz-Logo"></a>
Die RPPD enthält aktuell @formatCount(allHits) Personen
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ play {
data {
entityfacts: "test/data/entityfacts/authorities_entityfacts_test.jsonld"
rdfxml: "test/data/input"
jsonlines: "../rpb/conf/output/bulk/rppd"
jsonlines: "test/data/index" # "../rpb/conf/output/bulk/rppd"
backup: "test/data/backup"
updates.url: "http://gnd-proxy.lobid.org/oai/repository"
updates.rdf: "GND-updates.rdf"
Expand All @@ -32,13 +32,13 @@ entityfacts {

index {
boot: {
hosts: ["weywot3.hbz-nrw.de", "weywot4.hbz-nrw.de", "weywot5.hbz-nrw.de"]
cluster: "weywot"
hosts: ["localhost"] # ["weywot3.hbz-nrw.de", "weywot4.hbz-nrw.de", "weywot5.hbz-nrw.de"]
cluster: "elasticsearch" # "weywot"
name: "gnd-boot" # "gnd"
}
prod: {
hosts: ["weywot3.hbz-nrw.de", "weywot4.hbz-nrw.de", "weywot5.hbz-nrw.de"]
cluster: "weywot"
hosts: ["localhost"] # ["weywot3.hbz-nrw.de", "weywot4.hbz-nrw.de", "weywot5.hbz-nrw.de"]
cluster: "elasticsearch" # cluster: "weywot"
name: "gnd-rppd-test" # e.g. "gnd-rppd-20231103-1000" for new index
}
type: "authority"
Expand Down
2 changes: 1 addition & 1 deletion conf/dataset.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"de":"Die Rheinland-Pfälzische Personendatenbank"
},
"description":{
"de":"<p class='lead'>Die Rheinland-Pfälzische Personendatenbank (RPPD) ist eine regionale Dokumentation zu Personen aus dem Bundesland und seinen historischen Vorläufern. Verzeichnet werden Biogramme von Persönlichkeiten öffentlichen Interesses, ihre Lebensdaten, Berufe und Wirkungsorte.</p><p>Die RPPD dient so als stetig wachsendes biographisches Lexikon bedeutender Menschen aus Rheinland-Pfalz. Quellen sind Bücher, Aufsätze aus Zeitschriften, Jahrbüchern, Tages- und Wochenzeitungen sowie Einzelbeiträge aus Sammelwerken. Die Datenbank ist im Aufbau begriffen. Die RPPD wird von Mitarbeitern der Stadtbibliotheken Mainz und Trier sowie des Landesbibliothekszentrums an den Standorten Speyer und Koblenz gemeinsam erarbeitet. Das Landesbibliothekszentrums betreut mit dem hbz die für die Bereitstellung der Bibliographie erforderliche Datenverarbeitung.</p>"
"de":"<p class='lead'>Die Rheinland-Pfälzische Personendatenbank (RPPD) ist eine regionale Dokumentation zu Personen aus dem Bundesland und seinen historischen Vorläufern. Verzeichnet werden Biogramme von Persönlichkeiten öffentlichen Interesses, ihre Lebensdaten, Berufe und Wirkungsorte.</p>"
},
"keywords":[
"authority data",
Expand Down
2 changes: 1 addition & 1 deletion public/stylesheets/bootstrap.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/stylesheets/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 46.7%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#E9301C",
"@brand-primary": "#861a22",
"@brand-success": "#5cb85c",
"@brand-info": "lighten(@brand-primary, 25%)",
"@brand-warning": "#f0ad4e",
Expand Down
8 changes: 6 additions & 2 deletions public/stylesheets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dd {
}

#search-form {
padding-bottom: 0em;
padding-bottom: 3.5em;
}

input#owner {
Expand Down Expand Up @@ -134,7 +134,7 @@ ul.facet li {
}

#search-results {
padding-top: 2em;
padding-top: 0em;
}

.nwbib-footer {
Expand Down Expand Up @@ -360,3 +360,7 @@ figcaption {
.biogramme {
column-width: 30em;
}

.page-header {
border: none;
}
2 changes: 1 addition & 1 deletion test/apps/ConvertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void testPlaceOfDeathObjects() throws FileNotFoundException {
public void testRemoveNewlinesInLabels() throws FileNotFoundException {
String jsonLd = jsonLdFor("118512676");
JsonNode categories = Json.parse(jsonLd).get("gndSubjectCategory");
assertTrue(categories.toString().contains("Personen zu Literaturgeschichte (Schriftsteller)"));
assertTrue(categories.toString().contains("Literaturgeschichte (Schriftsteller)"));
}

@Test
Expand Down
88 changes: 44 additions & 44 deletions test/controllers/AcceptIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,58 +38,58 @@ public static Collection<Object[]> data() {
// @formatter:off
return Arrays.asList(new Object[][] {
// service meta data: context and dataset description
{ fakeRequest(GET, "/gnd/context.jsonld"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/gnd/dataset.jsonld"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/gnd/dataset"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/gnd/dataset").header("Accept", "text/html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/gnd/dataset").header("Accept", "application/ld+json"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/gnd/dataset").header("Accept", "application/json"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/context.jsonld"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/dataset.jsonld"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/dataset"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/dataset").header("Accept", "text/html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/dataset").header("Accept", "application/ld+json"), /*->*/ "application/ld+json" },
{ fakeRequest(GET, "/dataset").header("Accept", "application/json"), /*->*/ "application/ld+json" },
// search, default format: JSON
{ fakeRequest(GET, "/gnd/search?q=*"), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/search?q=*").header("Accept", "*/*"), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/search?q=*&format="), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/search?q=*&format=json"), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/search?q=*&format=whatever"), /*->*/ "text/html" },
{ fakeRequest(GET, "/gnd/search?q=*").header("Accept", "text/plain"), /*->*/ "text/html" },
{ fakeRequest(GET, "/search?q=*"), /*->*/ "application/json" },
{ fakeRequest(GET, "/search?q=*").header("Accept", "*/*"), /*->*/ "application/json" },
{ fakeRequest(GET, "/search?q=*&format="), /*->*/ "application/json" },
{ fakeRequest(GET, "/search?q=*&format=json"), /*->*/ "application/json" },
{ fakeRequest(GET, "/search?q=*&format=whatever"), /*->*/ "text/html" },
{ fakeRequest(GET, "/search?q=*").header("Accept", "text/plain"), /*->*/ "text/html" },
// search, bulk format: JSON lines
{ fakeRequest(GET, "/gnd/search?q=*").header("Accept", "application/x-jsonlines"), /*->*/ "application/x-jsonlines" },
{ fakeRequest(GET, "/gnd/search?format=jsonl"), /*->*/ "application/x-jsonlines" },
{ fakeRequest(GET, "/gnd/search?q=*&format=jsonl"), /*->*/ "application/x-jsonlines" },
{ fakeRequest(GET, "/gnd/search?q=vwxyz&format=jsonl"), /*->*/ "application/x-jsonlines" },
{ fakeRequest(GET, "/search?q=*").header("Accept", "application/x-jsonlines"), /*->*/ "application/x-jsonlines" },
{ fakeRequest(GET, "/search?format=jsonl"), /*->*/ "application/x-jsonlines" },
{ fakeRequest(GET, "/search?q=*&format=jsonl"), /*->*/ "application/x-jsonlines" },
{ fakeRequest(GET, "/search?q=vwxyz&format=jsonl"), /*->*/ "application/x-jsonlines" },
// search, other formats as query param:
{ fakeRequest(GET, "/gnd/search?q=*&format=html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/search?q=*&format=html"), /*->*/ "text/html" },
// search, other formats via header:
{ fakeRequest(GET, "/gnd/search?q=*").header("Accept", "application/json"), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/search?q=*").header("Accept", "text/html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/search?q=*").header("Accept", "application/json"), /*->*/ "application/json" },
{ fakeRequest(GET, "/search?q=*").header("Accept", "text/html"), /*->*/ "text/html" },
// get, default format: JSON
{ fakeRequest(GET, "/gnd/118820591"), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/118820591?format="), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/118820591?format=json"), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/118820591?format=whatever"), /*->*/ "text/html" },
{ fakeRequest(GET, "/gnd/118820591?format=whatever").header("Accept", "text/html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "text/plain"), /*->*/ "application/n-triples" },
{ fakeRequest(GET, "/118820591"), /*->*/ "application/json" },
{ fakeRequest(GET, "/118820591?format="), /*->*/ "application/json" },
{ fakeRequest(GET, "/118820591?format=json"), /*->*/ "application/json" },
{ fakeRequest(GET, "/118820591?format=whatever"), /*->*/ "text/html" },
{ fakeRequest(GET, "/118820591?format=whatever").header("Accept", "text/html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/118820591").header("Accept", "text/plain"), /*->*/ "application/n-triples" },
// get, other formats as query param:
{ fakeRequest(GET, "/gnd/118820591?format=html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/gnd/118820591?format=rdf"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/gnd/118820591?format=ttl"), /*->*/ "text/turtle" },
{ fakeRequest(GET, "/gnd/118820591?format=nt"), /*->*/ "application/n-triples" },
{ fakeRequest(GET, "/gnd/118820591?format=preview"), /*->*/ "text/html" },
{ fakeRequest(GET, "/118820591?format=html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/118820591?format=rdf"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/118820591?format=ttl"), /*->*/ "text/turtle" },
{ fakeRequest(GET, "/118820591?format=nt"), /*->*/ "application/n-triples" },
{ fakeRequest(GET, "/118820591?format=preview"), /*->*/ "text/html" },
// get, other formats as path elem:
{ fakeRequest(GET, "/gnd/118820591.html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/gnd/118820591.rdf"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/gnd/118820591.ttl"), /*->*/ "text/turtle" },
{ fakeRequest(GET, "/gnd/118820591.nt"), /*->*/ "application/n-triples" },
{ fakeRequest(GET, "/gnd/118820591.preview"), /*->*/ "text/html" },
{ fakeRequest(GET, "/118820591.html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/118820591.rdf"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/118820591.ttl"), /*->*/ "text/turtle" },
{ fakeRequest(GET, "/118820591.nt"), /*->*/ "application/n-triples" },
{ fakeRequest(GET, "/118820591.preview"), /*->*/ "text/html" },
// get, others formats via header:
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "application/json"), /*->*/ "application/json" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "text/html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "text/xml"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "application/xml"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "application/rdf+xml"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "text/turtle"), /*->*/ "text/turtle" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "application/x-turtle"), /*->*/ "text/turtle" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "text/plain"), /*->*/ "application/n-triples" },
{ fakeRequest(GET, "/gnd/118820591").header("Accept", "application/n-triples"), /*->*/ "application/n-triples" }});
{ fakeRequest(GET, "/118820591").header("Accept", "application/json"), /*->*/ "application/json" },
{ fakeRequest(GET, "/118820591").header("Accept", "text/html"), /*->*/ "text/html" },
{ fakeRequest(GET, "/118820591").header("Accept", "text/xml"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/118820591").header("Accept", "application/xml"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/118820591").header("Accept", "application/rdf+xml"), /*->*/ "application/rdf+xml" },
{ fakeRequest(GET, "/118820591").header("Accept", "text/turtle"), /*->*/ "text/turtle" },
{ fakeRequest(GET, "/118820591").header("Accept", "application/x-turtle"), /*->*/ "text/turtle" },
{ fakeRequest(GET, "/118820591").header("Accept", "text/plain"), /*->*/ "application/n-triples" },
{ fakeRequest(GET, "/118820591").header("Accept", "application/n-triples"), /*->*/ "application/n-triples" }});
} // @formatter:on

private RequestBuilder fakeRequest;
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/JsonResponseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class JsonResponseTest extends IndexTest {

@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] { { "/gnd/search?format=json" }, { "/gnd/2136169-1" } });
return Arrays.asList(new Object[][] { { "/search?format=json" }, { "/2136169-1" } });
}

private String path;
Expand Down
Loading

0 comments on commit ed59e71

Please sign in to comment.