Commit 49dff10e authored by dindigala's avatar dindigala
Browse files

refactor: make project header configurable

parent 7cfd7fb9
Pipeline #234352 passed with stages
in 2 minutes and 52 seconds
......@@ -230,7 +230,9 @@ As a rule of thumb, each key with a boolean value (e.g. *true* or *false*) defau
}
},
"breadcrumbNavigation": {
"show": true,
"source": "external",
"search_page": "search.html",
"search_query_param": "searchTerm",
"title_homepage_key": "title_homepage",
"title_viewer_key": "title_viewer",
"website": "https://ahikar.sub.uni-goettingen.de/website/"
......@@ -350,25 +352,41 @@ As a rule of thumb, each key with a boolean value (e.g. *true* or *false*) defau
- **breadcrumbNavigation**
- **show**
**Note**: To display the project header or breadcrumb Navigation in TIDO, we need to pass "source" parameter from Website Search resulted page selected item.
defines if a project header should be shown or not.
- **source**
Defaults to `false`
Defines if a project header should be displayed when we navigated from an external website.
**Note**: This value of source should be same as the one we passed from url parameter of the website.
Defaults to `external`, can be changed to project specific parameter.
- **search_page**
Defines the redirected url to search page when navigating TIDO to a website.
**Note** We do not need to provide this specifically if the redirection to the search page is handle by routes.
- **search_query_param**
Defines query parameter than can be displayed in the search breadcrumb of project header. When clicked on it, we can navigate back to the search page with their results displayed.
Shows a "Search Icon"
- **title_homepage_key**
defines the string shown as first item in the breadcrumb. Shows a "Home Icon"
Defines the string shown as first item in the breadcrumb. Shows a "Home Icon"
Note: To change this title please navigate to "tido/src/i18n/en or tido/src/i18n/de" and find "title_homepage".
**Note**: To change this title please navigate to "tido/src/i18n/en or tido/src/i18n/de" and find "title_homepage".
Has to be set!
- **title_viewer_key**
defines the string shown as last item in the breadcrumb. Shows a "Document Icon"
Defines the string shown as last item in the breadcrumb. Shows a "Document Icon"
Note: To change this title please navigate to "tido/src/i18n/en or tido/src/i18n/de" and find "title_viewer".
**Note**: To change this title please navigate to "tido/src/i18n/en or tido/src/i18n/de" and find "title_viewer".
Has to be set!
......
......@@ -34,7 +34,7 @@
>
<a
:class="$q.dark.isActive ? 'text-dark' : 'text-white'"
:href="`${redirectUrl}search.html?searchTerm=${searchTerm}&page=${page}`"
:href="`${redirectUrl}${searchPageUrl}?${searchQueryParam}=${searchTerm}&page=${page}`"
class="header-links"
>
<q-icon
......@@ -73,9 +73,19 @@ export default {
redirectUrl() {
return this.$route.query.redirectUrl || this.config.breadcrumbNavigation.website;
},
searchPageUrl() {
return this.config.breadcrumbNavigation.search_page || '';
},
searchQueryParam() {
return this.config.breadcrumbNavigation.search_query_param || 'searchTerm';
},
searchTerm() {
return this.$route.query.searchTerm;
},
page() {
return this.$route.query.page || 1;
},
......
<template>
<q-header :class="$q.dark.isActive ? 'bg-dark' : 'bg-secondary text-primary'">
<div
v-if="config.breadcrumbNavigation.show"
v-if="!!$route.query.source && ($route.query.source === config.breadcrumbNavigation.source)"
:class="$q.dark.isActive ? 'bg-white' : 'bg-accent'"
>
<BreadCrumbNavigation
v-if="$route.query.source === 'external'"
:config="config"
/>
</div>
......
......@@ -31,7 +31,7 @@
-->
<script id="tido-config" type="application/json">
{
"entrypoint": "",
"entrypoint": "https://ahikar.sub.uni-goettingen.de/api/textapi/ahikar/syriac/collection.json",
"annotations": {
"show": true,
"types": [
......@@ -62,7 +62,9 @@
}
},
"breadcrumbNavigation": {
"show": true,
"source": "external",
"search_page": "search.html",
"search_query_param": "searchTerm",
"title_homepage_key": "title_homepage",
"title_viewer_key": "title_viewer",
"website": "https://ahikar.sub.uni-goettingen.de/website/"
......
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