editor-modal-properties.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. :disabled='mode !== "create"'
  56. )
  57. v-flex(xs12, md10)
  58. v-text-field(
  59. outlined
  60. :label='$t(`editor:props.path`)'
  61. append-icon='mdi-folder-search'
  62. v-model='path'
  63. :hint='$t(`editor:props.pathHint`)'
  64. persistent-hint
  65. @click:append='showPathSelector'
  66. :disabled='mode !== "create"'
  67. )
  68. v-divider
  69. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d5` : `lighten-4`')
  70. .overline.pb-5 {{$t('editor:props.categorization')}}
  71. v-combobox(
  72. chips
  73. deletable-chips
  74. :label='$t(`editor:props.tags`)'
  75. outlined
  76. multiple
  77. v-model='tags'
  78. :hint='$t(`editor:props.tagsHint`)'
  79. persistent-hint
  80. clearable
  81. height='130'
  82. )
  83. v-tab-item
  84. v-card-text
  85. .overline.pb-5 {{$t('editor:props.publishState')}} #[v-chip.ml-3(label, color='grey', small, outlined).white--text coming soon]
  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. disabled
  93. inset
  94. )
  95. v-divider
  96. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d3` : `lighten-5`')
  97. v-container.pa-0(fluid, grid-list-lg)
  98. v-row
  99. v-col(cols='6')
  100. v-dialog(
  101. ref='menuPublishStart'
  102. :close-on-content-click='false'
  103. v-model='isPublishStartShown'
  104. :return-value.sync='publishStartDate'
  105. width='460px'
  106. :disabled='!isPublished || true'
  107. )
  108. template(v-slot:activator='{ on }')
  109. v-text-field(
  110. v-on='on'
  111. :label='$t(`editor:props.publishStart`)'
  112. v-model='publishStartDate'
  113. prepend-icon='mdi-calendar-check'
  114. readonly
  115. outlined
  116. clearable
  117. :hint='$t(`editor:props.publishStartHint`)'
  118. persistent-hint
  119. :disabled='!isPublished || true'
  120. )
  121. v-date-picker(
  122. v-model='publishStartDate'
  123. :min='(new Date()).toISOString().substring(0, 10)'
  124. color='primary'
  125. reactive
  126. scrollable
  127. landscape
  128. )
  129. v-spacer
  130. v-btn(
  131. flat=''
  132. color='primary'
  133. @click='isPublishStartShown = false'
  134. ) {{$t('common:actions.cancel')}}
  135. v-btn(
  136. flat=''
  137. color='primary'
  138. @click='$refs.menuPublishStart.save(publishStartDate)'
  139. ) {{$t('common:actions.ok')}}
  140. v-col(cols='6')
  141. v-dialog(
  142. ref='menuPublishEnd'
  143. :close-on-content-click='false'
  144. v-model='isPublishEndShown'
  145. :return-value.sync='publishEndDate'
  146. width='460px'
  147. :disabled='!isPublished || true'
  148. )
  149. template(v-slot:activator='{ on }')
  150. v-text-field(
  151. v-on='on'
  152. :label='$t(`editor:props.publishEnd`)'
  153. v-model='publishEndDate'
  154. prepend-icon='mdi-calendar-remove'
  155. readonly
  156. outlined
  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. v-tab-item
  182. v-card-text
  183. .overline.pb-5 {{$t('editor:props.socialFeatures')}} #[v-chip.ml-3(label, color='grey', small, outlined).white--text coming soon]
  184. v-switch(
  185. :label='$t(`editor:props.allowComments`)'
  186. v-model='isPublished'
  187. color='primary'
  188. :hint='$t(`editor:props.allowCommentsHint`)'
  189. persistent-hint
  190. disabled
  191. inset
  192. )
  193. v-switch(
  194. :label='$t(`editor:props.allowRatings`)'
  195. v-model='isPublished'
  196. color='primary'
  197. :hint='$t(`editor:props.allowRatingsHint`)'
  198. persistent-hint
  199. disabled
  200. inset
  201. )
  202. v-switch(
  203. :label='$t(`editor:props.displayAuthor`)'
  204. v-model='isPublished'
  205. color='primary'
  206. :hint='$t(`editor:props.displayAuthorHint`)'
  207. persistent-hint
  208. disabled
  209. inset
  210. )
  211. v-switch(
  212. :label='$t(`editor:props.displaySharingBar`)'
  213. v-model='isPublished'
  214. color='primary'
  215. :hint='$t(`editor:props.displaySharingBarHint`)'
  216. persistent-hint
  217. disabled
  218. inset
  219. )
  220. page-selector(mode='create', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath')
  221. </template>
  222. <script>
  223. import _ from 'lodash'
  224. import { sync, get } from 'vuex-pathify'
  225. /* global siteLangs, siteConfig */
  226. export default {
  227. props: {
  228. value: {
  229. type: Boolean,
  230. default: false
  231. }
  232. },
  233. data() {
  234. return {
  235. isPublishStartShown: false,
  236. isPublishEndShown: false,
  237. pageSelectorShown: false,
  238. namespaces: siteLangs.length ? siteLangs.map(ns => ns.code) : [siteConfig.lang]
  239. }
  240. },
  241. computed: {
  242. isShown: {
  243. get() { return this.value },
  244. set(val) { this.$emit('input', val) }
  245. },
  246. darkMode: get('site/dark'),
  247. mode: get('editor/mode'),
  248. title: sync('page/title'),
  249. description: sync('page/description'),
  250. locale: sync('page/locale'),
  251. tags: sync('page/tags'),
  252. path: sync('page/path'),
  253. isPublished: sync('page/isPublished'),
  254. publishStartDate: sync('page/publishStartDate'),
  255. publishEndDate: sync('page/publishEndDate')
  256. },
  257. watch: {
  258. value(newValue, oldValue) {
  259. if (newValue) {
  260. _.delay(() => {
  261. this.$refs.iptTitle.focus()
  262. // this.$tours['editorPropertiesTour'].start()
  263. }, 500)
  264. }
  265. }
  266. },
  267. methods: {
  268. close() {
  269. this.isShown = false
  270. },
  271. showPathSelector() {
  272. this.pageSelectorShown = true
  273. },
  274. setPath({ path, locale }) {
  275. this.locale = locale
  276. this.path = path
  277. }
  278. }
  279. }
  280. </script>
  281. <style lang='scss'>
  282. </style>