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.

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