You've already forked AstralRinth
forked from didirus/AstralRinth
General UI Improvement (again) (#255)
* Add and fix some stuff * Add warning when leaving to `mod/create` * Fix mods/create not working
This commit is contained in:
@@ -154,11 +154,31 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
createdVersion: {},
|
||||
isEditing: true,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$emit('update:link-bar', [['New Version', 'newversion']])
|
||||
},
|
||||
mounted() {
|
||||
function preventLeave(e) {
|
||||
e.preventDefault()
|
||||
e.returnValue = ''
|
||||
}
|
||||
window.addEventListener('beforeunload', preventLeave)
|
||||
this.$once('hook:beforeDestroy', () => {
|
||||
window.removeEventListener('beforeunload', preventLeave)
|
||||
})
|
||||
},
|
||||
beforeRouteLeave(to, from, next) {
|
||||
if (
|
||||
this.isEditing &&
|
||||
!window.confirm('Are you sure that you want to leave without saving?')
|
||||
) {
|
||||
return
|
||||
}
|
||||
next()
|
||||
},
|
||||
methods: {
|
||||
async createVersion() {
|
||||
this.$nuxt.$loading.start()
|
||||
@@ -192,6 +212,8 @@ export default {
|
||||
},
|
||||
})
|
||||
).data
|
||||
|
||||
this.isEditing = false
|
||||
await this.$router.push(
|
||||
`/mod/${this.mod.slug ? this.mod.slug : data.mod_id}/version/${
|
||||
data.id
|
||||
|
||||
Reference in New Issue
Block a user