fix: dropdown routes
This commit is contained in:
parent
7bb1b1b769
commit
0cbffad49d
1 changed files with 15 additions and 11 deletions
|
@ -2,13 +2,13 @@
|
||||||
<dropdown>
|
<dropdown>
|
||||||
<template v-if="isSavedFilter">
|
<template v-if="isSavedFilter">
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.edit`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.edit`, params: { listId: list.id } }"
|
||||||
icon="pen"
|
icon="pen"
|
||||||
>
|
>
|
||||||
{{ $t('menu.edit') }}
|
{{ $t('menu.edit') }}
|
||||||
</dropdown-item>
|
</dropdown-item>
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.delete`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.delete`, params: { listId: list.id } }"
|
||||||
icon="trash-alt"
|
icon="trash-alt"
|
||||||
>
|
>
|
||||||
{{ $t('misc.delete') }}
|
{{ $t('misc.delete') }}
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="list.isArchived">
|
<template v-else-if="list.isArchived">
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.archive`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.archive`, params: { listId: list.id } }"
|
||||||
icon="archive"
|
icon="archive"
|
||||||
>
|
>
|
||||||
{{ $t('menu.unarchive') }}
|
{{ $t('menu.unarchive') }}
|
||||||
|
@ -24,32 +24,32 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.edit`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.edit`, params: { listId: list.id } }"
|
||||||
icon="pen"
|
icon="pen"
|
||||||
>
|
>
|
||||||
{{ $t('menu.edit') }}
|
{{ $t('menu.edit') }}
|
||||||
</dropdown-item>
|
</dropdown-item>
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.background`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.background`, params: { listId: list.id } }"
|
||||||
v-if="backgroundsEnabled"
|
v-if="backgroundsEnabled"
|
||||||
icon="image"
|
icon="image"
|
||||||
>
|
>
|
||||||
{{ $t('menu.setBackground') }}
|
{{ $t('menu.setBackground') }}
|
||||||
</dropdown-item>
|
</dropdown-item>
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.share`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.share`, params: { listId: list.id } }"
|
||||||
icon="share-alt"
|
icon="share-alt"
|
||||||
>
|
>
|
||||||
{{ $t('menu.share') }}
|
{{ $t('menu.share') }}
|
||||||
</dropdown-item>
|
</dropdown-item>
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.duplicate`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.duplicate`, params: { listId: list.id } }"
|
||||||
icon="paste"
|
icon="paste"
|
||||||
>
|
>
|
||||||
{{ $t('menu.duplicate') }}
|
{{ $t('menu.duplicate') }}
|
||||||
</dropdown-item>
|
</dropdown-item>
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.archive`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.archive`, params: { listId: list.id } }"
|
||||||
icon="archive"
|
icon="archive"
|
||||||
>
|
>
|
||||||
{{ $t('menu.archive') }}
|
{{ $t('menu.archive') }}
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
@change="sub => subscription = sub"
|
@change="sub => subscription = sub"
|
||||||
/>
|
/>
|
||||||
<dropdown-item
|
<dropdown-item
|
||||||
:to="{ name: `${listRoutePrefix}.settings.delete`, params: { listId: list.id } }"
|
:to="{ name: `${listRoutePrefix}.delete`, params: { listId: list.id } }"
|
||||||
icon="trash-alt"
|
icon="trash-alt"
|
||||||
class="has-text-danger"
|
class="has-text-danger"
|
||||||
>
|
>
|
||||||
|
@ -106,15 +106,19 @@ export default {
|
||||||
listRoutePrefix() {
|
listRoutePrefix() {
|
||||||
let name = 'list'
|
let name = 'list'
|
||||||
|
|
||||||
|
|
||||||
if (this.$route.name !== null && this.$route.name.startsWith('list.')) {
|
if (this.$route.name !== null && this.$route.name.startsWith('list.')) {
|
||||||
name = this.$route.name
|
// HACK: we should implement a better routing for the modals
|
||||||
|
const settingsRoutes = ['edit', 'delete', 'archive', 'background', 'share', 'duplicate']
|
||||||
|
const suffix = settingsRoutes.find((route) => this.$route.name.endsWith(`.settings.${route}`))
|
||||||
|
name = this.$route.name.replace(`.settings.${suffix}`,'')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isSavedFilter) {
|
if (this.isSavedFilter) {
|
||||||
name = name.replace('list.', 'filter.')
|
name = name.replace('list.', 'filter.')
|
||||||
}
|
}
|
||||||
|
|
||||||
return name
|
return `${name}.settings`
|
||||||
},
|
},
|
||||||
isSavedFilter() {
|
isSavedFilter() {
|
||||||
return getSavedFilterIdFromListId(this.list.id) > 0
|
return getSavedFilterIdFromListId(this.list.id) > 0
|
||||||
|
|
Loading…
Reference in a new issue