feat: move page

This commit is contained in:
NGPixel
2019-10-13 19:59:50 -04:00
parent daa8174d7f
commit 62d1d7a1df
23 changed files with 451 additions and 99 deletions

View File

@@ -98,6 +98,8 @@ import _ from 'lodash'
import { get } from 'vuex-pathify'
import pageTreeQuery from 'gql/common/common-pages-query-tree.gql'
const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i
/* global siteLangs, siteConfig */
export default {
@@ -152,7 +154,22 @@ export default {
return _.sortBy(_.filter(this.pages, ['parent', _.head(this.currentNode) || 0]), ['title', 'path'])
},
isValidPath () {
return this.currentPath && this.currentPath.length > 2
if (!this.currentPath) {
return false
}
const firstSection = _.head(this.currentPath.split('/'))
if (firstSection.length <= 1) {
return false
} else if (localeSegmentRegex.test(firstSection)) {
return false
} else if (
_.some(['login', 'logout', 'register', 'verify', 'favicons', 'fonts', 'img', 'js', 'svg'], p => {
return p === firstSection
})) {
return false
} else {
return true
}
}
},
watch: {