Skip to content
Snippets Groups Projects
Commit d09ad535 authored by Manikanth Dindigala's avatar Manikanth Dindigala
Browse files

feat: returning from tido to the respective search hit list page

parent b6f61b01
No related branches found
No related tags found
1 merge request!98feat/#124: returning from tido to the respective search hit list page
Pipeline #226520 passed
......@@ -42,6 +42,7 @@
:items="items"
:message="message"
:query="query"
:page="page"
/>
<div
......@@ -82,19 +83,25 @@ export default {
total: 0,
showPlaceholder: false,
showNoResult: false,
page: 1,
};
},
watch:{
page: function() {
page: function(page) {
this.loading = true;
const from = this.size * (this.page - 1);
const from = this.size * (page - 1);
this.$router.push({ query: { ...this.$route.query, searchTerm:this.query.trim(),page } });
this.search(this.query.trim(), from, this.size);
},
},
mounted(){
const page = this.$route.query?.page;
if(page){
this.page = parseInt(page);
}
if(this.$route.query?.searchTerm) {
this.onSearchInput(this.$route.query.searchTerm);
this.onSearchInput(this.$route.query.searchTerm,this.page);
} else {
this.showPlaceholder = true;
}
......@@ -117,9 +124,8 @@ export default {
},
},
methods: {
onSearchInput(query) {
onSearchInput(query,page) {
this.query = query;
this.page = 1;
this.resetList();
this.showPlaceholder = false;
......@@ -128,7 +134,7 @@ export default {
this.search(this.query.trim(), 0, this.size);
if (this.$route.query.searchTerm !== query) {
this.$router.push({ query: { ...this.$route.query, searchTerm:query } });
this.$router.push({ query: { ...this.$route.query, searchTerm:query,page:page || this.page } });
}
},
async search(value, from, size) {
......@@ -162,13 +168,6 @@ export default {
this.loading = false;
}
},
scrollUp() {
window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth',
});
},
resetList() {
this.items = [];
this.distinctSheets = 0;
......
......@@ -54,6 +54,10 @@ export default {
type: Array,
default: () => [],
},
page: {
type: Number,
default: () => 1,
},
},
computed: {
viewerBaseUrl() {
......@@ -72,7 +76,7 @@ export default {
} else if (item.lang === 'syc') {
language = 'syriac';
}
return `${this.viewerBaseUrl}/${language}/#/?itemurl=${item.item}&source=external&searchTerm=${item.searchTerm}&redirectUrl=${this.getPath}`;
return `${this.viewerBaseUrl}/${language}/#/?itemurl=${item.item}&source=external&searchTerm=${item.searchTerm}&redirectUrl=${this.getPath}&page=${this.page}`;
},
},
watch: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment