mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-17 02:41:13 +01:00
Set Close/Back buttons to always browse back - Closes #217
This commit is contained in:
parent
a80a002ce7
commit
fe4ebd586d
7
resources/js/mixins.js
vendored
7
resources/js/mixins.js
vendored
@ -26,13 +26,6 @@ Vue.mixin({
|
|||||||
},
|
},
|
||||||
|
|
||||||
clearStorage() {
|
clearStorage() {
|
||||||
},
|
|
||||||
|
|
||||||
exitSettings: function (event) {
|
|
||||||
if (event) {
|
|
||||||
this.$notify({ clean: true })
|
|
||||||
this.$router.push({ name: 'accounts' })
|
|
||||||
}
|
|
||||||
this.$storage.remove('accounts')
|
this.$storage.remove('accounts')
|
||||||
this.$storage.remove('groups')
|
this.$storage.remove('groups')
|
||||||
this.$storage.remove('lastRoute')
|
this.$storage.remove('lastRoute')
|
||||||
|
@ -85,7 +85,13 @@
|
|||||||
<vue-footer :showButtons="true">
|
<vue-footer :showButtons="true">
|
||||||
<!-- close button -->
|
<!-- close button -->
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<router-link :to="{ name: 'accounts', params: { toRefresh: true } }" role="button" :aria-label="$t('commons.close_the_x_page', {pagetitle: pagetitle})" class="button is-rounded" :class="{'is-dark' : $root.showDarkMode}">{{ $t('commons.close') }}</router-link>
|
<router-link
|
||||||
|
:to="{ path: $route.params.goBackTo, params: { returnTo: $route.params.returnTo, toRefresh: true } }"
|
||||||
|
:aria-label="$t('commons.close_the_x_page', {pagetitle: pagetitle})"
|
||||||
|
class="button is-rounded"
|
||||||
|
:class="{'is-dark' : $root.showDarkMode}">
|
||||||
|
{{ $t('commons.back') }}
|
||||||
|
</router-link>
|
||||||
</p>
|
</p>
|
||||||
</vue-footer>
|
</vue-footer>
|
||||||
</responsive-width-wrapper>
|
</responsive-width-wrapper>
|
||||||
@ -129,6 +135,19 @@
|
|||||||
clipboardErrorHandler ({ value, event }) {
|
clipboardErrorHandler ({ value, event }) {
|
||||||
console.log('error', value)
|
console.log('error', value)
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
|
||||||
|
beforeRouteEnter(to, from, next) {
|
||||||
|
next(vm => {
|
||||||
|
if (from.params.returnTo) {
|
||||||
|
to.params.returnTo = from.params.returnTo
|
||||||
|
}
|
||||||
|
|
||||||
|
to.params.goBackTo = from.name
|
||||||
|
? from.path
|
||||||
|
: '/accounts'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -84,7 +84,7 @@
|
|||||||
mounted(){
|
mounted(){
|
||||||
// stop OTP generation on modal close
|
// stop OTP generation on modal close
|
||||||
this.$on('modalClose', function() {
|
this.$on('modalClose', function() {
|
||||||
this.$router.push({name: 'accounts' });
|
window.history.length > 1 ? this.$router.go(-1) : this.$router.push({ name: 'accounts '})
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -38,11 +38,17 @@
|
|||||||
</form-wrapper>
|
</form-wrapper>
|
||||||
</div>
|
</div>
|
||||||
<vue-footer :showButtons="true">
|
<vue-footer :showButtons="true">
|
||||||
<!-- Cancel button -->
|
<!-- close button -->
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<button class="button is-rounded" :class="{'is-dark' : $root.showDarkMode}" @click.stop="exitSettings">
|
<router-link
|
||||||
|
:to="{ path: $route.params.returnTo, params: { toRefresh: false } }"
|
||||||
|
class="button is-rounded"
|
||||||
|
:class="{'is-dark' : $root.showDarkMode}"
|
||||||
|
tabindex="0"
|
||||||
|
role="button"
|
||||||
|
:aria-label="$t('commons.close_the_x_page', {pagetitle: $router.currentRoute.meta.title})">
|
||||||
{{ $t('commons.close') }}
|
{{ $t('commons.close') }}
|
||||||
</button>
|
</router-link>
|
||||||
</p>
|
</p>
|
||||||
</vue-footer>
|
</vue-footer>
|
||||||
</div>
|
</div>
|
||||||
@ -144,5 +150,25 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeRouteEnter(to, from, next) {
|
||||||
|
next(vm => {
|
||||||
|
if (from.params.returnTo) {
|
||||||
|
to.params.returnTo = from.params.returnTo
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
to.params.returnTo = from.name
|
||||||
|
? from.path
|
||||||
|
: '/accounts'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeRouteLeave(to, from, next) {
|
||||||
|
if (to.name == 'accounts') {
|
||||||
|
this.$notify({ clean: true })
|
||||||
|
}
|
||||||
|
next()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -47,7 +47,15 @@
|
|||||||
<vue-footer :showButtons="true">
|
<vue-footer :showButtons="true">
|
||||||
<!-- close button -->
|
<!-- close button -->
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<router-link :to="{ name: 'accounts', params: { toRefresh: false } }" class="button is-rounded" :class="{'is-dark' : $root.showDarkMode}" tabindex="0">{{ $t('commons.close') }}</router-link>
|
<router-link
|
||||||
|
:to="{ path: $route.params.returnTo, params: { toRefresh: false } }"
|
||||||
|
class="button is-rounded"
|
||||||
|
:class="{'is-dark' : $root.showDarkMode}"
|
||||||
|
tabindex="0"
|
||||||
|
role="button"
|
||||||
|
:aria-label="$t('commons.close_the_x_page', {pagetitle: $router.currentRoute.meta.title})">
|
||||||
|
{{ $t('commons.close') }}
|
||||||
|
</router-link>
|
||||||
</p>
|
</p>
|
||||||
</vue-footer>
|
</vue-footer>
|
||||||
</form-wrapper>
|
</form-wrapper>
|
||||||
@ -147,5 +155,25 @@
|
|||||||
else this.$router.push({ name: 'settings.oauth.generatePAT' })
|
else this.$router.push({ name: 'settings.oauth.generatePAT' })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeRouteEnter(to, from, next) {
|
||||||
|
next(vm => {
|
||||||
|
if (from.params.returnTo) {
|
||||||
|
to.params.returnTo = from.params.returnTo
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
to.params.returnTo = from.name
|
||||||
|
? from.path
|
||||||
|
: '/accounts'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeRouteLeave(to, from, next) {
|
||||||
|
if (to.name == 'accounts') {
|
||||||
|
this.$notify({ clean: true })
|
||||||
|
}
|
||||||
|
next()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -70,11 +70,17 @@
|
|||||||
</form-wrapper>
|
</form-wrapper>
|
||||||
</div>
|
</div>
|
||||||
<vue-footer :showButtons="true">
|
<vue-footer :showButtons="true">
|
||||||
<!-- Cancel button -->
|
<!-- Close button -->
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<button class="button is-rounded" :class="{'is-dark' : $root.showDarkMode}" @click.stop="exitSettings">
|
<router-link
|
||||||
|
:to="{ path: $route.params.returnTo, params: { toRefresh: false } }"
|
||||||
|
class="button is-rounded"
|
||||||
|
:class="{'is-dark' : $root.showDarkMode}"
|
||||||
|
tabindex="0"
|
||||||
|
role="button"
|
||||||
|
:aria-label="$t('commons.close_the_x_page', {pagetitle: $router.currentRoute.meta.title})">
|
||||||
{{ $t('commons.close') }}
|
{{ $t('commons.close') }}
|
||||||
</button>
|
</router-link>
|
||||||
</p>
|
</p>
|
||||||
</vue-footer>
|
</vue-footer>
|
||||||
</div>
|
</div>
|
||||||
@ -253,5 +259,25 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeRouteEnter(to, from, next) {
|
||||||
|
next(vm => {
|
||||||
|
if (from.params.returnTo) {
|
||||||
|
to.params.returnTo = from.params.returnTo
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
to.params.returnTo = from.name
|
||||||
|
? from.path
|
||||||
|
: '/accounts'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeRouteLeave(to, from, next) {
|
||||||
|
if (to.name == 'accounts') {
|
||||||
|
this.$notify({ clean: true })
|
||||||
|
}
|
||||||
|
next()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -47,7 +47,15 @@
|
|||||||
<vue-footer :showButtons="true">
|
<vue-footer :showButtons="true">
|
||||||
<!-- close button -->
|
<!-- close button -->
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<router-link :to="{ name: 'accounts', params: { toRefresh: false } }" class="button is-rounded" :class="{'is-dark' : $root.showDarkMode}">{{ $t('commons.close') }}</router-link>
|
<router-link
|
||||||
|
:to="{ path: $route.params.returnTo, params: { toRefresh: false } }"
|
||||||
|
class="button is-rounded"
|
||||||
|
:class="{'is-dark' : $root.showDarkMode}"
|
||||||
|
tabindex="0"
|
||||||
|
role="button"
|
||||||
|
:aria-label="$t('commons.close_the_x_page', {pagetitle: $router.currentRoute.meta.title})">
|
||||||
|
{{ $t('commons.close') }}
|
||||||
|
</router-link>
|
||||||
</p>
|
</p>
|
||||||
</vue-footer>
|
</vue-footer>
|
||||||
</form-wrapper>
|
</form-wrapper>
|
||||||
@ -215,5 +223,25 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeRouteEnter(to, from, next) {
|
||||||
|
next(vm => {
|
||||||
|
if (from.params.returnTo) {
|
||||||
|
to.params.returnTo = from.params.returnTo
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
to.params.returnTo = from.name
|
||||||
|
? from.path
|
||||||
|
: '/accounts'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeRouteLeave(to, from, next) {
|
||||||
|
if (to.name == 'accounts') {
|
||||||
|
this.$notify({ clean: true })
|
||||||
|
}
|
||||||
|
next()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user