editor-modal-properties.vue 7.7 KB

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