Skip to content

Commit

Permalink
fix(pb-browse-docs): if URL is not set, guess it for given publisher …
Browse files Browse the repository at this point in the history
…version
  • Loading branch information
wolfgangmm committed Oct 22, 2020
1 parent df6ea5e commit 32df62a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo/pb-browse-docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<pb-upload id="upload" emit="docs" subscribe="docs" accept=".xml, .tei, .odd, .docx"></pb-upload>
</pb-restricted>
<!-- use just `collection/` for new API @url-->
<pb-browse-docs id="document-list" url="api/collection" fix-links
<pb-browse-docs id="document-list" fix-links
sort-options='[{"label": "browse.title", "value": "title"},{"label": "browse.author", "value": "author"},{"label": "browse.modificationDate", "value": "default"}]'
sort-by="title"
filter-options='[{"label": "browse.title", "value": "title"},{"label": "browse.author", "value": "author"},{"label": "browse.file", "value": "file"}]'
Expand Down
6 changes: 6 additions & 0 deletions src/pb-browse-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,14 @@ export class PbBrowseDocs extends PbLoad {
const loader = this.shadowRoot.getElementById('autocompleteLoader');
if (cmpVersion(options.apiVersion, '1.0.0') >= 0) {
loader.url = `${options.endpoint}/api/search/autocomplete`;
if (!this.url) {
this.url = 'api/collection';
}
} else {
loader.url = `${options.endpoint}/modules/autocomplete.xql`;
if (!this.url) {
this.url = 'collection/';
}
}
});
this.shadowRoot.getElementById('autocomplete').addEventListener('autocomplete-change', this._autocomplete.bind(this));
Expand Down

0 comments on commit 32df62a

Please sign in to comment.