Rename users path and fix bug scroll event
This commit is contained in:
parent
8ce3a7d0f9
commit
c8231d01ab
@ -82,7 +82,7 @@ const router = new Router({
|
|||||||
component: error500
|
component: error500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/settings/users',
|
path: '/users',
|
||||||
name: 'Users',
|
name: 'Users',
|
||||||
component: Users,
|
component: Users,
|
||||||
meta: {
|
meta: {
|
||||||
@ -90,7 +90,7 @@ const router = new Router({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/settings/users/*',
|
path: '/users/*',
|
||||||
name: 'User',
|
name: 'User',
|
||||||
component: User,
|
component: User,
|
||||||
meta: {
|
meta: {
|
||||||
|
|||||||
@ -116,20 +116,11 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
window.addEventListener('keydown', this.keyEvent)
|
window.addEventListener('keydown', this.keyEvent)
|
||||||
window.addEventListener('scroll', event => {
|
window.addEventListener('scroll', this.scroll)
|
||||||
if (this.req.kind !== 'listing' || this.$store.state.req.display === 'mosaic') return
|
|
||||||
|
|
||||||
let top = 112 - window.scrollY
|
|
||||||
|
|
||||||
if (top < 64) {
|
|
||||||
top = 64
|
|
||||||
}
|
|
||||||
|
|
||||||
document.querySelector('#listing.list .item.header').style.top = top + 'px'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
window.removeEventListener('keydown', this.keyEvent)
|
window.removeEventListener('keydown', this.keyEvent)
|
||||||
|
window.removeEventListener('scroll', this.scroll)
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
this.$store.commit('updateRequest', {})
|
this.$store.commit('updateRequest', {})
|
||||||
@ -218,6 +209,17 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
scroll (event) {
|
||||||
|
if (this.req.kind !== 'listing' || this.$store.state.req.display === 'mosaic') return
|
||||||
|
|
||||||
|
let top = 112 - window.scrollY
|
||||||
|
|
||||||
|
if (top < 64) {
|
||||||
|
top = 64
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector('#listing.list .item.header').style.top = top + 'px'
|
||||||
|
},
|
||||||
openSidebar () {
|
openSidebar () {
|
||||||
this.$store.commit('showHover', 'sidebar')
|
this.$store.commit('showHover', 'sidebar')
|
||||||
},
|
},
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><router-link to="/settings/profile">{{ $t('settings.goTo') }} {{ $t('settings.profileSettings') }}</router-link></li>
|
<li><router-link to="/settings/profile">{{ $t('settings.goTo') }} {{ $t('settings.profileSettings') }}</router-link></li>
|
||||||
<li><router-link to="/settings/users">{{ $t('settings.goTo') }} {{ $t('settings.userManagement') }}</router-link></li>
|
<li><router-link to="/users">{{ $t('settings.goTo') }} {{ $t('settings.userManagement') }}</router-link></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<form @submit="savePlugin" v-if="plugins.length > 0">
|
<form @submit="savePlugin" v-if="plugins.length > 0">
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
passwordPlaceholder () {
|
passwordPlaceholder () {
|
||||||
if (this.$route.path === '/settings/users/new') return ''
|
if (this.$route.path === '/users/new') return ''
|
||||||
return this.$t('settings.avoidChanges')
|
return this.$t('settings.avoidChanges')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -114,7 +114,7 @@ export default {
|
|||||||
fetchData () {
|
fetchData () {
|
||||||
let user = this.$route.params[0]
|
let user = this.$route.params[0]
|
||||||
|
|
||||||
if (this.$route.path === '/settings/users/new') {
|
if (this.$route.path === '/users/new') {
|
||||||
user = 'base'
|
user = 'base'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ export default {
|
|||||||
|
|
||||||
this.rules = this.rules.trim()
|
this.rules = this.rules.trim()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$router.push({ path: '/settings/users/new' })
|
this.$router.push({ path: '/users/new' })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
capitalize (name) {
|
capitalize (name) {
|
||||||
@ -192,7 +192,7 @@ export default {
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
let user = this.parseForm()
|
let user = this.parseForm()
|
||||||
|
|
||||||
if (this.$route.path === '/settings/users/new') {
|
if (this.$route.path === '/users/new') {
|
||||||
newUser(user).then(location => {
|
newUser(user).then(location => {
|
||||||
this.$router.push({ path: location })
|
this.$router.push({ path: location })
|
||||||
this.$store.commit('showSuccess', this.$t('settings.userCreated'))
|
this.$store.commit('showSuccess', this.$t('settings.userCreated'))
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dashboard">
|
<div class="dashboard">
|
||||||
<h1>{{ $t('settings.users') }} <router-link to="/settings/users/new"><button>{{ $t('buttons.new') }}</button></router-link></h1>
|
<h1>{{ $t('settings.users') }} <router-link to="/users/new"><button>{{ $t('buttons.new') }}</button></router-link></h1>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<td>{{ user.username }}</td>
|
<td>{{ user.username }}</td>
|
||||||
<td><i v-if="user.admin" class="material-icons">done</i><i v-else class="material-icons">close</i></td>
|
<td><i v-if="user.admin" class="material-icons">done</i><i v-else class="material-icons">close</i></td>
|
||||||
<td>{{ user.filesystem }}</td>
|
<td>{{ user.filesystem }}</td>
|
||||||
<td><router-link :to="'/settings/users/' + user.ID"><i class="material-icons">mode_edit</i></router-link></td>
|
<td><router-link :to="'/users/' + user.ID"><i class="material-icons">mode_edit</i></router-link></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
2318
rice-box.go
2318
rice-box.go
File diff suppressed because one or more lines are too long
2
users.go
2
users.go
@ -197,7 +197,7 @@ func usersPostHandler(c *RequestContext, w http.ResponseWriter, r *http.Request)
|
|||||||
c.FM.Users[u.Username] = u
|
c.FM.Users[u.Username] = u
|
||||||
|
|
||||||
// Set the Location header and return.
|
// Set the Location header and return.
|
||||||
w.Header().Set("Location", "/settings/users/"+strconv.Itoa(u.ID))
|
w.Header().Set("Location", "/users/"+strconv.Itoa(u.ID))
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user