Skip to content
Snippets Groups Projects
Commit d7ba1dc0 authored by Camille Blanchon's avatar Camille Blanchon
Browse files

Merge branch 'redmine-issues/21098' into 'develop'

REDMINE_ISSUE-21098 | La recherche textuelle n'est pas conservé au changement de page

See merge request geocontrib/geocontrib-frontend!788
parents fc869eb7 55be27cb
No related branches found
No related tags found
No related merge requests found
...@@ -107,8 +107,7 @@ ...@@ -107,8 +107,7 @@
<Pagination <Pagination
v-if="count" v-if="count"
:nb-pages="Math.ceil(count/10)" :nb-pages="Math.ceil(count/10)"
:on-page-change="SET_CURRENT_PAGE" @page-update="changePage"
@change-page="changePage"
/> />
</div> </div>
</div> </div>
......
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
:class="{ disabled: currentPage === 1 }" :class="{ disabled: currentPage === 1 }"
> >
<a <a
class="page-link" class="page-link pointer"
:href="currentLocation" @click="changePage(currentPage - 1)"
@click="currentPage -= 1"
> >
<i <i
class="ui icon big angle left" class="ui icon big angle left"
...@@ -28,8 +27,7 @@ ...@@ -28,8 +27,7 @@
:class="{ active: currentPage === index }" :class="{ active: currentPage === index }"
> >
<a <a
class="page-link" class="page-link pointer"
:href="currentLocation"
@click="changePage(index)" @click="changePage(index)"
> >
{{ index }} {{ index }}
...@@ -47,8 +45,7 @@ ...@@ -47,8 +45,7 @@
:class="{ active: currentPage === index }" :class="{ active: currentPage === index }"
> >
<a <a
class="page-link" class="page-link pointer"
:href="currentLocation"
@click="changePage(index)" @click="changePage(index)"
> >
{{ index }} {{ index }}
...@@ -60,9 +57,8 @@ ...@@ -60,9 +57,8 @@
:class="{ disabled: currentPage === nbPages }" :class="{ disabled: currentPage === nbPages }"
> >
<a <a
class="page-link" class="page-link pointer"
:href="currentLocation" @click="changePage(currentPage + 1)"
@click="currentPage += 1"
> >
<i <i
class="ui icon big angle right" class="ui icon big angle right"
...@@ -86,35 +82,12 @@ export default { ...@@ -86,35 +82,12 @@ export default {
type: Number, type: Number,
default: 1 default: 1
}, },
onPageChange: {
type: Function,
default: () => {
return () => 1;
}
}
},
data() {
return {
// TODO: Refactor by using native scroll to top instead of this
currentLocation: `${window.location.origin}${window.location.pathname}#`,
};
}, },
computed: { computed: {
...mapState('projects', ['currentPage']), ...mapState('projects', ['currentPage']),
}, },
watch: {
currentPage: function(newValue, oldValue) {
if (newValue !== oldValue) {
this.onPageChange(newValue);
this.$emit('change-page', newValue);
}
}
},
methods: { methods: {
...mapMutations('projects', [ ...mapMutations('projects', [
'SET_CURRENT_PAGE', 'SET_CURRENT_PAGE',
...@@ -154,6 +127,10 @@ export default { ...@@ -154,6 +127,10 @@ export default {
changePage(pageNumber) { changePage(pageNumber) {
if (typeof pageNumber === 'number') { if (typeof pageNumber === 'number') {
this.SET_CURRENT_PAGE(pageNumber); this.SET_CURRENT_PAGE(pageNumber);
// Scroll back to the first results on top of page
window.scrollTo({ top: 0, behavior: 'smooth' });
// emit event for parent component to fetch new page data
this.$emit('page-update', pageNumber);
} }
} }
} }
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
:clear-on-select="false" :clear-on-select="false"
:preserve-search="true" :preserve-search="true"
:multiple="multiple" :multiple="multiple"
:loading="loading"
:disabled="loading" :disabled="loading"
@select="select" @select="select"
@remove="remove" @remove="remove"
...@@ -177,4 +176,7 @@ export default { ...@@ -177,4 +176,7 @@ export default {
#filters-container .multiple .multiselect__option--selected:not(:hover) { #filters-container .multiple .multiselect__option--selected:not(:hover) {
background-color: #e8e8e8 !important; background-color: #e8e8e8 !important;
} }
#filters-container .multiselect--disabled .multiselect__select {
background: 0, 0 !important;
}
</style> </style>
\ No newline at end of file
...@@ -82,8 +82,7 @@ ...@@ -82,8 +82,7 @@
<Pagination <Pagination
v-if="count" v-if="count"
:nb-pages="nbPages" :nb-pages="nbPages"
:on-page-change="SET_CURRENT_PAGE" @page-update="changePage"
@change-page="changePage"
/> />
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment