wikijs-fork/client/components/editor/editor-modal-properties.vue

249 lines
7.7 KiB
Vue
Raw Normal View History

2018-02-18 03:18:37 +00:00
<template lang='pug'>
2018-12-09 05:46:06 +00:00
v-dialog(
2018-07-15 23:16:19 +00:00
v-model='isShown'
2018-12-09 05:46:06 +00:00
persistent
width='1100'
:fullscreen='$vuetify.breakpoint.smAndDown'
2018-07-15 23:16:19 +00:00
)
.dialog-header
2019-08-03 04:48:55 +00:00
v-icon(color='white') mdi-tag-text-outline
2019-08-04 02:51:29 +00:00
.subtitle-1.white--text.ml-3 {{$t('editor:props.pageProperties')}}
2018-02-18 03:18:37 +00:00
v-spacer
v-btn.mx-0(
2019-08-03 04:48:55 +00:00
outlined
2018-07-15 23:16:19 +00:00
dark
@click.native='close'
)
2019-08-03 04:48:55 +00:00
v-icon(left) mdi-check
span {{ $t('common:actions.ok') }}
2019-08-25 18:23:56 +00:00
v-card(tile)
v-card-text.pt-5
2019-08-03 04:48:55 +00:00
.overline.pb-5 {{$t('editor:props.pageInfo')}}
2018-07-15 23:16:19 +00:00
v-text-field(
2018-07-16 02:40:41 +00:00
ref='iptTitle'
2019-08-03 04:48:55 +00:00
outlined
2019-06-15 21:05:56 +00:00
:label='$t(`editor:props.title`)'
2018-07-15 23:16:19 +00:00
counter='255'
v-model='title'
)
v-text-field(
2019-08-03 04:48:55 +00:00
outlined
2019-06-15 21:05:56 +00:00
:label='$t(`editor:props.shortDescription`)'
2018-07-15 23:16:19 +00:00
counter='255'
v-model='description'
2018-12-09 05:46:06 +00:00
persistent-hint
2019-06-15 21:05:56 +00:00
:hint='$t(`editor:props.shortDescriptionHint`)'
2018-07-15 23:16:19 +00:00
)
v-divider
2019-08-25 18:23:56 +00:00
v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d3` : `lighten-5`')
2019-08-03 04:48:55 +00:00
.overline.pb-5 {{$t('editor:props.pathCategorization')}}
2018-07-22 04:29:39 +00:00
v-container.pa-0(fluid, grid-list-lg)
v-layout(row, wrap)
v-flex(xs12, md2)
v-select(
2019-08-03 04:48:55 +00:00
outlined
2019-06-15 21:05:56 +00:00
:label='$t(`editor:props.locale`)'
2018-07-22 04:29:39 +00:00
suffix='/'
:items='namespaces'
v-model='locale'
hide-details
:disabled='mode !== "create"'
2018-07-22 04:29:39 +00:00
)
v-flex(xs12, md10)
v-text-field(
2019-08-03 04:48:55 +00:00
outlined
2019-06-15 21:05:56 +00:00
:label='$t(`editor:props.path`)'
2019-08-03 04:48:55 +00:00
append-icon='mdi-folder-search'
2018-07-22 04:29:39 +00:00
v-model='path'
2019-06-15 21:05:56 +00:00
:hint='$t(`editor:props.pathHint`)'
2018-07-22 04:29:39 +00:00
persistent-hint
@click:append='showPathSelector'
:disabled='mode !== "create"'
2018-07-22 04:29:39 +00:00
)
2018-07-16 02:40:41 +00:00
v-combobox(
2018-07-15 23:16:19 +00:00
chips
deletable-chips
2019-06-15 21:05:56 +00:00
:label='$t(`editor:props.tags`)'
2019-08-03 04:48:55 +00:00
outlined
2018-07-16 02:40:41 +00:00
multiple
2018-07-15 23:16:19 +00:00
v-model='tags'
single-line
:hint='`COMING SOON - ` + $t(`editor:props.tagsHint`)'
2018-07-22 04:29:39 +00:00
persistent-hint
disabled
2018-07-15 23:16:19 +00:00
)
v-divider
2019-08-25 18:23:56 +00:00
v-card-text.py-5.grey(:class='darkMode ? `darken-3-d5` : `lighten-4`')
2019-08-04 02:51:29 +00:00
.overline.pb-5 {{$t('editor:props.publishState')}} #[v-chip.ml-3(label, color='grey', small, outlined).white--text coming soon]
2018-07-16 02:40:41 +00:00
v-container.pa-0(fluid, grid-list-lg)
v-layout(row, wrap)
v-flex(xs12, md4)
v-switch(
2019-06-15 21:05:56 +00:00
:label='$t(`editor:props.publishToggle`)'
2018-07-16 02:40:41 +00:00
v-model='isPublished'
color='primary'
2019-06-15 21:05:56 +00:00
:hint='$t(`editor:props.publishToggleHint`)'
2018-07-22 04:29:39 +00:00
persistent-hint
disabled
2018-07-15 23:16:19 +00:00
)
2018-07-16 02:40:41 +00:00
v-flex(xs12, md4)
v-dialog(
ref='menuPublishStart'
:close-on-content-click='false'
v-model='isPublishStartShown'
:return-value.sync='publishStartDate'
full-width
width='460px'
:disabled='!isPublished || true'
2018-07-15 23:16:19 +00:00
)
2019-08-04 02:51:29 +00:00
template(v-slot:activator='{ on }')
v-text-field(
v-on='on'
:label='$t(`editor:props.publishStart`)'
v-model='publishStartDate'
prepend-icon='mdi-calendar-check'
readonly
outlined
clearable
:hint='$t(`editor:props.publishStartHint`)'
persistent-hint
:disabled='!isPublished || true'
)
2018-07-16 02:40:41 +00:00
v-date-picker(
v-model='publishStartDate'
:min='(new Date()).toISOString().substring(0, 10)'
2018-07-15 23:16:19 +00:00
color='primary'
2018-07-16 02:40:41 +00:00
reactive
scrollable
landscape
)
v-spacer
v-btn(
flat=''
color='primary'
@click='isPublishStartShown = false'
2019-06-15 21:05:56 +00:00
) {{$t('common:actions.cancel')}}
2018-07-16 02:40:41 +00:00
v-btn(
flat=''
color='primary'
@click='$refs.menuPublishStart.save(publishStartDate)'
2019-06-15 21:05:56 +00:00
) {{$t('common:actions.ok')}}
2018-07-16 02:40:41 +00:00
v-flex(xs12, md4)
v-dialog(
ref='menuPublishEnd'
:close-on-content-click='false'
v-model='isPublishEndShown'
:return-value.sync='publishEndDate'
full-width
width='460px'
:disabled='!isPublished || true'
2018-07-16 02:40:41 +00:00
)
2019-08-04 02:51:29 +00:00
template(v-slot:activator='{ on }')
v-text-field(
v-on='on'
:label='$t(`editor:props.publishEnd`)'
v-model='publishEndDate'
prepend-icon='mdi-calendar-remove'
readonly
outlined
clearable
:hint='$t(`editor:props.publishEndHint`)'
persistent-hint
:disabled='!isPublished || true'
)
2018-07-16 02:40:41 +00:00
v-date-picker(
v-model='publishEndDate'
:min='(new Date()).toISOString().substring(0, 10)'
2018-07-15 23:16:19 +00:00
color='primary'
2018-07-16 02:40:41 +00:00
reactive
scrollable
landscape
)
v-spacer
v-btn(
flat=''
color='primary'
@click='isPublishEndShown = false'
2019-06-15 21:05:56 +00:00
) {{$t('common:actions.cancel')}}
2018-07-16 02:40:41 +00:00
v-btn(
flat=''
color='primary'
@click='$refs.menuPublishEnd.save(publishEndDate)'
2019-06-15 21:05:56 +00:00
) {{$t('common:actions.ok')}}
2018-07-16 02:40:41 +00:00
page-selector(mode='create', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath')
2018-07-16 02:40:41 +00:00
v-tour(name='editorPropertiesTour', :steps='tourSteps')
2018-02-18 03:18:37 +00:00
</template>
<script>
2018-07-16 02:40:41 +00:00
import _ from 'lodash'
import { sync, get } from 'vuex-pathify'
2018-07-15 23:16:19 +00:00
2019-06-22 03:39:04 +00:00
/* global siteLangs, siteConfig */
2018-02-18 03:18:37 +00:00
export default {
2018-12-09 05:46:06 +00:00
props: {
value: {
type: Boolean,
default: false
}
},
2018-02-18 03:18:37 +00:00
data() {
return {
2018-07-15 23:16:19 +00:00
isPublishStartShown: false,
2018-07-16 02:40:41 +00:00
isPublishEndShown: false,
pageSelectorShown: false,
2019-06-22 03:39:04 +00:00
namespaces: siteLangs.length ? siteLangs.map(ns => ns.code) : [siteConfig.lang],
2018-07-16 02:40:41 +00:00
tourSteps: [
{
target: '.dialog-header',
content: `First-time tour help here. <strong>TODO</strong>!`
}
]
}
},
2018-07-15 23:16:19 +00:00
computed: {
2018-12-09 05:46:06 +00:00
isShown: {
get() { return this.value },
set(val) { this.$emit('input', val) }
},
2018-12-02 04:03:14 +00:00
darkMode: get('site/dark'),
mode: get('editor/mode'),
title: sync('page/title'),
description: sync('page/description'),
locale: sync('page/locale'),
tags: sync('page/tags'),
path: sync('page/path'),
isPublished: sync('page/isPublished'),
publishStartDate: sync('page/publishStartDate'),
publishEndDate: sync('page/publishEndDate')
2018-07-15 23:16:19 +00:00
},
2018-12-09 05:46:06 +00:00
watch: {
value(newValue, oldValue) {
2019-06-01 05:34:16 +00:00
if (newValue) {
2018-12-09 05:46:06 +00:00
_.delay(() => {
this.$refs.iptTitle.focus()
// this.$tours['editorPropertiesTour'].start()
}, 500)
}
}
},
methods: {
close() {
this.isShown = false
2018-07-22 04:29:39 +00:00
},
showPathSelector() {
this.pageSelectorShown = true
},
setPath({ path, locale }) {
this.locale = locale
this.path = path
2018-02-18 03:18:37 +00:00
}
}
}
</script>
<style lang='scss'>
</style>