Rename routes to follow the same pattern

This commit is contained in:
kolaente 2020-06-17 22:24:37 +02:00
parent fc4b9d439b
commit 82ac226fc1
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
15 changed files with 89 additions and 89 deletions

View file

@ -24,7 +24,7 @@
:style="{ 'opacity': currentList.title === '' ? '0': '1' }"> :style="{ 'opacity': currentList.title === '' ? '0': '1' }">
{{ currentList.title === '' ? 'Loading...': currentList.title}} {{ currentList.title === '' ? 'Loading...': currentList.title}}
</h1> </h1>
<router-link :to="{ name: 'editList', params: { id: currentList.id } }" class="icon"> <router-link :to="{ name: 'list.edit', params: { id: currentList.id } }" class="icon">
<icon icon="cog" size="2x"/> <icon icon="cog" size="2x"/>
</router-link> </router-link>
</div> </div>
@ -47,7 +47,7 @@
<transition name="fade"> <transition name="fade">
<div class="dropdown-menu" v-if="userMenuActive"> <div class="dropdown-menu" v-if="userMenuActive">
<div class="dropdown-content"> <div class="dropdown-content">
<router-link :to="{name: 'userSettings'}" class="dropdown-item"> <router-link :to="{name: 'user.settings'}" class="dropdown-item">
Settings Settings
</router-link> </router-link>
<a @click="logout()" class="dropdown-item"> <a @click="logout()" class="dropdown-item">
@ -84,7 +84,7 @@
</router-link> </router-link>
</li> </li>
<li> <li>
<router-link :to="{ name: 'showTasksInRange', params: {type: 'week'}}"> <router-link :to="{ name: 'tasks.range', params: {type: 'week'}}">
<span class="icon"> <span class="icon">
<icon icon="calendar-week"/> <icon icon="calendar-week"/>
</span> </span>
@ -92,7 +92,7 @@
</router-link> </router-link>
</li> </li>
<li> <li>
<router-link :to="{ name: 'showTasksInRange', params: {type: 'month'}}"> <router-link :to="{ name: 'tasks.range', params: {type: 'month'}}">
<span class="icon"> <span class="icon">
<icon :icon="['far', 'calendar-alt']"/> <icon :icon="['far', 'calendar-alt']"/>
</span> </span>
@ -100,7 +100,7 @@
</router-link> </router-link>
</li> </li>
<li> <li>
<router-link :to="{ name: 'listTeams'}"> <router-link :to="{ name: 'teams.index'}">
<span class="icon"> <span class="icon">
<icon icon="users"/> <icon icon="users"/>
</span> </span>
@ -116,7 +116,7 @@
</router-link> </router-link>
</li> </li>
<li> <li>
<router-link :to="{ name: 'listLabels'}"> <router-link :to="{ name: 'labels.index'}">
<span class="icon"> <span class="icon">
<icon icon="tags"/> <icon icon="tags"/>
</span> </span>
@ -131,7 +131,7 @@
<div :key="n.id"> <div :key="n.id">
<router-link <router-link
v-tooltip.right="'Settings'" v-tooltip.right="'Settings'"
:to="{name: 'editNamespace', params: {id: n.id} }" :to="{name: 'namespace.edit', params: {id: n.id} }"
class="nsettings" class="nsettings"
v-if="n.id > 0"> v-if="n.id > 0">
<span class="icon"> <span class="icon">
@ -140,9 +140,9 @@
</router-link> </router-link>
<router-link <router-link
v-tooltip="'Add a new list in the ' + n.title + ' namespace'" v-tooltip="'Add a new list in the ' + n.title + ' namespace'"
:to="{ name: 'newList', params: { id: n.id} }" :to="{ name: 'list.create', params: { id: n.id} }"
class="nsettings" class="nsettings"
:key="n.id + 'newList'" :key="n.id + 'list.create'"
v-if="n.id > 0"> v-if="n.id > 0">
<span class="icon"> <span class="icon">
<icon icon="plus"/> <icon icon="plus"/>
@ -294,13 +294,13 @@
if (this.$route.query.userPasswordReset !== undefined) { if (this.$route.query.userPasswordReset !== undefined) {
localStorage.removeItem('passwordResetToken') // Delete an eventually preexisting old token localStorage.removeItem('passwordResetToken') // Delete an eventually preexisting old token
localStorage.setItem('passwordResetToken', this.$route.query.userPasswordReset) localStorage.setItem('passwordResetToken', this.$route.query.userPasswordReset)
router.push({name: 'passwordReset'}) router.push({name: 'user.password-reset.reset'})
} }
// Email verification // Email verification
if (this.$route.query.userEmailConfirm !== undefined) { if (this.$route.query.userEmailConfirm !== undefined) {
localStorage.removeItem('emailConfirmToken') // Delete an eventually preexisting old token localStorage.removeItem('emailConfirmToken') // Delete an eventually preexisting old token
localStorage.setItem('emailConfirmToken', this.$route.query.userEmailConfirm) localStorage.setItem('emailConfirmToken', this.$route.query.userEmailConfirm)
router.push({name: 'login'}) router.push({name: 'user.login'})
} }
}, },
beforeCreate() { beforeCreate() {
@ -310,13 +310,13 @@
// Check if the user is already logged in, if so, redirect them to the homepage // Check if the user is already logged in, if so, redirect them to the homepage
if ( if (
!this.userAuthenticated && !this.userAuthenticated &&
this.$route.name !== 'login' && this.$route.name !== 'user.login' &&
this.$route.name !== 'getPasswordReset' && this.$route.name !== 'user.password-reset.request' &&
this.$route.name !== 'passwordReset' && this.$route.name !== 'user.password-reset.reset' &&
this.$route.name !== 'register' && this.$route.name !== 'user.register' &&
this.$route.name !== 'linkShareAuth' this.$route.name !== 'link-share.auth'
) { ) {
router.push({name: 'login'}) router.push({name: 'user.login'})
} }
if (this.userAuthenticated && this.userInfo.type === authTypes.USER && (this.$route.params.name === 'home' || this.namespaces.length === 0)) { if (this.userAuthenticated && this.userInfo.type === authTypes.USER && (this.$route.params.name === 'home' || this.namespaces.length === 0)) {
@ -354,7 +354,7 @@
// the user to the login page // the user to the login page
if (expiresIn < 0) { if (expiresIn < 0) {
this.$store.dispatch('auth/checkAuth') this.$store.dispatch('auth/checkAuth')
router.push({name: 'login'}) router.push({name: 'user.login'})
return return
} }
@ -384,7 +384,7 @@
methods: { methods: {
logout() { logout() {
this.$store.dispatch('auth/logout') this.$store.dispatch('auth/logout')
router.push({name: 'login'}) router.push({name: 'user.login'})
}, },
loadNamespaces() { loadNamespaces() {
this.$store.dispatch('namespaces/loadNamespaces') this.$store.dispatch('namespaces/loadNamespaces')
@ -406,14 +406,14 @@
// Reset the current list highlight in menu if the current list is not list related. // Reset the current list highlight in menu if the current list is not list related.
if ( if (
this.$route.name === 'home' || this.$route.name === 'home' ||
this.$route.name === 'editNamespace' || this.$route.name === 'namespace.edit' ||
this.$route.name === 'listTeams' || this.$route.name === 'teams.index' ||
this.$route.name === 'editTeam' || this.$route.name === 'teams.edit' ||
this.$route.name === 'showTasksInRange' || this.$route.name === 'tasks.range' ||
this.$route.name === 'listLabels' || this.$route.name === 'labels.index' ||
this.$route.name === 'migrateStart' || this.$route.name === 'migrate.start' ||
this.$route.name === 'migrate.wunderlist' || this.$route.name === 'migrate.wunderlist' ||
this.$route.name === 'userSettings' || this.$route.name === 'user.settings' ||
this.$route.name === 'namespaces.index' this.$route.name === 'namespaces.index'
) { ) {
this.$store.commit(CURRENT_LIST, {}) this.$store.commit(CURRENT_LIST, {})

View file

@ -49,7 +49,7 @@
</template> </template>
<template v-if="shareType === 'team'"> <template v-if="shareType === 'team'">
<td> <td>
<router-link :to="{name: 'editTeam', params: {id: s.id}}"> <router-link :to="{name: 'teams.edit', params: {id: s.id}}">
{{s.name}} {{s.name}}
</router-link> </router-link>
</td> </td>

View file

@ -70,27 +70,57 @@ export default new Router({
}, },
{ {
path: '/login', path: '/login',
name: 'login', name: 'user.login',
component: LoginComponent component: LoginComponent
}, },
{ {
path: '/get-password-reset', path: '/get-password-reset',
name: 'getPasswordReset', name: 'user.password-reset.request',
component: GetPasswordResetComponent component: GetPasswordResetComponent
}, },
{ {
path: '/password-reset', path: '/password-reset',
name: 'passwordReset', name: 'user.password-reset.reset',
component: PasswordResetComponent component: PasswordResetComponent
}, },
{ {
path: '/register', path: '/register',
name: 'register', name: 'user.register',
component: RegisterComponent component: RegisterComponent
}, },
{
path: '/user/settings',
name: 'user.settings',
component: UserSettingsComponent,
},
{
path: '/share/:share/auth',
name: 'link-share.auth',
component: LinkShareAuthComponent
},
{
path: '/namespaces',
name: 'namespaces.index',
component: ListNamespaces,
},
{
path: '/namespaces/new',
name: 'namespace.create',
component: NewNamespaceComponent
},
{
path: '/namespaces/:id/edit',
name: 'namespace.edit',
component: EditNamespaceComponent
},
{
path: '/namespaces/:id/list',
name: 'list.create',
component: NewListComponent
},
{ {
path: '/lists/:id/edit', path: '/lists/:id/edit',
name: 'editList', name: 'list.edit',
component: EditListComponent component: EditListComponent
}, },
{ {
@ -98,6 +128,11 @@ export default new Router({
name: 'task.detail', name: 'task.detail',
component: TaskDetailView, component: TaskDetailView,
}, },
{
path: '/tasks/by/:type',
name: 'tasks.range',
component: ShowTasksInRangeComponent,
},
{ {
path: '/lists/:listId', path: '/lists/:listId',
name: 'list.index', name: 'list.index',
@ -146,70 +181,35 @@ export default new Router({
}, },
] ]
}, },
{
path: '/namespaces',
name: 'namespaces.index',
component: ListNamespaces,
},
{
path: '/namespaces/:id/list',
name: 'newList',
component: NewListComponent
},
{
path: '/namespaces/new',
name: 'newNamespace',
component: NewNamespaceComponent
},
{
path: '/namespaces/:id/edit',
name: 'editNamespace',
component: EditNamespaceComponent
},
{ {
path: '/teams', path: '/teams',
name: 'listTeams', name: 'teams.index',
component: ListTeamsComponent component: ListTeamsComponent
}, },
{ {
path: '/teams/new', path: '/teams/new',
name: 'newTeam', name: 'teams.create',
component: NewTeamComponent component: NewTeamComponent
}, },
{ {
path: '/teams/:id/edit', path: '/teams/:id/edit',
name: 'editTeam', name: 'teams.edit',
component: EditTeamComponent component: EditTeamComponent
}, },
{
path: '/tasks/by/:type',
name: 'showTasksInRange',
component: ShowTasksInRangeComponent,
},
{ {
path: '/labels', path: '/labels',
name: 'listLabels', name: 'labels.index',
component: ListLabelsComponent component: ListLabelsComponent
}, },
{
path: '/share/:share/auth',
name: 'linkShareAuth',
component: LinkShareAuthComponent
},
{ {
path: '/migrate', path: '/migrate',
name: 'migrateStart', name: 'migrate.start',
component: MigrationComponent, component: MigrationComponent,
}, },
{ {
path: '/migrate/:service', path: '/migrate/:service',
name: 'migrate', name: 'migrate.service',
component: MigrateServiceComponent, component: MigrateServiceComponent,
}, },
{
path: '/user/settings',
name: 'userSettings',
component: UserSettingsComponent,
},
] ]
}) })

View file

@ -73,7 +73,7 @@ export default {
// Registers a new user and logs them in. // Registers a new user and logs them in.
// Not sure if this is the right place to put the logic in, maybe a seperate js component would be better suited. // Not sure if this is the right place to put the logic in, maybe a seperate js component would be better suited.
register(ctx, credentials) { register(ctx, credentials) {
return HTTP.post('register', { return HTTP.post('user.register', {
username: credentials.username, username: credentials.username,
email: credentials.email, email: credentials.email,
password: credentials.password password: credentials.password

View file

@ -5,7 +5,7 @@
<p>Click on a list or namespace on the left to get started.</p> <p>Click on a list or namespace on the left to get started.</p>
<router-link <router-link
class="button is-primary is-right noshadow is-outlined" class="button is-primary is-right noshadow is-outlined"
:to="{name: 'migrateStart'}" :to="{name: 'migrate.start'}"
v-if="migratorsEnabled" v-if="migratorsEnabled"
> >
Import your data into Vikunja Import your data into Vikunja

View file

@ -3,7 +3,7 @@
<h1>Import your data from other services to Vikunja</h1> <h1>Import your data from other services to Vikunja</h1>
<p>Click on the logo of one of the third-party services below to get started.</p> <p>Click on the logo of one of the third-party services below to get started.</p>
<div class="migration-services-overview"> <div class="migration-services-overview">
<router-link :to="{name: 'migrate', params: {service: m}}" v-for="m in availableMigrators" :key="m"> <router-link :to="{name: 'migrate.service', params: {service: m}}" v-for="m in availableMigrators" :key="m">
<img :src="`/images/migration/${m}.png`" :alt="m"/> <img :src="`/images/migration/${m}.png`" :alt="m"/>
{{ m }} {{ m }}
</router-link> </router-link>
@ -13,7 +13,7 @@
<script> <script>
export default { export default {
name: 'migrate', name: 'migrate.service',
computed: { computed: {
availableMigrators() { availableMigrators() {
return this.$store.state.config.availableMigrators return this.$store.state.config.availableMigrators

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="content namespaces-list"> <div class="content namespaces-list">
<router-link :to="{name: 'newNamespace'}" class="button is-success new-namespace"> <router-link :to="{name: 'namespace.create'}" class="button is-success new-namespace">
<span class="icon is-small"> <span class="icon is-small">
<icon icon="plus"/> <icon icon="plus"/>
</span> </span>

View file

@ -259,7 +259,7 @@
this.teamService.delete(this.team) this.teamService.delete(this.team)
.then(() => { .then(() => {
this.success({message: 'The team was successfully deleted.'}, this) this.success({message: 'The team was successfully deleted.'}, this)
router.push({name: 'listTeams'}) router.push({name: 'teams.index'})
}) })
.catch(e => { .catch(e => {
this.error(e, this) this.error(e, this)

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="content loader-container" v-bind:class="{ 'is-loading': teamService.loading}"> <div class="content loader-container" v-bind:class="{ 'is-loading': teamService.loading}">
<router-link :to="{name:'newTeam'}" class="button is-success button-right" > <router-link :to="{name:'teams.create'}" class="button is-success button-right" >
<span class="icon is-small"> <span class="icon is-small">
<icon icon="plus"/> <icon icon="plus"/>
</span> </span>
@ -9,7 +9,7 @@
<h1>Teams</h1> <h1>Teams</h1>
<ul class="teams box"> <ul class="teams box">
<li v-for="t in teams" :key="t.id"> <li v-for="t in teams" :key="t.id">
<router-link :to="{name: 'editTeam', params: {id: t.id}}"> <router-link :to="{name: 'teams.edit', params: {id: t.id}}">
{{t.name}} {{t.name}}
</router-link> </router-link>
</li> </li>

View file

@ -62,7 +62,7 @@
this.teamService.create(this.team) this.teamService.create(this.team)
.then(response => { .then(response => {
router.push({name: 'editTeam', params: {id: response.id}}) router.push({name: 'teams.edit', params: {id: response.id}})
this.success({message: 'The team was successfully created.'}, this) this.success({message: 'The team was successfully created.'}, this)
}) })
.catch(e => { .catch(e => {

View file

@ -53,11 +53,11 @@
<div class="control is-expanded"> <div class="control is-expanded">
<button type="submit" class="button is-primary" v-bind:class="{ 'is-loading': loading}">Login <button type="submit" class="button is-primary" v-bind:class="{ 'is-loading': loading}">Login
</button> </button>
<router-link :to="{ name: 'register' }" class="button" v-if="registrationEnabled">Register <router-link :to="{ name: 'user.register' }" class="button" v-if="registrationEnabled">Register
</router-link> </router-link>
</div> </div>
<div class="control"> <div class="control">
<router-link :to="{ name: 'getPasswordReset' }" class="reset-password-link">Reset your <router-link :to="{ name: 'user.password-reset.request' }" class="reset-password-link">Reset your
password password
</router-link> </router-link>
</div> </div>

View file

@ -32,7 +32,7 @@
<div class="notification is-success"> <div class="notification is-success">
{{ successMessage }} {{ successMessage }}
</div> </div>
<router-link :to="{ name: 'login' }" class="button is-primary">Login</router-link> <router-link :to="{ name: 'user.login' }" class="button is-primary">Login</router-link>
</div> </div>
</div> </div>
</div> </div>

View file

@ -31,7 +31,7 @@
<div class="field is-grouped"> <div class="field is-grouped">
<div class="control"> <div class="control">
<button type="submit" class="button is-primary" v-bind:class="{ 'is-loading': loading}">Register</button> <button type="submit" class="button is-primary" v-bind:class="{ 'is-loading': loading}">Register</button>
<router-link :to="{ name: 'login' }" class="button">Login</router-link> <router-link :to="{ name: 'user.login' }" class="button">Login</router-link>
</div> </div>
</div> </div>
<div class="notification is-info" v-if="loading"> <div class="notification is-info" v-if="loading">

View file

@ -13,7 +13,7 @@
<div class="field is-grouped"> <div class="field is-grouped">
<div class="control"> <div class="control">
<button type="submit" class="button is-primary" v-bind:class="{ 'is-loading': passwordResetService.loading}">Send me a password reset link</button> <button type="submit" class="button is-primary" v-bind:class="{ 'is-loading': passwordResetService.loading}">Send me a password reset link</button>
<router-link :to="{ name: 'login' }" class="button">Login</router-link> <router-link :to="{ name: 'user.login' }" class="button">Login</router-link>
</div> </div>
</div> </div>
<div class="notification is-danger" v-if="errorMsg"> <div class="notification is-danger" v-if="errorMsg">
@ -24,7 +24,7 @@
<div class="notification is-success"> <div class="notification is-success">
Check your inbox! You should have a mail with instructions on how to reset your password. Check your inbox! You should have a mail with instructions on how to reset your password.
</div> </div>
<router-link :to="{ name: 'login' }" class="button is-primary">Login</router-link> <router-link :to="{ name: 'user.login' }" class="button is-primary">Login</router-link>
</div> </div>
</div> </div>
</div> </div>

View file

@ -180,7 +180,7 @@
<div class="card-content"> <div class="card-content">
<router-link <router-link
class="button is-primary is-right noshadow is-outlined" class="button is-primary is-right noshadow is-outlined"
:to="{name: 'migrateStart'}" :to="{name: 'migrate.start'}"
v-if="migratorsEnabled" v-if="migratorsEnabled"
> >
Import your data into Vikunja Import your data into Vikunja