Commit 478274e7 authored by Wolfgang's avatar Wolfgang

Fix dts-client demo, show license by default

parent c65c389a
......@@ -20,6 +20,10 @@
display: flex;
justify-content: space-between;
}
pb-paginate {
margin-bottom: 10px;
}
</style>
</custom-style>
</head>
......@@ -28,7 +32,9 @@
<demo-snippet>
<template>
<main>
<dts-client base-uri="http://texts.alpheios.net/api/dts"/>
<dts-client base-uri="https://teipublisher.com/exist/apps/vangogh/api/dts" emit="dts" subscribe="dts">
<pb-paginate slot="pagination" per-page="10" range="5" found-label="Found" subscribe="dts" emit="dts"></pb-paginate>
</dts-client>
</main>
</template>
</demo-snippet>
......
......@@ -73,6 +73,9 @@
<a href="#" on-click="_preview">[[item.title]]</a>
</h4>
<p class="creator">[[_getCreator(item)]]</p>
<template is="dom-if" if="[[_getLicense(item)]]">
<p class="license"><a href="[[_getLicense(item)]]">Licence</a></p>
</template>
</div>
<iron-icon title="Import to local database" icon="icons:file-download" on-click="_download">
</iron-icon>
......@@ -119,7 +122,8 @@
static get properties() {
return {
baseUri: {
type: String
type: String,
observer: '_configureEndpoint'
},
data: {
type: Object
......@@ -141,7 +145,9 @@
connectedCallback() {
super.connectedCallback();
this.subscribeTo('dts-endpoint', this._configureEndpoint.bind(this));
this.subscribeTo('dts-endpoint', (ev) => {
this.baseUri = ev.detail.endpoint;
});
this.subscribeTo('pb-load', (ev) => {
this.page = ev.detail.params.page;
console.log('<dts-client> Loading page %d', this.page);
......@@ -153,12 +159,13 @@
return item['@type'] == 'Collection';
}
_configureEndpoint(ev) {
this.baseUri = ev.detail.endpoint;
console.log('<dts-client> initializing connection to endpoint %s', this.baseUri);
this.emitTo('pb-start-update');
this.$.queryAPI.url = this.baseUri;
this.$.queryAPI.generateRequest();
_configureEndpoint(newBaseUri) {
if (newBaseUri) {
console.log('<dts-client> initializing connection to endpoint %s', newBaseUri);
this.emitTo('pb-start-update');
this.$.queryAPI.url = newBaseUri;
this.$.queryAPI.generateRequest();
}
}
_navigate(ev) {
......@@ -258,6 +265,11 @@
return dc ? dc['dc:creator'] : null;
}
_getLicense(item) {
const dc = item['dts:dublincore'];
return dc ? dc['dc:license'] : null;
}
_encodeParams(params) {
return Object.keys(params).map((key) => {
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key])
......
......@@ -79,6 +79,8 @@ declare function nav:get-metadata($config as map(*), $root as element(), $field
$root/tei:teiHeader/tei:fileDesc/tei:editionStmt/tei:edition/tei:date,
$root/tei:teiHeader/tei:publicationStmt/tei:date
)[1]
case "license" return
$root/tei:teiHeader/tei:fileDesc/tei:publicationStmt//tei:licence/@target/string()
default return
()
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment