Skip to content

Commit

Permalink
output notes on places
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Nov 15, 2022
1 parent 7851ed3 commit a7afb8a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
33 changes: 19 additions & 14 deletions modules/app.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -692,20 +692,25 @@ declare function app:place-details($node as node(), $model as map(*)) as map(*)
let $geonames-id := str:normalize-space(($model?doc//tei:idno[@type='geonames'])[1])
let $gnd := query:get-gnd($model('doc'))
let $gn-doc := er:grabExternalResource('geonames', $geonames-id, '', ())
let $basic-data := app:place-basic-data($node, $model)
return
map {
'gnd' : $gnd,
'names' : $model?doc//tei:placeName[@type],
'backlinks' : core:getOrCreateColl('backlinks', $model('docID'), true()),
'xml-download-url' : replace(controller:create-url-for-doc($model('doc'), $model('lang')), '\.html', '.xml'),
'geonames_alternateNames' :
for $alternateName in $gn-doc//gn:alternateName
group by $name := $alternateName/text()
order by $name
return
($name || ' (' || $alternateName/data(@xml:lang) => string-join(', ') || ')'),
'geonames_parentCountry' : $gn-doc//gn:parentCountry/analyze-string(@rdf:resource, '/(\d+)/')//fn:group/text() ! query:get-geonames-name(.)
}
map:merge((
map {
'gnd' : $gnd,
'names' : $model?doc//tei:placeName[@type],
'backlinks' : core:getOrCreateColl('backlinks', $model('docID'), true()),
'xml-download-url' : replace(controller:create-url-for-doc($model('doc'), $model('lang')), '\.html', '.xml'),
'note' : exists($model?doc/tei:place/tei:note),
'geonames_alternateNames' :
for $alternateName in $gn-doc//gn:alternateName
group by $name := $alternateName/text()
order by $name
return
($name || ' (' || $alternateName/data(@xml:lang) => string-join(', ') || ')'),
'geonames_parentCountry' : $gn-doc//gn:parentCountry/analyze-string(@rdf:resource, '/(\d+)/')//fn:group/text() ! query:get-geonames-name(.)
},
$basic-data
))
};

(:
Expand Down Expand Up @@ -903,7 +908,7 @@ declare
%templates:default("lang", "en")
function app:print-wega-bio($node as node(), $model as map(*), $lang as xs:string) as element(xhtml:div)* {
let $query-result:= app:inject-query($model?doc/*)
let $bio := wega-util:transform($query-result//(tei:note[@type='bioSummary'] | tei:event[tei:head] | tei:note[parent::tei:org]), doc(concat($config:xsl-collection-path, '/persons.xsl')), config:get-xsl-params(()))
let $bio := wega-util:transform($query-result//(tei:note[@type='bioSummary'] | tei:event[tei:head] | tei:note[parent::tei:org] | tei:note[parent::tei:place]), doc(concat($config:xsl-collection-path, '/persons.xsl')), config:get-xsl-params(()))
return
if(some $i in $bio satisfies $i instance of element()) then $bio
else
Expand Down
4 changes: 4 additions & 0 deletions resources/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,10 @@ $('h1').h1FitText();
/* hide tabs with no respective div content */
$('li').has('a.deactivated').hide();

/* only mark the first div and tab "active" on place pages when tei:note and GeoNames are both present */
$('.nav-tabs a.active').first().parent().nextAll().has('a.active').children().removeClass('active')
$('.tab-content div.active').first().nextAll('.active').removeClass('active')

/*
* Initialise easyResponsiveTabs for person.html
*/
Expand Down
23 changes: 19 additions & 4 deletions templates/place.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h3 data-template="lang:translate">imageSource</h3>
</div>
</div>
</div>
<div class="col-md paddingBottomIcon col-sm-6 basicdata" data-template="app:place-basic-data">
<div class="col-md paddingBottomIcon col-sm-6 basicdata">
<h2 data-template="lang:translate">basic_data</h2>
<ol class="media">
<li class="media names" data-template="app-shared:each" data-template-from="names" data-template-to="name">
Expand All @@ -66,7 +66,7 @@ <h2 data-template="lang:translate">basic_data</h2>
</li>
<li class="media geonamesFeatureCode" data-template="app-shared:if-exists" data-template-key="geonamesFeatureCode">
<div class="pull-left">
<i class="fa fa-map-marker"/>
<i class="fa fa-compass"/>
</div>
<div class="media-body" data-template="app-shared:join" data-template-key="geonamesFeatureCode">
Gasthaus, Hotel
Expand Down Expand Up @@ -136,7 +136,14 @@ <h2 data-template="lang:translate">iconography</h2>
<h2 data-template="lang:translate">documents</h2>
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="nav-item gradient-light">
<li class="nav-item gradient-light" data-template="app-shared:if-exists" data-template-key="note">
<!--
need to mark both "wegaText" and "geonames" as 'active'.
IFF both are actually present, some Javascript will keep only the first one
-->
<a class="nav-link active" data-toggle="tab" href="#wegaText">WeGA Text</a>
</li>
<li class="nav-item gradient-light" data-template="app-shared:if-exists" data-template-key="geonames-id">
<a class="nav-link active" data-toggle="tab" href="#geonames">GeoNames</a>
</li>
<li class="nav-item gradient-light">
Expand All @@ -160,7 +167,15 @@ <h2 data-template="lang:translate">documents</h2>
<div class="col-md-9 ">
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active fade in" id="geonames">
<div class="tab-pane active fade in" id="wegaText" data-template="app-shared:if-exists" data-template-key="note">
<!--
need to mark both "wegaText" and "geonames" as 'active'.
IFF both are actually present, some Javascript will keep only the first one
-->
<h2>WeGA Text</h2>
<div data-template="app:print-wega-bio"></div>
</div>
<div class="tab-pane active fade in" id="geonames" data-template="app-shared:if-exists" data-template-key="geonames-id">
<h2>GeoNames</h2>
<dl>
<dt data-template="lang:translate">pnd_otherNames</dt>
Expand Down

0 comments on commit a7afb8a

Please sign in to comment.