Rename routes to follow the same pattern
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-06-17 22:24:37 +02:00
parent fc4b9d439b
commit 82ac226fc1
Signed by: konrad
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' }">
{{ currentList.title === '' ? 'Loading...': currentList.title}}
</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"/>
</router-link>
</div>
@ -47,7 +47,7 @@
<transition name="fade">
<div class="dropdown-menu" v-if="userMenuActive">
<div class="dropdown-content">
<router-link :to="{name: 'userSettings'}" class="dropdown-item">
<router-link :to="{name: 'user.settings'}" class="dropdown-item">
Settings
</router-link>
<a @click="logout()" class="dropdown-item">
@ -84,7 +84,7 @@
</router-link>
</li>
<li>
<router-link :to="{ name: 'showTasksInRange', params: {type: 'week'}}">
<router-link :to="{ name: 'tasks.range', params: {type: 'week'}}">
<span class="icon">
<icon icon="calendar-week"/>
</span>
@ -92,7 +92,7 @@
</router-link>
</li>
<li>
<router-link :to="{ name: 'showTasksInRange', params: {type: 'month'}}">
<router-link :to="{ name: 'tasks.range', params: {type: 'month'}}">
<span class="icon">
<icon :icon="['far', 'calendar-alt']"/>
</span>
@ -100,7 +100,7 @@
</router-link>
</li>
<li>
<router-link :to="{ name: 'listTeams'}">
<router-link :to="{ name: 'teams.index'}">
<span class="icon">
<icon icon="users"/>
</span>
@ -116,7 +116,7 @@
</router-link>
</li>
<li>
<router-link :to="{ name: 'listLabels'}">
<router-link :to="{ name: 'labels.index'}">
<span class="icon">
<icon icon="tags"/>
</span>
@ -131,7 +131,7 @@
<div :key="n.id">
<router-link
v-tooltip.right="'Settings'"
:to="{name: 'editNamespace', params: {id: n.id} }"
:to="{name: 'namespace.edit', params: {id: n.id} }"
class="nsettings"
v-if="n.id > 0">
<span class="icon">
@ -140,9 +140,9 @@
</router-link>
<router-link
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"
:key="n.id + 'newList'"
:key="n.id + 'list.create'"
v-if="n.id > 0">
<span class="icon">
<icon icon="plus"/>
@ -294,13 +294,13 @@
if (this.$route.query.userPasswordReset !== undefined) {
localStorage.removeItem('passwordResetToken') // Delete an eventually preexisting old token
localStorage.setItem('passwordResetToken', this.$route.query.userPasswordReset)
router.push({name: 'passwordReset'})
router.push({name: 'user.password-reset.reset'})
}
// Email verification
if (this.$route.query.userEmailConfirm !== undefined) {
localStorage.removeItem('emailConfirmToken') // Delete an eventually preexisting old token
localStorage.setItem('emailConfirmToken', this.$route.query.userEmailConfirm)
router.push({name: 'login'})
router.push({name: 'user.login'})
}
},
beforeCreate() {
@ -310,13 +310,13 @@
// Check if the user is already logged in, if so, redirect them to the homepage
if (
!this.userAuthenticated &&
this.$route.name !== 'login' &&
this.$route.name !== 'getPasswordReset' &&
this.$route.name !== 'passwordReset' &&
this.$route.name !== 'register' &&
this.$route.name !== 'linkShareAuth'
this.$route.name !== 'user.login' &&
this.$route.name !== 'user.password-reset.request' &&
this.$route.name !== 'user.password-reset.reset' &&
this.$route.name !== 'user.register' &&
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)) {
@ -354,7 +354,7 @@
// the user to the login page
if (expiresIn < 0) {
this.$store.dispatch('auth/checkAuth')
router.push({name: 'login'})
router.push({name: 'user.login'})
return
}
@ -384,7 +384,7 @@
methods: {
logout() {
this.$store.dispatch('auth/logout')
router.push({name: 'login'})
router.push({name: 'user.login'})
},
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.
if (
this.$route.name === 'home' ||
this.$route.name === 'editNamespace' ||
this.$route.name === 'listTeams' ||
this.$route.name === 'editTeam' ||
this.$route.name === 'showTasksInRange' ||
this.$route.name === 'listLabels' ||
this.$route.name === 'migrateStart' ||
this.$route.name === 'namespace.edit' ||
this.$route.name === 'teams.index' ||
this.$route.name === 'teams.edit' ||
this.$route.name === 'tasks.range' ||
this.$route.name === 'labels.index' ||
this.$route.name === 'migrate.start' ||
this.$route.name === 'migrate.wunderlist' ||
this.$route.name === 'userSettings' ||
this.$route.name === 'user.settings' ||
this.$route.name === 'namespaces.index'
) {
this.$store.commit(CURRENT_LIST, {})

View File

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

View File

@ -70,27 +70,57 @@ export default new Router({
},
{
path: '/login',
name: 'login',
name: 'user.login',
component: LoginComponent
},
{
path: '/get-password-reset',
name: 'getPasswordReset',
name: 'user.password-reset.request',
component: GetPasswordResetComponent
},
{
path: '/password-reset',
name: 'passwordReset',
name: 'user.password-reset.reset',
component: PasswordResetComponent
},
{
path: '/register',
name: 'register',
name: 'user.register',
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',
name: 'editList',
name: 'list.edit',
component: EditListComponent
},
{
@ -98,6 +128,11 @@ export default new Router({
name: 'task.detail',
component: TaskDetailView,
},
{
path: '/tasks/by/:type',
name: 'tasks.range',
component: ShowTasksInRangeComponent,
},
{
path: '/lists/:listId',
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',
name: 'listTeams',
name: 'teams.index',
component: ListTeamsComponent
},
{
path: '/teams/new',
name: 'newTeam',
name: 'teams.create',
component: NewTeamComponent
},
{
path: '/teams/:id/edit',
name: 'editTeam',
name: 'teams.edit',
component: EditTeamComponent
},
{
path: '/tasks/by/:type',
name: 'showTasksInRange',
component: ShowTasksInRangeComponent,
},
{
path: '/labels',
name: 'listLabels',
name: 'labels.index',
component: ListLabelsComponent
},
{
path: '/share/:share/auth',
name: 'linkShareAuth',
component: LinkShareAuthComponent
},
{
path: '/migrate',
name: 'migrateStart',
name: 'migrate.start',
component: MigrationComponent,
},
{
path: '/migrate/:service',
name: 'migrate',
name: 'migrate.service',
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.
// 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) {
return HTTP.post('register', {
return HTTP.post('user.register', {
username: credentials.username,
email: credentials.email,
password: credentials.password

View File

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

View File

@ -3,7 +3,7 @@
<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>
<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"/>
{{ m }}
</router-link>
@ -13,7 +13,7 @@
<script>
export default {
name: 'migrate',
name: 'migrate.service',
computed: {
availableMigrators() {
return this.$store.state.config.availableMigrators

View File

@ -1,6 +1,6 @@
<template>
<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">
<icon icon="plus"/>
</span>

View File

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

View File

@ -1,6 +1,6 @@
<template>
<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">
<icon icon="plus"/>
</span>
@ -9,7 +9,7 @@
<h1>Teams</h1>
<ul class="teams box">
<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}}
</router-link>
</li>

View File

@ -62,7 +62,7 @@
this.teamService.create(this.team)
.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)
})
.catch(e => {

View File

@ -53,11 +53,11 @@
<div class="control is-expanded">
<button type="submit" class="button is-primary" v-bind:class="{ 'is-loading': loading}">Login
</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>
</div>
<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
</router-link>
</div>

View File

@ -32,7 +32,7 @@
<div class="notification is-success">
{{ successMessage }}
</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>

View File

@ -31,7 +31,7 @@
<div class="field is-grouped">
<div class="control">
<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 class="notification is-info" v-if="loading">

View File

@ -13,7 +13,7 @@
<div class="field is-grouped">
<div class="control">
<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 class="notification is-danger" v-if="errorMsg">
@ -24,7 +24,7 @@
<div class="notification is-success">
Check your inbox! You should have a mail with instructions on how to reset your password.
</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>

View File

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