editor-modal-properties.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. full-width
  106. width='460px'
  107. :disabled='!isPublished || true'
  108. )
  109. template(v-slot:activator='{ on }')
  110. v-text-field(
  111. v-on='on'
  112. :label='$t(`editor:props.publishStart`)'
  113. v-model='publishStartDate'
  114. prepend-icon='mdi-calendar-check'
  115. readonly
  116. outlined
  117. clearable
  118. :hint='$t(`editor:props.publishStartHint`)'
  119. persistent-hint
  120. :disabled='!isPublished || true'
  121. )
  122. v-date-picker(
  123. v-model='publishStartDate'
  124. :min='(new Date()).toISOString().substring(0, 10)'
  125. color='primary'
  126. reactive
  127. scrollable
  128. landscape
  129. )
  130. v-spacer
  131. v-btn(
  132. flat=''
  133. color='primary'
  134. @click='isPublishStartShown = false'
  135. ) {{$t('common:actions.cancel')}}
  136. v-btn(
  137. flat=''
  138. color='primary'
  139. @click='$refs.menuPublishStart.save(publishStartDate)'
  140. ) {{$t('common:actions.ok')}}
  141. v-col(cols='6')
  142. v-dialog(
  143. ref='menuPublishEnd'
  144. :close-on-content-click='false'
  145. v-model='isPublishEndShown'
  146. :return-value.sync='publishEndDate'
  147. full-width
  148. width='460px'
  149. :disabled='!isPublished || true'
  150. )
  151. template(v-slot:activator='{ on }')
  152. v-text-field(
  153. v-on='on'
  154. :label='$t(`editor:props.publishEnd`)'
  155. v-model='publishEndDate'
  156. prepend-icon='mdi-calendar-remove'
  157. readonly
  158. outlined
  159. clearable
  160. :hint='$t(`editor:props.publishEndHint`)'
  161. persistent-hint
  162. :disabled='!isPublished || true'
  163. )
  164. v-date-picker(
  165. v-model='publishEndDate'
  166. :min='(new Date()).toISOString().substring(0, 10)'
  167. color='primary'
  168. reactive
  169. scrollable
  170. landscape
  171. )
  172. v-spacer
  173. v-btn(
  174. flat=''
  175. color='primary'
  176. @click='isPublishEndShown = false'
  177. ) {{$t('common:actions.cancel')}}
  178. v-btn(
  179. flat=''
  180. color='primary'
  181. @click='$refs.menuPublishEnd.save(publishEndDate)'
  182. ) {{$t('common:actions.ok')}}
  183. v-tab-item
  184. v-card-text
  185. .overline.pb-5 {{$t('editor:props.socialFeatures')}} #[v-chip.ml-3(label, color='grey', small, outlined).white--text coming soon]
  186. v-switch(
  187. :label='$t(`editor:props.allowComments`)'
  188. v-model='isPublished'
  189. color='primary'
  190. :hint='$t(`editor:props.allowCommentsHint`)'
  191. persistent-hint
  192. disabled
  193. inset
  194. )
  195. v-switch(
  196. :label='$t(`editor:props.allowRatings`)'
  197. v-model='isPublished'
  198. color='primary'
  199. :hint='$t(`editor:props.allowRatingsHint`)'
  200. persistent-hint
  201. disabled
  202. inset
  203. )
  204. v-switch(
  205. :label='$t(`editor:props.displayAuthor`)'
  206. v-model='isPublished'
  207. color='primary'
  208. :hint='$t(`editor:props.displayAuthorHint`)'
  209. persistent-hint
  210. disabled
  211. inset
  212. )
  213. v-switch(
  214. :label='$t(`editor:props.displaySharingBar`)'
  215. v-model='isPublished'
  216. color='primary'
  217. :hint='$t(`editor:props.displaySharingBarHint`)'
  218. persistent-hint
  219. disabled
  220. inset
  221. )
  222. page-selector(mode='create', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath')
  223. v-tour(name='editorPropertiesTour', :steps='tourSteps')
  224. </template>
  225. <script>
  226. import _ from 'lodash'
  227. import { sync, get } from 'vuex-pathify'
  228. /* global siteLangs, siteConfig */
  229. export default {
  230. props: {
  231. value: {
  232. type: Boolean,
  233. default: false
  234. }
  235. },
  236. data() {
  237. return {
  238. isPublishStartShown: false,
  239. isPublishEndShown: false,
  240. pageSelectorShown: false,
  241. namespaces: siteLangs.length ? siteLangs.map(ns => ns.code) : [siteConfig.lang],
  242. tourSteps: [
  243. {
  244. target: '.dialog-header',
  245. content: `First-time tour help here. <strong>TODO</strong>!`
  246. }
  247. ]
  248. }
  249. },
  250. computed: {
  251. isShown: {
  252. get() { return this.value },
  253. set(val) { this.$emit('input', val) }
  254. },
  255. darkMode: get('site/dark'),
  256. mode: get('editor/mode'),
  257. title: sync('page/title'),
  258. description: sync('page/description'),
  259. locale: sync('page/locale'),
  260. tags: sync('page/tags'),
  261. path: sync('page/path'),
  262. isPublished: sync('page/isPublished'),
  263. publishStartDate: sync('page/publishStartDate'),
  264. publishEndDate: sync('page/publishEndDate')
  265. },
  266. watch: {
  267. value(newValue, oldValue) {
  268. if (newValue) {
  269. _.delay(() => {
  270. this.$refs.iptTitle.focus()
  271. // this.$tours['editorPropertiesTour'].start()
  272. }, 500)
  273. }
  274. }
  275. },
  276. methods: {
  277. close() {
  278. this.isShown = false
  279. },
  280. showPathSelector() {
  281. this.pageSelectorShown = true
  282. },
  283. setPath({ path, locale }) {
  284. this.locale = locale
  285. this.path = path
  286. }
  287. }
  288. }
  289. </script>
  290. <style lang='scss'>
  291. </style>