Merge pull request #1398 from dod-ccpo/171115854-fix-sidenav
Fix sidenav
This commit is contained in:
commit
8522a786ce
@ -1,5 +1,6 @@
|
||||
import ExpandSidenavMixin from '../mixins/expand_sidenav'
|
||||
import ToggleMixin from '../mixins/toggle'
|
||||
import { sidenavCookieName } from '../lib/constants'
|
||||
|
||||
export default {
|
||||
name: 'sidenav-toggler',
|
||||
@ -14,7 +15,7 @@ export default {
|
||||
toggle: function(e) {
|
||||
e.preventDefault()
|
||||
this.isVisible = !this.isVisible
|
||||
document.cookie = this.cookieName + '=' + this.isVisible + '; path=/'
|
||||
document.cookie = sidenavCookieName + '=' + this.isVisible + '; path=/'
|
||||
this.$parent.$emit('sidenavToggle', this.isVisible)
|
||||
},
|
||||
},
|
||||
|
1
js/lib/constants.js
Normal file
1
js/lib/constants.js
Normal file
@ -0,0 +1 @@
|
||||
export const sidenavCookieName = 'expandSidenav'
|
@ -1,11 +1,12 @@
|
||||
import { sidenavCookieName } from '../lib/constants'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
cookieName: 'expandSidenav',
|
||||
defaultVisible: {
|
||||
type: Boolean,
|
||||
default: function() {
|
||||
if (document.cookie.match(this.cookieName)) {
|
||||
return !!document.cookie.match(this.cookieName + ' *= *true')
|
||||
if (document.cookie.match(sidenavCookieName)) {
|
||||
return !!document.cookie.match(sidenavCookieName + ' *= *true')
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user