You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

256 lines
7.9 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  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='`COMING SOON - ` + $t(`editor:props.tagsHint`)'
  78. persistent-hint
  79. disabled
  80. )
  81. v-divider
  82. v-card-text.pb-5.grey(:class='darkMode ? `darken-3-d5` : `lighten-4`')
  83. v-subheader.pl-0 {{$t('editor:props.publishState')}} #[v-chip.ml-3(label, color='grey', small, outline).white--text coming soon]
  84. v-container.pa-0(fluid, grid-list-lg)
  85. v-layout(row, wrap)
  86. v-flex(xs12, md4)
  87. v-switch(
  88. :label='$t(`editor:props.publishToggle`)'
  89. v-model='isPublished'
  90. color='primary'
  91. :hint='$t(`editor:props.publishToggleHint`)'
  92. persistent-hint
  93. disabled
  94. )
  95. v-flex(xs12, md4)
  96. v-dialog(
  97. ref='menuPublishStart'
  98. lazy
  99. :close-on-content-click='false'
  100. v-model='isPublishStartShown'
  101. :return-value.sync='publishStartDate'
  102. full-width
  103. width='460px'
  104. :disabled='!isPublished || true'
  105. )
  106. v-text-field(
  107. slot='activator'
  108. :label='$t(`editor:props.publishStart`)'
  109. v-model='publishStartDate'
  110. prepend-icon='event'
  111. readonly
  112. outline
  113. background-color='grey lighten-2'
  114. clearable
  115. :hint='$t(`editor:props.publishStartHint`)'
  116. persistent-hint
  117. :disabled='!isPublished || true'
  118. )
  119. v-date-picker(
  120. v-model='publishStartDate'
  121. :min='(new Date()).toISOString().substring(0, 10)'
  122. color='primary'
  123. reactive
  124. scrollable
  125. landscape
  126. )
  127. v-spacer
  128. v-btn(
  129. flat=''
  130. color='primary'
  131. @click='isPublishStartShown = false'
  132. ) {{$t('common:actions.cancel')}}
  133. v-btn(
  134. flat=''
  135. color='primary'
  136. @click='$refs.menuPublishStart.save(publishStartDate)'
  137. ) {{$t('common:actions.ok')}}
  138. v-flex(xs12, md4)
  139. v-dialog(
  140. ref='menuPublishEnd'
  141. lazy
  142. :close-on-content-click='false'
  143. v-model='isPublishEndShown'
  144. :return-value.sync='publishEndDate'
  145. full-width
  146. width='460px'
  147. :disabled='!isPublished || true'
  148. )
  149. v-text-field(
  150. slot='activator'
  151. :label='$t(`editor:props.publishEnd`)'
  152. v-model='publishEndDate'
  153. prepend-icon='event'
  154. readonly
  155. outline
  156. background-color='grey lighten-2'
  157. clearable
  158. :hint='$t(`editor:props.publishEndHint`)'
  159. persistent-hint
  160. :disabled='!isPublished || true'
  161. )
  162. v-date-picker(
  163. v-model='publishEndDate'
  164. :min='(new Date()).toISOString().substring(0, 10)'
  165. color='primary'
  166. reactive
  167. scrollable
  168. landscape
  169. )
  170. v-spacer
  171. v-btn(
  172. flat=''
  173. color='primary'
  174. @click='isPublishEndShown = false'
  175. ) {{$t('common:actions.cancel')}}
  176. v-btn(
  177. flat=''
  178. color='primary'
  179. @click='$refs.menuPublishEnd.save(publishEndDate)'
  180. ) {{$t('common:actions.ok')}}
  181. page-selector(mode='create', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath')
  182. v-tour(name='editorPropertiesTour', :steps='tourSteps')
  183. </template>
  184. <script>
  185. import _ from 'lodash'
  186. import { sync, get } from 'vuex-pathify'
  187. /* global siteLangs, siteConfig */
  188. export default {
  189. props: {
  190. value: {
  191. type: Boolean,
  192. default: false
  193. }
  194. },
  195. data() {
  196. return {
  197. isPublishStartShown: false,
  198. isPublishEndShown: false,
  199. pageSelectorShown: false,
  200. namespaces: siteLangs.length ? siteLangs.map(ns => ns.code) : [siteConfig.lang],
  201. tourSteps: [
  202. {
  203. target: '.dialog-header',
  204. content: `First-time tour help here. <strong>TODO</strong>!`
  205. }
  206. ]
  207. }
  208. },
  209. computed: {
  210. isShown: {
  211. get() { return this.value },
  212. set(val) { this.$emit('input', val) }
  213. },
  214. darkMode: get('site/dark'),
  215. mode: get('editor/mode'),
  216. title: sync('page/title'),
  217. description: sync('page/description'),
  218. locale: sync('page/locale'),
  219. tags: sync('page/tags'),
  220. path: sync('page/path'),
  221. isPublished: sync('page/isPublished'),
  222. publishStartDate: sync('page/publishStartDate'),
  223. publishEndDate: sync('page/publishEndDate')
  224. },
  225. watch: {
  226. value(newValue, oldValue) {
  227. if (newValue) {
  228. _.delay(() => {
  229. this.$refs.iptTitle.focus()
  230. // this.$tours['editorPropertiesTour'].start()
  231. }, 500)
  232. }
  233. }
  234. },
  235. methods: {
  236. close() {
  237. this.isShown = false
  238. },
  239. showPathSelector() {
  240. this.pageSelectorShown = true
  241. },
  242. setPath({ path, locale }) {
  243. this.locale = locale
  244. this.path = path
  245. }
  246. }
  247. }
  248. </script>
  249. <style lang='scss'>
  250. </style>