editor-modal-properties.vue 7.6 KB

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