Commit 9d669097 authored by Yoran Hillion's avatar Yoran Hillion
Browse files

feat: The search box in the header does a public search

parent 2fac75a9
......@@ -89,6 +89,7 @@
v-if="$route.name !== 'search'"
class="mr-2"
:label="$t('search.label')"
placeholder="Rechercher dans les données publiques"
prepend-inner-icon="mdi-magnify"
hide-details
@change="onSearch"
......@@ -173,6 +174,7 @@
<v-text-field
class="mr-2"
:label="$t('search.label')"
placeholder="Rechercher dans les données publiques"
prepend-inner-icon="mdi-magnify"
hide-details
@change="onSearch"
......
......@@ -91,7 +91,6 @@
<script>
import { mapState } from 'vuex';
import authority from '@/assets/authAxios';
import publicAxios from '@/assets/publicAxios';
import TextHelpersMixin from '@/mixins/TextHelpersMixin';
import Avatar from '@/components/common/Avatar';
......@@ -139,7 +138,7 @@ export default {
computed: {
...mapState('contrib', ['isLogged']),
axios() {
return this.isLogged ? authority : publicAxios;
return publicAxios;
},
projectOptions() {
return this.tabs.project.options;
......@@ -186,13 +185,13 @@ export default {
const managers = result.managers.map(m => m.name).join(', ');
subtitles = [
`${that.$t('project.subtitles.managers', { managers, label: that.$tc('project.managers', result.managers.length) })}`,
`${that.$tc('set.count', result.setsCount)}`,
`${that.$tc('item.count', result.itemsCount)}`,
`${that.$tc('set.count', result.publicSetsCount)}`,
`${that.$tc('item.count', result.publicItemsCount)}`,
];
} else if (mode === 'set') {
subtitles = [
`${that.$t('item.fields.creator.label')} : ${result.creator.name}`,
`${that.$tc('item.count', result.itemsCount)}`,
`${that.$tc('item.count', result.publicItemsCount)}`,
];
}
return subtitles;
......@@ -208,11 +207,11 @@ export default {
const pageSize = this.tabs[`${mode}`].options.itemsPerPage;
const page = this.tabs[`${mode}`].options.page;
const ordering = `${this.tabs[`${mode}`].isDescending ? '-' : ''}${this.tabs[`${mode}`].sort}`;
return this.axios.get(`${mode}_search/?query=${query}&page_size=${pageSize}&page=${page}&ordering=${ordering}`)
return this.axios.get(`${mode}s/search/?query=${query}&page_size=${pageSize}&page=${page}&ordering=${ordering}`)
.then((response) => {
this.tabs[`${mode}`].results = this.formatResults(response.data.results, mode);
this.tabs[`${mode}`].serverItemsLength = response.data.count;
})
});
},
onSearch() {
this.tabsRoot.forEach((tab) => this.search(tab));
......
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