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.

252 lines
7.3 KiB

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 Page Properties
  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 Page Info
  23. v-text-field(
  24. ref='iptTitle'
  25. outline
  26. background-color='grey lighten-2'
  27. label='Title'
  28. counter='255'
  29. v-model='title'
  30. )
  31. v-text-field(
  32. outline
  33. background-color='grey lighten-2'
  34. label='Short Description'
  35. counter='255'
  36. v-model='description'
  37. persistent-hint
  38. hint='Shown below the title'
  39. )
  40. v-divider
  41. v-card-text.grey(:class='darkMode ? `darken-3-d3` : `lighten-5`')
  42. v-subheader.pl-0 Path &amp; Categorization
  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='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='Path'
  61. append-icon='folder'
  62. v-model='path'
  63. hint='Do not include any leading or trailing slashes.'
  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='Tags'
  73. outline
  74. multiple
  75. v-model='tags'
  76. single-line
  77. hint='Use tags to categorize your pages and make them easier to find.'
  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 Publishing State
  83. v-container.pa-0(fluid, grid-list-lg)
  84. v-layout(row, wrap)
  85. v-flex(xs12, md4)
  86. v-switch(
  87. label='Published'
  88. v-model='isPublished'
  89. color='primary'
  90. hint='Unpublished pages can still be seen by users having write permissions on this page.'
  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='Publish starting on...'
  107. v-model='publishStartDate'
  108. prepend-icon='event'
  109. readonly
  110. outline
  111. background-color='grey lighten-2'
  112. clearable
  113. hint='Leave empty for no start date'
  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. ) Cancel
  131. v-btn(
  132. flat=''
  133. color='primary'
  134. @click='$refs.menuPublishStart.save(publishStartDate)'
  135. ) 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='Publish ending on...'
  150. v-model='publishEndDate'
  151. prepend-icon='event'
  152. readonly
  153. outline
  154. background-color='grey lighten-2'
  155. clearable
  156. hint='Leave empty for no end date'
  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. ) Cancel
  174. v-btn(
  175. flat=''
  176. color='primary'
  177. @click='$refs.menuPublishEnd.save(publishEndDate)'
  178. ) 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>