2
0

editor-modal-properties.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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(disabled) {{$t('editor:props.scripts')}}
  24. v-tab {{$t('editor:props.social')}}
  25. v-tab-item
  26. v-card-text.pt-5
  27. .overline.pb-5 {{$t('editor:props.pageInfo')}}
  28. v-text-field(
  29. ref='iptTitle'
  30. outlined
  31. :label='$t(`editor:props.title`)'
  32. counter='255'
  33. v-model='title'
  34. )
  35. v-text-field(
  36. outlined
  37. :label='$t(`editor:props.shortDescription`)'
  38. counter='255'
  39. v-model='description'
  40. persistent-hint
  41. :hint='$t(`editor:props.shortDescriptionHint`)'
  42. )
  43. v-divider
  44. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d3` : `lighten-5`')
  45. .overline.pb-5 {{$t('editor:props.path')}}
  46. v-container.pa-0(fluid, grid-list-lg)
  47. v-layout(row, wrap)
  48. v-flex(xs12, md2)
  49. v-select(
  50. outlined
  51. :label='$t(`editor:props.locale`)'
  52. suffix='/'
  53. :items='namespaces'
  54. v-model='locale'
  55. hide-details
  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. )
  67. v-divider
  68. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d5` : `lighten-4`')
  69. .overline.pb-5 {{$t('editor:props.categorization')}}
  70. v-combobox(
  71. chips
  72. deletable-chips
  73. :label='$t(`editor:props.tags`)'
  74. outlined
  75. multiple
  76. v-model='tags'
  77. :hint='$t(`editor:props.tagsHint`)'
  78. persistent-hint
  79. clearable
  80. height='130'
  81. )
  82. v-tab-item
  83. v-card-text
  84. .overline.pb-5 {{$t('editor:props.publishState')}} #[v-chip.ml-3(label, color='grey', small, outlined).white--text coming soon]
  85. v-switch(
  86. :label='$t(`editor:props.publishToggle`)'
  87. v-model='isPublished'
  88. color='primary'
  89. :hint='$t(`editor:props.publishToggleHint`)'
  90. persistent-hint
  91. disabled
  92. inset
  93. )
  94. v-divider
  95. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d3` : `lighten-5`')
  96. v-container.pa-0(fluid, grid-list-lg)
  97. v-row
  98. v-col(cols='6')
  99. v-dialog(
  100. ref='menuPublishStart'
  101. :close-on-content-click='false'
  102. v-model='isPublishStartShown'
  103. :return-value.sync='publishStartDate'
  104. width='460px'
  105. :disabled='!isPublished || true'
  106. )
  107. template(v-slot:activator='{ on }')
  108. v-text-field(
  109. v-on='on'
  110. :label='$t(`editor:props.publishStart`)'
  111. v-model='publishStartDate'
  112. prepend-icon='mdi-calendar-check'
  113. readonly
  114. outlined
  115. clearable
  116. :hint='$t(`editor:props.publishStartHint`)'
  117. persistent-hint
  118. :disabled='!isPublished || true'
  119. )
  120. v-date-picker(
  121. v-model='publishStartDate'
  122. :min='(new Date()).toISOString().substring(0, 10)'
  123. color='primary'
  124. reactive
  125. scrollable
  126. landscape
  127. )
  128. v-spacer
  129. v-btn(
  130. flat=''
  131. color='primary'
  132. @click='isPublishStartShown = false'
  133. ) {{$t('common:actions.cancel')}}
  134. v-btn(
  135. flat=''
  136. color='primary'
  137. @click='$refs.menuPublishStart.save(publishStartDate)'
  138. ) {{$t('common:actions.ok')}}
  139. v-col(cols='6')
  140. v-dialog(
  141. ref='menuPublishEnd'
  142. :close-on-content-click='false'
  143. v-model='isPublishEndShown'
  144. :return-value.sync='publishEndDate'
  145. width='460px'
  146. :disabled='!isPublished || true'
  147. )
  148. template(v-slot:activator='{ on }')
  149. v-text-field(
  150. v-on='on'
  151. :label='$t(`editor:props.publishEnd`)'
  152. v-model='publishEndDate'
  153. prepend-icon='mdi-calendar-remove'
  154. readonly
  155. outlined
  156. clearable
  157. :hint='$t(`editor:props.publishEndHint`)'
  158. persistent-hint
  159. :disabled='!isPublished || true'
  160. )
  161. v-date-picker(
  162. v-model='publishEndDate'
  163. :min='(new Date()).toISOString().substring(0, 10)'
  164. color='primary'
  165. reactive
  166. scrollable
  167. landscape
  168. )
  169. v-spacer
  170. v-btn(
  171. flat=''
  172. color='primary'
  173. @click='isPublishEndShown = false'
  174. ) {{$t('common:actions.cancel')}}
  175. v-btn(
  176. flat=''
  177. color='primary'
  178. @click='$refs.menuPublishEnd.save(publishEndDate)'
  179. ) {{$t('common:actions.ok')}}
  180. v-tab-item
  181. v-card-text
  182. .overline.pb-3 {{$t('editor:props.js')}}
  183. v-textarea(
  184. outlined
  185. rows='5'
  186. :hint='$t(`editor:props.jsHint`)'
  187. persistent-hint
  188. )
  189. v-divider
  190. v-card-text.grey.pt-5(:class='darkMode ? `darken-3-d3` : `lighten-5`')
  191. .overline.pb-3 {{$t('editor:props.css')}}
  192. v-textarea(
  193. outlined
  194. rows='5'
  195. :hint='$t(`editor:props.cssHint`)'
  196. persistent-hint
  197. )
  198. v-tab-item
  199. v-card-text
  200. .overline.pb-5 {{$t('editor:props.socialFeatures')}} #[v-chip.ml-3(label, color='grey', small, outlined).white--text coming soon]
  201. v-switch(
  202. :label='$t(`editor:props.allowComments`)'
  203. v-model='isPublished'
  204. color='primary'
  205. :hint='$t(`editor:props.allowCommentsHint`)'
  206. persistent-hint
  207. disabled
  208. inset
  209. )
  210. v-switch(
  211. :label='$t(`editor:props.allowRatings`)'
  212. v-model='isPublished'
  213. color='primary'
  214. :hint='$t(`editor:props.allowRatingsHint`)'
  215. persistent-hint
  216. disabled
  217. inset
  218. )
  219. v-switch(
  220. :label='$t(`editor:props.displayAuthor`)'
  221. v-model='isPublished'
  222. color='primary'
  223. :hint='$t(`editor:props.displayAuthorHint`)'
  224. persistent-hint
  225. disabled
  226. inset
  227. )
  228. v-switch(
  229. :label='$t(`editor:props.displaySharingBar`)'
  230. v-model='isPublished'
  231. color='primary'
  232. :hint='$t(`editor:props.displaySharingBarHint`)'
  233. persistent-hint
  234. disabled
  235. inset
  236. )
  237. page-selector(:mode='pageSelectorMode', v-model='pageSelectorShown', :path='path', :locale='locale', :open-handler='setPath')
  238. </template>
  239. <script>
  240. import _ from 'lodash'
  241. import { sync, get } from 'vuex-pathify'
  242. /* global siteLangs, siteConfig */
  243. export default {
  244. props: {
  245. value: {
  246. type: Boolean,
  247. default: false
  248. }
  249. },
  250. data() {
  251. return {
  252. isPublishStartShown: false,
  253. isPublishEndShown: false,
  254. pageSelectorShown: false,
  255. namespaces: siteLangs.length ? siteLangs.map(ns => ns.code) : [siteConfig.lang]
  256. }
  257. },
  258. computed: {
  259. isShown: {
  260. get() { return this.value },
  261. set(val) { this.$emit('input', val) }
  262. },
  263. darkMode: get('site/dark'),
  264. mode: get('editor/mode'),
  265. title: sync('page/title'),
  266. description: sync('page/description'),
  267. locale: sync('page/locale'),
  268. tags: sync('page/tags'),
  269. path: sync('page/path'),
  270. isPublished: sync('page/isPublished'),
  271. publishStartDate: sync('page/publishStartDate'),
  272. publishEndDate: sync('page/publishEndDate'),
  273. pageSelectorMode () {
  274. return (this.mode === 'create') ? 'create' : 'move'
  275. }
  276. },
  277. watch: {
  278. value(newValue, oldValue) {
  279. if (newValue) {
  280. _.delay(() => {
  281. this.$refs.iptTitle.focus()
  282. // this.$tours['editorPropertiesTour'].start()
  283. }, 500)
  284. }
  285. }
  286. },
  287. methods: {
  288. close() {
  289. this.isShown = false
  290. },
  291. showPathSelector() {
  292. this.pageSelectorShown = true
  293. },
  294. setPath({ path, locale }) {
  295. this.locale = locale
  296. this.path = path
  297. }
  298. }
  299. }
  300. </script>
  301. <style lang='scss'>
  302. </style>