2
0

editor-modal-properties.vue 9.9 KB

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