Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
a4e52769
Commit
a4e52769
authored
Apr 25, 2020
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: copy navigation from locale
parent
89debd57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
4 deletions
+59
-4
admin-navigation.vue
client/components/admin/admin-navigation.vue
+59
-4
No files found.
client/components/admin/admin-navigation.vue
View file @
a4e52769
...
...
@@ -53,7 +53,7 @@
v-row(no-gutters, align='stretch')
v-col(style='flex: 0 0 350px;')
v-card.grey(flat, style='height: 100%; border-radius: 4px 0 0 4px;', :class='$vuetify.theme.dark ? `darken-4-l5` : `lighten-3`')
.teal.
pa-2(style='margin-bottom: 1px; height:
56px;')
.teal.
lighten-1.pa-2.d-flex(style='margin-bottom: 1px; height:
56px;')
v-select(
:disabled='locales.length < 2'
label='Locale'
...
...
@@ -65,9 +65,14 @@
dense
v-model='currentLang'
:items='locales'
item-text='name'
item-text='na
tiveNa
me'
item-value='code'
)
v-tooltip(top)
template(v-slot:activator='{ on }')
v-btn.ml-2(icon, tile, color='white', v-on='on', @click='copyFromLocaleDialogIsShown = true')
v-icon mdi-arrange-send-backward
span
{{
$t
(
'admin:navigation.copyFromLocale'
)
}}
v-list.py-2(dense, nav, dark, class='blue darken-2', style='border-radius: 0;')
v-list-item(v-if='currentTree.length < 1')
v-list-item-avatar(size='24'): v-icon(color='blue lighten-3') mdi-alert
...
...
@@ -226,6 +231,31 @@
v
-
card
-
text
.
grey
--
text
(
v
-
if
=
'currentTree.length > 0'
)
{{
$t
(
'navigation.noSelectionText'
)
}}
v
-
card
-
text
.
grey
--
text
(
v
-
else
)
{{
$t
(
'navigation.noItemsText'
)
}}
v
-
dialog
(
v
-
model
=
'copyFromLocaleDialogIsShown'
,
max
-
width
=
'650'
,
persistent
)
v
-
card
.
dialog
-
header
.
is
-
short
.
is
-
teal
v
-
icon
.
mr
-
3
(
color
=
'white'
)
mdi
-
arrange
-
send
-
backward
span
{{
$t
(
'admin:navigation.copyFromLocale'
)
}}
v
-
card
-
text
.
pt
-
5
.
body
-
2
{{
$t
(
'admin:navigation.copyFromLocaleInfoText'
)
}}
v
-
select
.
mt
-
3
(
:
items
=
'locales'
item
-
text
=
'nativeName'
item
-
value
=
'code'
outlined
prepend
-
icon
=
'mdi-web'
v
-
model
=
'copyFromLocaleCode'
:
label
=
'$t(`admin:navigation.sourceLocale`)'
:
hint
=
'$t(`admin:navigation.sourceLocaleHint`)'
persistent
-
hint
)
v
-
card
-
chin
v
-
spacer
v
-
btn
(
text
,
@
click
=
'copyFromLocaleDialogIsShown = false'
)
{{
$t
(
'common:actions.cancel'
)
}}
v
-
btn
.
px
-
3
(
depressed
,
color
=
'primary'
,
@
click
=
'copyFromLocale'
)
v
-
icon
(
left
)
mdi
-
chevron
-
right
span
{{
$t
(
'common:actions.copy'
)
}}
page
-
selector
(
mode
=
'select'
,
v
-
model
=
'selectPageModal'
,
:
open
-
handler
=
'selectPageHandle'
,
path
=
'home'
,
:
locale
=
'currentLang'
)
<
/template
>
...
...
@@ -251,9 +281,12 @@ export default {
current
:
{
}
,
currentLang
:
siteConfig
.
lang
,
groups
:
[],
copyFromLocaleDialogIsShown
:
false
,
config
:
{
mode
:
'NONE'
}
}
,
allLocales
:
[],
copyFromLocaleCode
:
'en'
}
}
,
computed
:
{
...
...
@@ -266,7 +299,7 @@ export default {
]
}
,
locales
()
{
return
siteLangs
return
_
.
intersectionBy
(
this
.
allLocales
,
_
.
unionBy
(
siteLangs
,
[{
code
:
'en'
}
,
{
code
:
siteConfig
.
lang
}
],
'code'
),
'code'
)
}
,
currentTree
:
{
get
()
{
...
...
@@ -334,6 +367,10 @@ export default {
selectPageHandle
({
path
,
locale
}
)
{
this
.
current
.
target
=
`/${locale
}
/${path
}
`
}
,
copyFromLocale
()
{
this
.
copyFromLocaleDialogIsShown
=
false
this
.
currentTree
=
[...
this
.
currentTree
,
...
_
.
get
(
_
.
find
(
this
.
trees
,
[
'locale'
,
this
.
copyFromLocaleCode
]),
'items'
,
null
)
||
[]]
}
,
async
save
()
{
this
.
$store
.
commit
(
`loadingStart`
,
'admin-navigation-save'
)
try
{
...
...
@@ -430,6 +467,24 @@ export default {
watchLoading
(
isLoading
)
{
this
.
$store
.
commit
(
`loading${isLoading ? 'Start' : 'Stop'
}
`
,
'admin-navigation-groups'
)
}
}
,
allLocales
:
{
query
:
gql
`
{
localization {
locales {
code
name
nativeName
}
}
}
`
,
fetchPolicy
:
'network-only'
,
update
:
(
data
)
=>
data
.
localization
.
locales
,
watchLoading
(
isLoading
)
{
this
.
$store
.
commit
(
`loading${isLoading ? 'Start' : 'Stop'
}
`
,
'admin-navigation-locales'
)
}
}
}
}
...
...
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