wikijs-fork/client/components/common/page-selector.vue

139 lines
3.3 KiB
Vue
Raw Normal View History

2018-09-30 22:19:28 +00:00
<template lang="pug">
v-dialog(v-model='isShown', lazy, max-width='850px')
2018-11-12 05:51:34 +00:00
v-card.page-selector
2018-09-30 22:19:28 +00:00
.dialog-header
span Select Page Location
v-spacer
v-progress-circular(
indeterminate
color='white'
:size='20'
:width='2'
v-show='searchLoading'
)
.d-flex(style='min-height:400px;')
v-flex(xs4).grey.lighten-3
2018-11-12 05:51:34 +00:00
v-toolbar(color='grey darken-3', dark, dense, flat)
.body-2 Folders
2018-09-30 22:19:28 +00:00
v-spacer
2018-11-12 05:51:34 +00:00
v-btn(icon): v-icon create_new_folder
v-treeview(
v-model='tree'
:items='treeFolders'
:load-children='fetchFolders'
activatable
open-on-click
hoverable
)
template(slot='prepend', slot-scope='{ item, open, leaf }')
v-icon {{ open ? 'folder_open' : 'folder' }}
2018-09-30 22:19:28 +00:00
v-flex(xs8)
2018-11-12 05:51:34 +00:00
v-toolbar(color='grey darken-2', dark, dense, flat)
.body-2 Pages
2018-10-01 02:18:40 +00:00
v-divider.ml-4(vertical)
v-text-field(
prepend-inner-icon='search'
label='Search...'
hide-details
solo
2018-11-12 05:51:34 +00:00
background-color='grey darken-2'
2018-10-01 02:18:40 +00:00
flat
clearable
)
v-divider.mx-3(vertical)
2018-11-12 05:51:34 +00:00
v-btn(icon): v-icon forward
v-btn(icon): v-icon delete
2018-09-30 22:19:28 +00:00
v-list(dense)
v-list-tile
v-list-tile-avatar: v-icon insert_drive_file
v-list-tile-title File A
v-divider
v-list-tile
v-list-tile-avatar: v-icon insert_drive_file
v-list-tile-title File B
v-divider
v-list-tile
v-list-tile-avatar: v-icon insert_drive_file
v-list-tile-title File C
v-divider
v-list-tile
v-list-tile-avatar: v-icon insert_drive_file
v-list-tile-title File D
v-card-text.grey.lighten-2.pa-2
v-text-field(
solo
hide-details
v-model='location'
2018-10-01 02:18:40 +00:00
flat
prepend-inner-icon='subdirectory_arrow_right'
clearable
2018-09-30 22:19:28 +00:00
)
v-card-chin
v-spacer
v-btn(outline, @click='close') Cancel
2018-11-12 05:51:34 +00:00
v-btn(color='primary', @click='open')
2018-09-30 22:19:28 +00:00
v-icon(left) check
span Select
</template>
<script>
export default {
props: {
value: {
type: Boolean,
default: false
2018-11-12 05:51:34 +00:00
},
mode: {
type: String,
default: 'create'
2018-09-30 22:19:28 +00:00
}
},
data() {
return {
2018-11-12 05:51:34 +00:00
searchLoading: false,
location: '/new-page',
tree: [],
treeChildren: []
2018-09-30 22:19:28 +00:00
}
},
computed: {
isShown: {
get() { return this.value },
set(val) { this.$emit('input', val) }
2018-11-12 05:51:34 +00:00
},
treeFolders() {
return [
{
id: '/',
name: '/ (root)',
children: []
}
]
2018-09-30 22:19:28 +00:00
}
},
methods: {
close() {
this.isShown = false
2018-11-12 05:51:34 +00:00
},
open() {
if (this.mode === 'create') {
window.location.assign(`/e${this.location}`)
}
},
async fetchFolders(item) {
console.info(item)
2018-09-30 22:19:28 +00:00
}
}
}
</script>
2018-11-12 05:51:34 +00:00
<style lang='scss'>
.page-selector {
.v-treeview-node__label {
font-size: 13px;
}
}
</style>