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.

290 lines
9.6 KiB

6 years ago
5 years ago
5 years ago
6 years ago
  1. <template lang='pug'>
  2. v-dialog(
  3. v-model='isShown'
  4. persistent
  5. width='1000'
  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(tile)
  20. v-tabs(color='white', background-color='blue darken-1', dark, centered)
  21. v-tab {{$t('editor:props.info')}}
  22. v-tab {{$t('editor:props.scheduling')}}
  23. v-tab {{$t('editor:props.social')}}
  24. v-tab-item
  25. v-card-text.pt-5
  26. .overline.pb-5 {{$t('editor:props.pageInfo')}}
  27. v-text-field(
  28. ref='iptTitle'
  29. outlined
  30. :label='$t(`editor:props.title`)'
  31. counter='255'
  32. v-model='title'
  33. )
  34. v-text-field(
  35. outlined
  36. :label='$t(`editor:props.shortDescription`)'
  37. counter='255'
  38. v-model='description'
  39. persistent-hint
  40. :hint='$t(`editor:props.shortDescriptionHint`)'
  41. )
  42. v-divider
  43. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d3` : `lighten-5`')
  44. .overline.pb-5 {{$t('editor:props.path')}}
  45. v-container.pa-0(fluid, grid-list-lg)
  46. v-layout(row, wrap)
  47. v-flex(xs12, md2)
  48. v-select(
  49. outlined
  50. :label='$t(`editor:props.locale`)'
  51. suffix='/'
  52. :items='namespaces'
  53. v-model='locale'
  54. hide-details
  55. )
  56. v-flex(xs12, md10)
  57. v-text-field(
  58. outlined
  59. :label='$t(`editor:props.path`)'
  60. append-icon='mdi-folder-search'
  61. v-model='path'
  62. :hint='$t(`editor:props.pathHint`)'
  63. persistent-hint
  64. @click:append='showPathSelector'
  65. )
  66. v-divider
  67. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d5` : `lighten-4`')
  68. .overline.pb-5 {{$t('editor:props.categorization')}}
  69. v-combobox(
  70. chips
  71. deletable-chips
  72. :label='$t(`editor:props.tags`)'
  73. outlined
  74. multiple
  75. v-model='tags'
  76. :hint='$t(`editor:props.tagsHint`)'
  77. persistent-hint
  78. clearable
  79. height='130'
  80. )
  81. v-tab-item
  82. v-card-text
  83. .overline.pb-5 {{$t('editor:props.publishState')}} #[v-chip.ml-3(label, color='grey', small, outlined).white--text coming soon]
  84. v-switch(
  85. :label='$t(`editor:props.publishToggle`)'
  86. v-model='isPublished'
  87. color='primary'
  88. :hint='$t(`editor:props.publishToggleHint`)'
  89. persistent-hint
  90. disabled
  91. inset
  92. )
  93. v-divider
  94. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d3` : `lighten-5`')
  95. v-container.pa-0(fluid, grid-list-lg)
  96. v-row
  97. v-col(cols='6')
  98. v-dialog(
  99. ref='menuPublishStart'
  100. :close-on-content-click='false'
  101. v-model='isPublishStartShown'
  102. :return-value.sync='publishStartDate'
  103. width='460px'
  104. :disabled='!isPublished || true'
  105. )
  106. template(v-slot:activator='{ on }')
  107. v-text-field(
  108. v-on='on'
  109. :label='$t(`editor:props.publishStart`)'
  110. v-model='publishStartDate'
  111. prepend-icon='mdi-calendar-check'
  112. readonly
  113. outlined
  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-col(cols='6')
  139. v-dialog(
  140. ref='menuPublishEnd'
  141. :close-on-content-click='false'
  142. v-model='isPublishEndShown'
  143. :return-value.sync='publishEndDate'
  144. width='460px'
  145. :disabled='!isPublished || true'
  146. )
  147. template(v-slot:activator='{ on }')
  148. v-text-field(
  149. v-on='on'
  150. :label='$t(`editor:props.publishEnd`)'
  151. v-model='publishEndDate'
  152. prepend-icon='mdi-calendar-remove'
  153. readonly
  154. outlined
  155. clearable
  156. :hint='$t(`editor:props.publishEndHint`)'
  157. persistent-hint
  158. :disabled='!isPublished || true'
  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. v-tab-item
  180. v-card-text
  181. .overline.pb-5 {{$t('editor:props.socialFeatures')}} #[v-chip.ml-3(label, color='grey', small, outlined).white--text coming soon]
  182. v-switch(
  183. :label='$t(`editor:props.allowComments`)'
  184. v-model='isPublished'
  185. color='primary'
  186. :hint='$t(`editor:props.allowCommentsHint`)'
  187. persistent-hint
  188. disabled
  189. inset
  190. )
  191. v-switch(
  192. :label='$t(`editor:props.allowRatings`)'
  193. v-model='isPublished'
  194. color='primary'
  195. :hint='$t(`editor:props.allowRatingsHint`)'
  196. persistent-hint
  197. disabled
  198. inset
  199. )
  200. v-switch(
  201. :label='$t(`editor:props.displayAuthor`)'
  202. v-model='isPublished'
  203. color='primary'
  204. :hint='$t(`editor:props.displayAuthorHint`)'
  205. persistent-hint
  206. disabled
  207. inset
  208. )
  209. v-switch(
  210. :label='$t(`editor:props.displaySharingBar`)'
  211. v-model='isPublished'
  212. color='primary'
  213. :hint='$t(`editor:props.displaySharingBarHint`)'
  214. persistent-hint
  215. disabled
  216. inset
  217. )
  218. page-selector(:mode='pageSelectorMode', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath')
  219. </template>
  220. <script>
  221. import _ from 'lodash'
  222. import { sync, get } from 'vuex-pathify'
  223. /* global siteLangs, siteConfig */
  224. export default {
  225. props: {
  226. value: {
  227. type: Boolean,
  228. default: false
  229. }
  230. },
  231. data() {
  232. return {
  233. isPublishStartShown: false,
  234. isPublishEndShown: false,
  235. pageSelectorShown: false,
  236. namespaces: siteLangs.length ? siteLangs.map(ns => ns.code) : [siteConfig.lang]
  237. }
  238. },
  239. computed: {
  240. isShown: {
  241. get() { return this.value },
  242. set(val) { this.$emit('input', val) }
  243. },
  244. darkMode: get('site/dark'),
  245. mode: get('editor/mode'),
  246. title: sync('page/title'),
  247. description: sync('page/description'),
  248. locale: sync('page/locale'),
  249. tags: sync('page/tags'),
  250. path: sync('page/path'),
  251. isPublished: sync('page/isPublished'),
  252. publishStartDate: sync('page/publishStartDate'),
  253. publishEndDate: sync('page/publishEndDate'),
  254. pageSelectorMode () {
  255. return (this.mode === 'create') ? 'create' : 'move'
  256. }
  257. },
  258. watch: {
  259. value(newValue, oldValue) {
  260. if (newValue) {
  261. _.delay(() => {
  262. this.$refs.iptTitle.focus()
  263. // this.$tours['editorPropertiesTour'].start()
  264. }, 500)
  265. }
  266. }
  267. },
  268. methods: {
  269. close() {
  270. this.isShown = false
  271. },
  272. showPathSelector() {
  273. this.pageSelectorShown = true
  274. },
  275. setPath({ path, locale }) {
  276. this.locale = locale
  277. this.path = path
  278. }
  279. }
  280. }
  281. </script>
  282. <style lang='scss'>
  283. </style>