Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
community
pount
pount-front
Commits
9d669097
Commit
9d669097
authored
Sep 17, 2021
by
Yoran Hillion
Browse files
feat: The search box in the header does a public search
parent
2fac75a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/layouts/Default/DefaultAppBar.vue
View file @
9d669097
...
...
@@ -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"
...
...
src/views/Search.vue
View file @
9d669097
...
...
@@ -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
.
s
etsCount
)}
`
,
`
${
that
.
$tc
(
'
item.count
'
,
result
.
i
temsCount
)}
`
,
`
${
that
.
$tc
(
'
set.count
'
,
result
.
publicS
etsCount
)}
`
,
`
${
that
.
$tc
(
'
item.count
'
,
result
.
publicI
temsCount
)}
`
,
];
}
else
if
(
mode
===
'
set
'
)
{
subtitles
=
[
`
${
that
.
$t
(
'
item.fields.creator.label
'
)}
:
${
result
.
creator
.
name
}
`
,
`
${
that
.
$tc
(
'
item.count
'
,
result
.
i
temsCount
)}
`
,
`
${
that
.
$tc
(
'
item.count
'
,
result
.
publicI
temsCount
)}
`
,
];
}
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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment