2019-12-19 21:50:50 -08:00
|
|
|
<style scoped>
|
|
|
|
.slotholder {
|
|
|
|
height: 100vh;
|
|
|
|
width: 140px;
|
|
|
|
display: block;
|
|
|
|
float: left;
|
|
|
|
}
|
|
|
|
.global-menu {
|
|
|
|
width: 140px;
|
|
|
|
background: #221f2b;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: block;
|
|
|
|
position: fixed;
|
|
|
|
z-index: 111;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.menu-item {
|
|
|
|
color: #fff;
|
2020-02-01 14:21:22 -08:00
|
|
|
padding: 0.8em 0px 0.8em 10px;
|
2019-12-19 21:50:50 -08:00
|
|
|
display: inline-block;
|
|
|
|
width: 100%;
|
2020-01-02 17:26:55 -08:00
|
|
|
font-size: 1.15em;
|
2019-12-19 21:50:50 -08:00
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
2020-02-01 14:21:22 -08:00
|
|
|
.menu-item i.icon {
|
|
|
|
margin-right: 10px;
|
|
|
|
}
|
2019-12-19 21:50:50 -08:00
|
|
|
.sub {
|
|
|
|
padding-left: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.menu-section {}
|
|
|
|
.menu-section + .menu-section {
|
|
|
|
border-top: 1px solid #534c68;
|
|
|
|
}
|
|
|
|
.menu-button {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.menu-button:hover {
|
|
|
|
background-color: #534c68;
|
2020-02-01 14:21:22 -08:00
|
|
|
text-decoration: none;
|
2019-12-19 21:50:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
.router-link-active i {
|
|
|
|
/*color: #16ab39;*/
|
|
|
|
}
|
|
|
|
.router-link-active {
|
|
|
|
background-color: #534c68;
|
|
|
|
}
|
|
|
|
|
|
|
|
.shade {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
background-color: rgba(0,0,0,0.7);
|
|
|
|
z-index: 100;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.top-menu-bar {
|
2020-01-02 17:26:55 -08:00
|
|
|
/*color: var(--text_color);*/
|
|
|
|
/*width: 100%;*/
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 999;
|
|
|
|
background-color: var(--background_color);
|
|
|
|
border-bottom: 1px solid;
|
|
|
|
border-color: var(--border_color);
|
|
|
|
padding: 5px 1rem 5px;
|
|
|
|
}
|
|
|
|
.place-holder {
|
|
|
|
width: 100%;
|
|
|
|
height: 50px;
|
2019-12-19 21:50:50 -08:00
|
|
|
}
|
|
|
|
.top-menu-bar img {
|
2020-01-02 17:26:55 -08:00
|
|
|
width: 30px;
|
|
|
|
height: 30px;
|
2019-12-19 21:50:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
2020-01-02 17:26:55 -08:00
|
|
|
|
|
|
|
<div class="place-holder" v-if="collapsed && !menuOpen"></div>
|
|
|
|
|
2019-12-19 21:50:50 -08:00
|
|
|
<!-- collapsed menu, appears as a bar -->
|
2020-01-02 17:26:55 -08:00
|
|
|
<div class="top-menu-bar" v-if="(collapsed || mobile) && !menuOpen">
|
2019-12-19 21:50:50 -08:00
|
|
|
<div class="ui grid">
|
2020-01-02 17:26:55 -08:00
|
|
|
|
2020-02-01 14:21:22 -08:00
|
|
|
<div class="seven wide column">
|
2020-01-02 17:26:55 -08:00
|
|
|
<div class="ui large basic compact icon button" v-on:click="collapseMenu">
|
|
|
|
<i class="green bars icon"></i>
|
|
|
|
</div>
|
2020-02-01 14:21:22 -08:00
|
|
|
|
|
|
|
<router-link class="ui large basic compact icon button" to="/notes" v-on:click.native="emitReloadEvent()">
|
|
|
|
<i class="green home icon"></i>
|
|
|
|
</router-link>
|
|
|
|
|
|
|
|
<div v-on:click="toggleNightMode" class="ui large basic compact icon button">
|
|
|
|
<i class="green moon outline icon"></i>
|
|
|
|
</div>
|
2019-12-19 21:50:50 -08:00
|
|
|
</div>
|
2020-02-01 14:21:22 -08:00
|
|
|
<div class="six wide center aligned column">
|
2020-01-02 17:26:55 -08:00
|
|
|
<img v-if="!loggedIn" src="/api/static/assets/favicon.ico" alt="logo" />
|
|
|
|
<search-input v-if="loggedIn"></search-input>
|
|
|
|
</div>
|
|
|
|
<div class="three wide right aligned column">
|
|
|
|
|
|
|
|
<!-- mobile create note button -->
|
|
|
|
<div v-if="loggedIn">
|
|
|
|
<div v-if="!disableNewNote" @click="createNote" class="ui large basic compact icon button">
|
|
|
|
<i class="green plus icon"></i>
|
|
|
|
</div>
|
|
|
|
<div v-if="disableNewNote" class="ui large basic compact icon button">
|
|
|
|
<i class="grey plus icon"></i>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-12-19 21:50:50 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="shade" v-if="mobile && !collapsed" v-on:click="collapseMenu"></div>
|
|
|
|
|
|
|
|
<div class="slotholder" v-if="!collapsed && !mobile">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="global-menu" v-if="!collapsed" v-on:click="menuClicked">
|
|
|
|
|
|
|
|
<div class="menu-section">
|
|
|
|
<div class="menu-item menu-button" v-on:click="collapseMenu">
|
2020-02-01 14:21:22 -08:00
|
|
|
<i class="angle left icon"></i>
|
2019-12-19 21:50:50 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section" v-if="loggedIn">
|
|
|
|
<div v-if="!disableNewNote" @click="createNote" class="menu-item menu-item menu-button">
|
|
|
|
<i class="green plus icon"></i>New Note
|
|
|
|
</div>
|
|
|
|
<div v-if="disableNewNote" class="menu-item menu-item menu-button">
|
|
|
|
<i class="purple plus icon"></i>Creating
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section" v-if="loggedIn">
|
2020-01-02 17:26:55 -08:00
|
|
|
<router-link exact-active-class="active" class="menu-item menu-button" to="/notes" v-on:click.native="emitReloadEvent()">
|
2019-12-19 21:50:50 -08:00
|
|
|
<i class="file icon"></i>Notes
|
|
|
|
</router-link>
|
|
|
|
<div>
|
2020-02-01 14:21:22 -08:00
|
|
|
<!-- <div class="menu-item sub">Show Only <i class="caret down icon"></i></div> -->
|
|
|
|
<!-- <div v-on:click="updateFastFilters(0)" class="menu-item menu-button sub"><i class="grey linkify icon"></i>Links</div> -->
|
|
|
|
<!-- <div v-on:click="updateFastFilters(1)" class="menu-item menu-button sub"><i class="grey tags icon"></i>Tags</div> -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section" v-if="loggedIn">
|
|
|
|
<div v-on:click="updateFastFilters(2)" class="menu-item menu-button">
|
|
|
|
<i class="archive icon"></i>Archived
|
2019-12-19 21:50:50 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section" v-if="loggedIn">
|
|
|
|
<router-link class="menu-item menu-button" exact-active-class="active" to="/attachments">
|
2020-02-01 14:21:22 -08:00
|
|
|
<i class="folder icon"></i>Files
|
2019-12-19 21:50:50 -08:00
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section" v-if="loggedIn">
|
|
|
|
<router-link v-if="loggedIn" exact-active-class="active" class="menu-item menu-button" to="/quick">
|
|
|
|
<i class="coffee icon"></i>Quick
|
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section" v-if="!loggedIn">
|
|
|
|
<router-link v-if="!loggedIn" class="menu-item menu-button" exact-active-class="active" to="/">
|
|
|
|
<i class="home icon"></i>Welcome
|
|
|
|
</router-link>
|
|
|
|
|
|
|
|
<router-link exact-active-class="active" class="menu-item menu-button" to="/login">
|
|
|
|
<i class="plug icon"></i>Login
|
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section">
|
|
|
|
<div v-on:click="toggleNightMode" class="menu-item menu-button">
|
|
|
|
<span v-if="$store.getters.getIsNightMode">
|
2020-02-01 14:21:22 -08:00
|
|
|
<i class="moon outline icon"></i>Light Theme</span>
|
2019-12-19 21:50:50 -08:00
|
|
|
<span v-else>
|
2020-02-01 14:21:22 -08:00
|
|
|
<i class="moon outline icon"></i>Dark Theme</span>
|
2019-12-19 21:50:50 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section" v-if="loggedIn">
|
|
|
|
<div v-if="loggedIn" v-on:click="destroyLoginToken" class="menu-item menu-button">
|
|
|
|
<i class="user icon"></i>{{ucWords($store.getters.getUsername)}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- <router-link class="ui basic compact button" exact-active-class="active" to="/help">
|
|
|
|
<i class="question mark icon"></i>Help
|
|
|
|
</router-link> -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
export default {
|
2020-01-02 17:26:55 -08:00
|
|
|
components: {
|
|
|
|
'search-input': require('@/components/SearchInput.vue').default,
|
|
|
|
},
|
2019-12-19 21:50:50 -08:00
|
|
|
data: function(){
|
|
|
|
return {
|
|
|
|
username: '',
|
|
|
|
collapsed: false,
|
|
|
|
mobile: false,
|
2020-01-02 17:26:55 -08:00
|
|
|
disableNewNote: false,
|
|
|
|
menuOpen: true,
|
2019-12-19 21:50:50 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeCreate: function(){
|
|
|
|
},
|
|
|
|
mounted: function(){
|
|
|
|
this.mobile = this.$store.getters.getIsUserOnMobile
|
|
|
|
this.collapsed = this.$store.getters.getIsUserOnMobile
|
2020-01-02 17:26:55 -08:00
|
|
|
|
|
|
|
if(this.mobile){
|
|
|
|
this.menuOpen = false
|
|
|
|
}
|
2019-12-19 21:50:50 -08:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
loggedIn () {
|
|
|
|
//Map logged in from state
|
|
|
|
return this.$store.getters.getLoggedIn
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
menuClicked(){
|
|
|
|
//Collapse menu when item is clicked in mobile
|
|
|
|
if(this.mobile && !this.collapsed){
|
|
|
|
this.collapsed = true
|
2020-01-02 17:26:55 -08:00
|
|
|
this.menuOpen = false
|
2019-12-19 21:50:50 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
collapseMenu(){
|
|
|
|
this.collapsed = !this.collapsed
|
2020-01-02 17:26:55 -08:00
|
|
|
|
|
|
|
if(!this.collapsed){
|
|
|
|
this.menuOpen = true
|
|
|
|
} else {
|
|
|
|
this.menuOpen = false
|
|
|
|
}
|
|
|
|
|
2019-12-19 21:50:50 -08:00
|
|
|
},
|
|
|
|
createNote(event){
|
|
|
|
const title = ''
|
|
|
|
this.disableNewNote = true
|
|
|
|
|
|
|
|
axios.post('/api/note/create', {title})
|
|
|
|
.then(response => {
|
|
|
|
|
|
|
|
if(response.data && response.data.id){
|
|
|
|
this.$router.push('/notes/open/'+response.data.id)
|
|
|
|
this.$bus.$emit('open_note', response.data.id)
|
|
|
|
this.disableNewNote = false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
destroyLoginToken() {
|
|
|
|
this.$store.commit('destroyLoginToken')
|
|
|
|
this.$router.push('/')
|
|
|
|
},
|
|
|
|
toggleNightMode(){
|
|
|
|
this.$store.commit('toggleNightMode')
|
|
|
|
},
|
|
|
|
ucWords(str){
|
|
|
|
return (str + '')
|
|
|
|
.replace(/^(.)|\s+(.)/g, function ($1) {
|
|
|
|
return $1.toUpperCase()
|
|
|
|
})
|
|
|
|
},
|
2020-01-02 17:26:55 -08:00
|
|
|
emitReloadEvent(){
|
|
|
|
//Reloads note page to initial state
|
|
|
|
this.$bus.$emit('note_reload')
|
|
|
|
},
|
2019-12-19 21:50:50 -08:00
|
|
|
updateFastFilters(index){
|
|
|
|
|
|
|
|
//A little hacky, brings user to notes page then filters on click
|
|
|
|
if(this.$route.name != 'NotesPage'){
|
|
|
|
this.$router.push('/notes')
|
|
|
|
setTimeout( () => {
|
|
|
|
this.updateFastFilters(index)
|
|
|
|
}, 500 )
|
|
|
|
}
|
|
|
|
|
|
|
|
const options = [
|
|
|
|
'withLinks', // 'Only Show Notes with Links'
|
|
|
|
'withTags', // 'Only Show Notes with Tags'
|
|
|
|
'onlyArchived', //'Only Show Archived Notes'
|
|
|
|
]
|
|
|
|
|
|
|
|
let filter = {}
|
|
|
|
filter[options[index]] = 1
|
|
|
|
|
|
|
|
this.$bus.$emit('update_fast_filters', filter)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|