2018-03-03 06:32:58 +00:00
|
|
|
<template lang='pug'>
|
2018-08-13 04:12:44 +00:00
|
|
|
v-toolbar.nav-header(color='black', dark, app, clipped-left, fixed, flat, :extended='searchIsShown && $vuetify.breakpoint.smAndDown')
|
|
|
|
v-toolbar(color='deep-purple', flat, slot='extension', v-if='searchIsShown && $vuetify.breakpoint.smAndDown')
|
|
|
|
v-text-field(
|
2019-03-09 23:43:32 +00:00
|
|
|
ref='searchFieldMobile'
|
|
|
|
v-model='search'
|
|
|
|
clearable
|
2018-08-13 04:12:44 +00:00
|
|
|
background-color='deep-purple'
|
2019-03-09 23:43:32 +00:00
|
|
|
color='white'
|
|
|
|
label='Search...'
|
|
|
|
single-line
|
2018-08-13 04:12:44 +00:00
|
|
|
solo
|
|
|
|
flat
|
2019-03-09 23:43:32 +00:00
|
|
|
hide-details
|
|
|
|
prepend-inner-icon='search'
|
|
|
|
:loading='searchIsLoading'
|
2018-08-13 04:12:44 +00:00
|
|
|
@keyup.enter='searchEnter'
|
|
|
|
)
|
2018-12-30 02:30:51 +00:00
|
|
|
v-layout(row)
|
|
|
|
v-flex(xs6, :md4='searchIsShown', :md6='!searchIsShown')
|
|
|
|
v-toolbar.nav-header-inner(color='black', dark, flat)
|
2019-06-02 21:29:50 +00:00
|
|
|
v-menu(open-on-hover, offset-y, bottom, left, min-width='250', transition='slide-y-transition')
|
2018-12-30 02:30:51 +00:00
|
|
|
v-toolbar-side-icon.btn-animate-app(slot='activator')
|
|
|
|
v-icon view_module
|
|
|
|
v-list(dense, :light='!$vuetify.dark', :dark='$vuetify.dark', :class='$vuetify.dark ? `grey darken-4` : ``').py-0
|
|
|
|
v-list-tile(avatar, href='/')
|
|
|
|
v-list-tile-avatar: v-icon(color='blue') home
|
|
|
|
v-list-tile-content Home
|
|
|
|
v-list-tile(avatar, @click='pageNew')
|
|
|
|
v-list-tile-avatar: v-icon(color='green') add_box
|
|
|
|
v-list-tile-content New Page
|
|
|
|
template(v-if='path && path.length')
|
|
|
|
v-divider.my-0
|
|
|
|
v-subheader Current Page
|
|
|
|
v-list-tile(avatar, @click='pageView', v-if='mode !== `view`')
|
|
|
|
v-list-tile-avatar: v-icon(color='indigo') subject
|
|
|
|
v-list-tile-content View
|
|
|
|
v-list-tile(avatar, @click='pageEdit', v-if='mode !== `edit`')
|
|
|
|
v-list-tile-avatar: v-icon(color='indigo') edit
|
|
|
|
v-list-tile-content Edit
|
|
|
|
v-list-tile(avatar, @click='pageHistory', v-if='mode !== `history`')
|
|
|
|
v-list-tile-avatar: v-icon(color='indigo') history
|
|
|
|
v-list-tile-content History
|
|
|
|
v-list-tile(avatar, @click='pageSource', v-if='mode !== `source`')
|
|
|
|
v-list-tile-avatar: v-icon(color='indigo') code
|
|
|
|
v-list-tile-content View Source
|
|
|
|
v-list-tile(avatar, @click='pageMove')
|
2019-05-26 01:38:29 +00:00
|
|
|
v-list-tile-avatar: v-icon(color='grey lighten-2') forward
|
|
|
|
v-list-tile-content.grey--text.text--ligten-2 Move / Rename
|
2018-12-30 02:30:51 +00:00
|
|
|
v-list-tile(avatar, @click='pageDelete')
|
|
|
|
v-list-tile-avatar: v-icon(color='red darken-2') delete
|
|
|
|
v-list-tile-content Delete
|
|
|
|
v-divider.my-0
|
|
|
|
v-subheader Assets
|
2019-01-01 06:40:31 +00:00
|
|
|
v-list-tile(avatar, @click='assets')
|
2019-05-26 01:38:29 +00:00
|
|
|
v-list-tile-avatar: v-icon(color='grey lighten-2') burst_mode
|
|
|
|
v-list-tile-content.grey--text.text--ligten-2 Images & Files
|
2018-12-30 02:30:51 +00:00
|
|
|
v-toolbar-title(:class='{ "ml-2": $vuetify.breakpoint.mdAndUp, "ml-0": $vuetify.breakpoint.smAndDown }')
|
|
|
|
span.subheading {{title}}
|
2019-03-20 04:37:33 +00:00
|
|
|
v-flex(md4, v-if='$vuetify.breakpoint.mdAndUp')
|
2018-12-30 02:30:51 +00:00
|
|
|
v-toolbar.nav-header-inner(color='black', dark, flat)
|
2019-03-20 04:37:33 +00:00
|
|
|
slot(name='mid')
|
|
|
|
transition(name='navHeaderSearch', v-if='searchIsShown')
|
|
|
|
v-text-field(
|
|
|
|
ref='searchField',
|
|
|
|
v-if='searchIsShown && $vuetify.breakpoint.mdAndUp',
|
|
|
|
v-model='search',
|
|
|
|
color='white',
|
|
|
|
label='Search...',
|
|
|
|
single-line,
|
|
|
|
solo
|
|
|
|
flat
|
|
|
|
hide-details,
|
|
|
|
prepend-inner-icon='search',
|
|
|
|
:loading='searchIsLoading',
|
|
|
|
@keyup.enter='searchEnter'
|
|
|
|
@keyup.esc='searchClose'
|
|
|
|
@focus='searchFocus'
|
|
|
|
@blur='searchBlur'
|
|
|
|
@keyup.down='searchMove(`down`)'
|
|
|
|
@keyup.up='searchMove(`up`)'
|
2018-12-30 02:30:51 +00:00
|
|
|
)
|
2019-03-20 04:37:33 +00:00
|
|
|
v-progress-linear(
|
|
|
|
indeterminate,
|
|
|
|
slot='progress',
|
|
|
|
height='2',
|
|
|
|
color='blue'
|
2019-03-09 05:51:02 +00:00
|
|
|
)
|
2019-03-20 04:37:33 +00:00
|
|
|
v-menu(
|
|
|
|
v-model='searchAdvMenuShown'
|
|
|
|
left
|
|
|
|
offset-y
|
|
|
|
min-width='450'
|
|
|
|
:close-on-content-click='false'
|
|
|
|
nudge-bottom='7'
|
|
|
|
nudge-right='5'
|
|
|
|
v-if='searchIsShown'
|
|
|
|
)
|
|
|
|
v-btn.nav-header-search-adv(icon, outline, color='grey darken-2', slot='activator')
|
|
|
|
v-icon(color='white') expand_more
|
|
|
|
v-card.radius-0(dark)
|
|
|
|
v-toolbar(flat, color='grey darken-4', dense)
|
|
|
|
v-icon.mr-2 search
|
|
|
|
v-subheader.pl-0 Advanced Search
|
|
|
|
v-spacer
|
|
|
|
v-chip(label, small, color='primary') Coming soon
|
|
|
|
v-card-text.pa-4
|
|
|
|
v-checkbox.mt-0(
|
|
|
|
label='Restrict to current language'
|
|
|
|
color='white'
|
|
|
|
v-model='searchRestrictLocale'
|
|
|
|
hide-details
|
|
|
|
)
|
|
|
|
v-checkbox(
|
|
|
|
label='Search below current path only'
|
|
|
|
color='white'
|
|
|
|
v-model='searchRestrictPath'
|
|
|
|
hide-details
|
|
|
|
)
|
|
|
|
v-divider
|
|
|
|
v-card-actions.grey.darken-3-d4
|
|
|
|
v-btn(depressed, color='grey darken-3', block)
|
|
|
|
v-icon(left) chevron_right
|
|
|
|
span Save as defaults
|
|
|
|
v-btn(depressed, color='grey darken-3', block)
|
|
|
|
v-icon(left) cached
|
|
|
|
span Reset
|
2018-12-30 02:30:51 +00:00
|
|
|
v-flex(xs6, :md4='searchIsShown', :md6='!searchIsShown')
|
|
|
|
v-toolbar.nav-header-inner(color='black', dark, flat)
|
|
|
|
v-spacer
|
|
|
|
.navHeaderLoading.mr-3
|
|
|
|
v-progress-circular(indeterminate, color='blue', :size='22', :width='2' v-show='isLoading')
|
|
|
|
slot(name='actions')
|
|
|
|
v-btn(
|
|
|
|
v-if='!hideSearch && $vuetify.breakpoint.smAndDown'
|
|
|
|
@click='searchToggle'
|
|
|
|
icon
|
|
|
|
)
|
|
|
|
v-icon(color='grey') search
|
2019-06-02 21:29:50 +00:00
|
|
|
//- v-menu(offset-y, left, transition='slide-y-transition')
|
|
|
|
//- v-tooltip(bottom, slot='activator')
|
|
|
|
//- v-btn(icon, slot='activator')
|
|
|
|
//- v-icon(color='grey') language
|
|
|
|
//- span Language
|
|
|
|
//- v-list.py-0
|
|
|
|
//- template(v-for='(lc, idx) of locales')
|
|
|
|
//- v-list-tile(@click='changeLocale(lc)')
|
|
|
|
//- v-list-tile-action: v-chip(:color='lc.code === $i18n.i18next.language ? `blue` : `grey`', small, label, dark) {{lc.code.toUpperCase()}}
|
|
|
|
//- v-list-tile-title {{lc.name}}
|
|
|
|
//- v-divider.my-0(v-if='idx < locales.length - 1')
|
2018-12-30 02:30:51 +00:00
|
|
|
v-tooltip(bottom, v-if='isAuthenticated && isAdmin')
|
|
|
|
v-btn.btn-animate-rotate(icon, href='/a', slot='activator')
|
|
|
|
v-icon(color='grey') settings
|
|
|
|
span Admin
|
2019-06-02 21:29:50 +00:00
|
|
|
v-menu(v-if='isAuthenticated', offset-y, min-width='300', left, transition='slide-y-transition')
|
2018-12-30 02:30:51 +00:00
|
|
|
v-tooltip(bottom, slot='activator')
|
2019-04-22 01:43:33 +00:00
|
|
|
v-btn(icon, slot='activator', outline, color='blue')
|
|
|
|
v-icon(v-if='picture.kind === `initials`', color='grey') account_circle
|
|
|
|
v-avatar(v-else-if='picture.kind === `image`', :size='29')
|
|
|
|
v-img(:src='picture.url')
|
2018-12-30 02:30:51 +00:00
|
|
|
span Account
|
|
|
|
v-list.py-0
|
2019-01-12 23:33:30 +00:00
|
|
|
v-list-tile.py-3.grey(avatar, :class='$vuetify.dark ? `darken-4-l5` : `lighten-5`')
|
|
|
|
v-list-tile-avatar
|
|
|
|
v-avatar.blue(v-if='picture.kind === `initials`', :size='40')
|
|
|
|
span.white--text.subheading {{picture.initials}}
|
|
|
|
v-avatar(v-else-if='picture.kind === `image`', :size='40')
|
|
|
|
v-img(:src='picture.url')
|
|
|
|
v-list-tile-content
|
|
|
|
v-list-tile-title {{name}}
|
|
|
|
v-list-tile-sub-title {{email}}
|
|
|
|
v-divider.my-0
|
2019-06-02 21:29:50 +00:00
|
|
|
v-list-tile(href='/w', disabled)
|
2019-01-12 23:33:30 +00:00
|
|
|
v-list-tile-action: v-icon(color='blue') web
|
|
|
|
v-list-tile-title My Wiki
|
|
|
|
v-divider.my-0
|
2019-06-02 21:29:50 +00:00
|
|
|
v-list-tile(href='/p', disabled)
|
2019-01-12 23:33:30 +00:00
|
|
|
v-list-tile-action: v-icon(color='blue') person
|
|
|
|
v-list-tile-title Profile
|
|
|
|
v-divider.my-0
|
|
|
|
v-list-tile(@click='logout')
|
|
|
|
v-list-tile-action: v-icon(color='red') exit_to_app
|
|
|
|
v-list-tile-title Logout
|
|
|
|
|
|
|
|
v-tooltip(v-else, left)
|
|
|
|
v-btn(icon, slot='activator', outline, color='grey darken-3', href='/login')
|
|
|
|
v-icon(color='grey') account_circle
|
|
|
|
span Login
|
2018-11-12 05:51:34 +00:00
|
|
|
|
2018-12-15 22:15:13 +00:00
|
|
|
page-selector(mode='create', v-model='newPageModal', :open-handler='pageNewCreate')
|
2019-01-26 23:35:56 +00:00
|
|
|
page-delete(v-model='deletePageModal', v-if='path && path.length')
|
2018-03-03 06:32:58 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-03-09 05:51:02 +00:00
|
|
|
import { get, sync } from 'vuex-pathify'
|
2018-08-13 04:12:44 +00:00
|
|
|
import _ from 'lodash'
|
2018-10-08 04:17:31 +00:00
|
|
|
import Cookies from 'js-cookie'
|
2018-06-11 03:23:09 +00:00
|
|
|
|
2018-03-03 06:32:58 +00:00
|
|
|
export default {
|
2019-01-26 23:35:56 +00:00
|
|
|
components: {
|
|
|
|
PageDelete: () => import('./page-delete.vue')
|
|
|
|
},
|
2018-07-30 02:23:33 +00:00
|
|
|
props: {
|
|
|
|
dense: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
hideSearch: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
2018-03-06 04:13:20 +00:00
|
|
|
data() {
|
2018-03-12 04:09:54 +00:00
|
|
|
return {
|
2018-03-19 03:12:56 +00:00
|
|
|
menuIsShown: true,
|
2018-07-30 02:23:33 +00:00
|
|
|
searchIsShown: true,
|
2019-03-09 05:51:02 +00:00
|
|
|
searchAdvMenuShown: false,
|
2019-01-26 23:35:56 +00:00
|
|
|
newPageModal: false,
|
2019-06-02 21:29:50 +00:00
|
|
|
deletePageModal: false,
|
|
|
|
locales: [
|
|
|
|
{ code: 'en', name: 'English' },
|
|
|
|
{ code: 'fr', name: 'Français' },
|
|
|
|
{ code: 'es', name: 'Español' }
|
|
|
|
]
|
2018-03-12 04:09:54 +00:00
|
|
|
}
|
|
|
|
},
|
2018-03-25 02:35:47 +00:00
|
|
|
computed: {
|
2019-03-09 05:51:02 +00:00
|
|
|
search: sync('site/search'),
|
2019-03-09 23:43:32 +00:00
|
|
|
searchIsFocused: sync('site/searchIsFocused'),
|
2019-03-09 05:51:02 +00:00
|
|
|
searchIsLoading: sync('site/searchIsLoading'),
|
|
|
|
searchRestrictLocale: sync('site/searchRestrictLocale'),
|
|
|
|
searchRestrictPath: sync('site/searchRestrictPath'),
|
2018-08-04 21:27:55 +00:00
|
|
|
isLoading: get('isLoading'),
|
2018-10-29 02:09:58 +00:00
|
|
|
title: get('site/title'),
|
2018-11-19 06:08:55 +00:00
|
|
|
path: get('page/path'),
|
2018-12-03 02:42:43 +00:00
|
|
|
mode: get('page/mode'),
|
|
|
|
name: get('user/name'),
|
|
|
|
email: get('user/email'),
|
|
|
|
pictureUrl: get('user/pictureUrl'),
|
|
|
|
isAuthenticated: get('user/authenticated'),
|
|
|
|
permissions: get('user/permissions'),
|
|
|
|
picture() {
|
|
|
|
if (this.pictureUrl && this.pictureUrl.length > 1) {
|
|
|
|
return {
|
|
|
|
kind: 'image',
|
|
|
|
url: this.pictureUrl
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
const nameParts = this.name.toUpperCase().split(' ')
|
|
|
|
let initials = _.head(nameParts).charAt(0)
|
|
|
|
if (nameParts.length > 1) {
|
|
|
|
initials += _.last(nameParts).charAt(0)
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
kind: 'initials',
|
|
|
|
initials
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
isAdmin() {
|
|
|
|
return _.includes(this.permissions, 'manage:system')
|
|
|
|
}
|
2018-03-25 02:35:47 +00:00
|
|
|
},
|
2018-07-30 02:23:33 +00:00
|
|
|
created() {
|
2018-08-13 04:12:44 +00:00
|
|
|
if (this.hideSearch || this.dense || this.$vuetify.breakpoint.smAndDown) {
|
2018-07-30 02:23:33 +00:00
|
|
|
this.searchIsShown = false
|
|
|
|
}
|
|
|
|
},
|
2018-03-12 04:09:54 +00:00
|
|
|
methods: {
|
2019-03-09 23:43:32 +00:00
|
|
|
searchFocus() {
|
|
|
|
this.searchIsFocused = true
|
|
|
|
},
|
|
|
|
searchBlur() {
|
|
|
|
this.searchIsFocused = false
|
|
|
|
},
|
|
|
|
searchClose() {
|
|
|
|
this.search = ''
|
|
|
|
this.searchBlur()
|
|
|
|
},
|
2018-08-13 04:12:44 +00:00
|
|
|
searchToggle() {
|
|
|
|
this.searchIsShown = !this.searchIsShown
|
|
|
|
if (this.searchIsShown) {
|
|
|
|
_.delay(() => {
|
|
|
|
this.$refs.searchFieldMobile.focus()
|
|
|
|
}, 200)
|
|
|
|
}
|
|
|
|
},
|
2018-03-12 04:09:54 +00:00
|
|
|
searchEnter() {
|
2019-03-10 06:28:58 +00:00
|
|
|
this.$root.$emit('searchEnter', true)
|
|
|
|
},
|
|
|
|
searchMove(dir) {
|
|
|
|
this.$root.$emit('searchMove', dir)
|
2018-08-09 04:07:15 +00:00
|
|
|
},
|
|
|
|
pageNew () {
|
2018-11-12 05:51:34 +00:00
|
|
|
this.newPageModal = true
|
2018-08-09 04:07:15 +00:00
|
|
|
},
|
2018-12-15 22:15:13 +00:00
|
|
|
pageNewCreate ({ path, locale }) {
|
|
|
|
window.location.assign(`/e/${path}`)
|
|
|
|
},
|
2018-11-19 06:08:55 +00:00
|
|
|
pageView () {
|
|
|
|
window.location.assign(`/${this.path}`)
|
|
|
|
},
|
2018-08-09 04:07:15 +00:00
|
|
|
pageEdit () {
|
2018-10-29 02:09:58 +00:00
|
|
|
window.location.assign(`/e/${this.path}`)
|
2018-08-09 04:07:15 +00:00
|
|
|
},
|
|
|
|
pageHistory () {
|
2018-10-29 02:09:58 +00:00
|
|
|
window.location.assign(`/h/${this.path}`)
|
2018-08-09 04:07:15 +00:00
|
|
|
},
|
|
|
|
pageSource () {
|
2018-11-19 06:08:55 +00:00
|
|
|
window.location.assign(`/s/${this.path}`)
|
2018-08-09 04:07:15 +00:00
|
|
|
},
|
|
|
|
pageMove () {
|
2019-01-01 06:40:31 +00:00
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
style: 'indigo',
|
|
|
|
message: `Coming soon...`,
|
|
|
|
icon: 'directions_boat'
|
|
|
|
})
|
2018-08-09 04:07:15 +00:00
|
|
|
},
|
|
|
|
pageDelete () {
|
2019-01-26 23:35:56 +00:00
|
|
|
this.deletePageModal = true
|
2019-01-01 06:40:31 +00:00
|
|
|
},
|
|
|
|
assets () {
|
2019-06-02 21:29:50 +00:00
|
|
|
// window.location.assign(`/f`)
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
style: 'indigo',
|
|
|
|
message: `Coming soon...`,
|
|
|
|
icon: 'directions_boat'
|
|
|
|
})
|
|
|
|
},
|
|
|
|
async changeLocale(locale) {
|
|
|
|
await this.$i18n.i18next.changeLanguage(locale.code)
|
|
|
|
switch (this.mode) {
|
|
|
|
case 'view':
|
|
|
|
case 'history':
|
|
|
|
window.location.assign(`/${locale.code}/${this.path}`)
|
|
|
|
break
|
|
|
|
}
|
2018-10-08 04:17:31 +00:00
|
|
|
},
|
|
|
|
logout () {
|
|
|
|
Cookies.remove('jwt')
|
|
|
|
window.location.assign('/')
|
2018-03-12 04:09:54 +00:00
|
|
|
}
|
2018-03-06 04:13:20 +00:00
|
|
|
}
|
2018-03-03 06:32:58 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2018-03-12 04:09:54 +00:00
|
|
|
<style lang='scss'>
|
2018-08-13 04:12:44 +00:00
|
|
|
|
|
|
|
.nav-header {
|
2019-05-25 03:05:55 +00:00
|
|
|
//z-index: 1000;
|
2019-04-22 04:44:24 +00:00
|
|
|
|
2018-08-13 04:12:44 +00:00
|
|
|
.v-toolbar__extension {
|
|
|
|
padding: 0;
|
|
|
|
|
|
|
|
.v-toolbar__content {
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
.v-text-field .v-input__prepend-inner {
|
|
|
|
padding: 0 14px 0 5px;
|
|
|
|
padding-right: 14px;
|
|
|
|
}
|
|
|
|
}
|
2018-12-30 02:30:51 +00:00
|
|
|
|
|
|
|
&-inner {
|
|
|
|
.v-toolbar__content {
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
}
|
2019-03-09 05:51:02 +00:00
|
|
|
|
|
|
|
&-search-adv {
|
|
|
|
position: absolute;
|
|
|
|
top: 7px;
|
|
|
|
right: 12px;
|
|
|
|
border-radius: 4px !important;
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
border-radius: 4px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover, &:focus {
|
|
|
|
position: absolute !important;
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-13 04:12:44 +00:00
|
|
|
}
|
|
|
|
|
2018-03-12 04:09:54 +00:00
|
|
|
.navHeaderSearch {
|
|
|
|
&-enter-active, &-leave-active {
|
|
|
|
transition: opacity .25s ease, transform .25s ease;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
&-enter-active {
|
|
|
|
transition-delay: .25s;
|
|
|
|
}
|
|
|
|
&-enter, &-leave-to {
|
|
|
|
opacity: 0;
|
2018-07-30 02:23:33 +00:00
|
|
|
transform: scale(.7, .7);
|
2018-03-12 04:09:54 +00:00
|
|
|
}
|
|
|
|
}
|
2018-07-30 02:23:33 +00:00
|
|
|
.navHeaderLoading { // To avoid search bar jumping
|
|
|
|
width: 22px;
|
|
|
|
}
|
2018-11-11 04:40:55 +00:00
|
|
|
|
2018-03-03 06:32:58 +00:00
|
|
|
</style>
|