editor-modal-properties.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template lang='pug'>
  2. v-dialog(
  3. v-model='isShown'
  4. persistent
  5. lazy
  6. width='1100'
  7. :fullscreen='$vuetify.breakpoint.smAndDown'
  8. )
  9. .dialog-header
  10. v-icon(color='white') mdi-tag-text-outline
  11. .subheading.white--text.ml-3 {{$t('editor:props.pageProperties')}}
  12. v-spacer
  13. v-btn.mx-0(
  14. outlined
  15. dark
  16. @click.native='close'
  17. )
  18. v-icon(left) mdi-check
  19. span {{ $t('common:actions.ok') }}
  20. v-card.wiki-form(tile)
  21. v-card-text
  22. .overline.pb-5 {{$t('editor:props.pageInfo')}}
  23. v-text-field(
  24. ref='iptTitle'
  25. outlined
  26. :label='$t(`editor:props.title`)'
  27. counter='255'
  28. v-model='title'
  29. )
  30. v-text-field(
  31. outlined
  32. :label='$t(`editor:props.shortDescription`)'
  33. counter='255'
  34. v-model='description'
  35. persistent-hint
  36. :hint='$t(`editor:props.shortDescriptionHint`)'
  37. )
  38. v-divider
  39. v-card-text.grey(:class='darkMode ? `darken-3-d3` : `lighten-5`')
  40. .overline.pb-5 {{$t('editor:props.pathCategorization')}}
  41. v-container.pa-0(fluid, grid-list-lg)
  42. v-layout(row, wrap)
  43. v-flex(xs12, md2)
  44. v-select(
  45. outlined
  46. :label='$t(`editor:props.locale`)'
  47. suffix='/'
  48. :items='namespaces'
  49. v-model='locale'
  50. hide-details
  51. :disabled='mode !== "create"'
  52. )
  53. v-flex(xs12, md10)
  54. v-text-field(
  55. outlined
  56. :label='$t(`editor:props.path`)'
  57. append-icon='mdi-folder-search'
  58. v-model='path'
  59. :hint='$t(`editor:props.pathHint`)'
  60. persistent-hint
  61. @click:append='showPathSelector'
  62. :disabled='mode !== "create"'
  63. )
  64. v-combobox(
  65. chips
  66. deletable-chips
  67. :label='$t(`editor:props.tags`)'
  68. outlined
  69. multiple
  70. v-model='tags'
  71. single-line
  72. :hint='`COMING SOON - ` + $t(`editor:props.tagsHint`)'
  73. persistent-hint
  74. disabled
  75. )
  76. v-divider
  77. v-card-text.pb-5.grey(:class='darkMode ? `darken-3-d5` : `lighten-4`')
  78. .overline.pb-5 {{$t('editor:props.publishState')}} #[v-chip.ml-3(label, color='grey', small, outline).white--text coming soon]
  79. v-container.pa-0(fluid, grid-list-lg)
  80. v-layout(row, wrap)
  81. v-flex(xs12, md4)
  82. v-switch(
  83. :label='$t(`editor:props.publishToggle`)'
  84. v-model='isPublished'
  85. color='primary'
  86. :hint='$t(`editor:props.publishToggleHint`)'
  87. persistent-hint
  88. disabled
  89. )
  90. v-flex(xs12, md4)
  91. v-dialog(
  92. ref='menuPublishStart'
  93. lazy
  94. :close-on-content-click='false'
  95. v-model='isPublishStartShown'
  96. :return-value.sync='publishStartDate'
  97. full-width
  98. width='460px'
  99. :disabled='!isPublished || true'
  100. )
  101. v-text-field(
  102. slot='activator'
  103. :label='$t(`editor:props.publishStart`)'
  104. v-model='publishStartDate'
  105. prepend-icon='mdi-calendar-check'
  106. readonly
  107. outlined
  108. clearable
  109. :hint='$t(`editor:props.publishStartHint`)'
  110. persistent-hint
  111. :disabled='!isPublished || true'
  112. )
  113. v-date-picker(
  114. v-model='publishStartDate'
  115. :min='(new Date()).toISOString().substring(0, 10)'
  116. color='primary'
  117. reactive
  118. scrollable
  119. landscape
  120. )
  121. v-spacer
  122. v-btn(
  123. flat=''
  124. color='primary'
  125. @click='isPublishStartShown = false'
  126. ) {{$t('common:actions.cancel')}}
  127. v-btn(
  128. flat=''
  129. color='primary'
  130. @click='$refs.menuPublishStart.save(publishStartDate)'
  131. ) {{$t('common:actions.ok')}}
  132. v-flex(xs12, md4)
  133. v-dialog(
  134. ref='menuPublishEnd'
  135. lazy
  136. :close-on-content-click='false'
  137. v-model='isPublishEndShown'
  138. :return-value.sync='publishEndDate'
  139. full-width
  140. width='460px'
  141. :disabled='!isPublished || true'
  142. )
  143. v-text-field(
  144. slot='activator'
  145. :label='$t(`editor:props.publishEnd`)'
  146. v-model='publishEndDate'
  147. prepend-icon='mdi-calendar-remove'
  148. readonly
  149. outlined
  150. clearable
  151. :hint='$t(`editor:props.publishEndHint`)'
  152. persistent-hint
  153. :disabled='!isPublished || true'
  154. )
  155. v-date-picker(
  156. v-model='publishEndDate'
  157. :min='(new Date()).toISOString().substring(0, 10)'
  158. color='primary'
  159. reactive
  160. scrollable
  161. landscape
  162. )
  163. v-spacer
  164. v-btn(
  165. flat=''
  166. color='primary'
  167. @click='isPublishEndShown = false'
  168. ) {{$t('common:actions.cancel')}}
  169. v-btn(
  170. flat=''
  171. color='primary'
  172. @click='$refs.menuPublishEnd.save(publishEndDate)'
  173. ) {{$t('common:actions.ok')}}
  174. page-selector(mode='create', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath')
  175. v-tour(name='editorPropertiesTour', :steps='tourSteps')
  176. </template>
  177. <script>
  178. import _ from 'lodash'
  179. import { sync, get } from 'vuex-pathify'
  180. /* global siteLangs, siteConfig */
  181. export default {
  182. props: {
  183. value: {
  184. type: Boolean,
  185. default: false
  186. }
  187. },
  188. data() {
  189. return {
  190. isPublishStartShown: false,
  191. isPublishEndShown: false,
  192. pageSelectorShown: false,
  193. namespaces: siteLangs.length ? siteLangs.map(ns => ns.code) : [siteConfig.lang],
  194. tourSteps: [
  195. {
  196. target: '.dialog-header',
  197. content: `First-time tour help here. <strong>TODO</strong>!`
  198. }
  199. ]
  200. }
  201. },
  202. computed: {
  203. isShown: {
  204. get() { return this.value },
  205. set(val) { this.$emit('input', val) }
  206. },
  207. darkMode: get('site/dark'),
  208. mode: get('editor/mode'),
  209. title: sync('page/title'),
  210. description: sync('page/description'),
  211. locale: sync('page/locale'),
  212. tags: sync('page/tags'),
  213. path: sync('page/path'),
  214. isPublished: sync('page/isPublished'),
  215. publishStartDate: sync('page/publishStartDate'),
  216. publishEndDate: sync('page/publishEndDate')
  217. },
  218. watch: {
  219. value(newValue, oldValue) {
  220. if (newValue) {
  221. _.delay(() => {
  222. this.$refs.iptTitle.focus()
  223. // this.$tours['editorPropertiesTour'].start()
  224. }, 500)
  225. }
  226. }
  227. },
  228. methods: {
  229. close() {
  230. this.isShown = false
  231. },
  232. showPathSelector() {
  233. this.pageSelectorShown = true
  234. },
  235. setPath({ path, locale }) {
  236. this.locale = locale
  237. this.path = path
  238. }
  239. }
  240. }
  241. </script>
  242. <style lang='scss'>
  243. </style>