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.

105 lines
2.7 KiB

  1. <template lang='pug'>
  2. v-app(:dark='$vuetify.theme.dark').source
  3. nav-header
  4. v-content
  5. v-toolbar(color='primary', dark)
  6. i18next.subheading(v-if='versionId > 0', path='common:page.viewingSourceVersion', tag='div')
  7. strong(place='date', :title='$options.filters.moment(versionDate, `LLL`)') {{versionDate | moment('lll')}}
  8. strong(place='path') /{{path}}
  9. i18next.subheading(v-else, path='common:page.viewingSource', tag='div')
  10. strong(place='path') /{{path}}
  11. template(v-if='$vuetify.breakpoint.mdAndUp')
  12. v-spacer
  13. .caption.blue--text.text--lighten-3 {{$t('common:page.id', { id: pageId })}}
  14. .caption.blue--text.text--lighten-3.ml-4(v-if='versionId > 0') {{$t('common:page.versionId', { id: versionId })}}
  15. v-btn.ml-4(v-if='versionId > 0', depressed, color='blue darken-1', @click='goHistory')
  16. v-icon mdi-history
  17. v-btn.ml-4(depressed, color='blue darken-1', @click='goLive') {{$t('common:page.returnNormalView')}}
  18. v-card(tile)
  19. v-card-text
  20. v-card.grey.radius-7(flat, :class='$vuetify.theme.dark ? `darken-4` : `lighten-4`')
  21. v-card-text
  22. pre
  23. code
  24. slot
  25. nav-footer
  26. notify
  27. search-results
  28. </template>
  29. <script>
  30. export default {
  31. props: {
  32. pageId: {
  33. type: Number,
  34. default: 0
  35. },
  36. locale: {
  37. type: String,
  38. default: 'en'
  39. },
  40. path: {
  41. type: String,
  42. default: 'home'
  43. },
  44. versionId: {
  45. type: Number,
  46. default: 0
  47. },
  48. versionDate: {
  49. type: String,
  50. default: ''
  51. },
  52. effectivePermissions: {
  53. type: String,
  54. default: ''
  55. }
  56. },
  57. data() {
  58. return {}
  59. },
  60. created () {
  61. this.$store.commit('page/SET_ID', this.id)
  62. this.$store.commit('page/SET_LOCALE', this.locale)
  63. this.$store.commit('page/SET_PATH', this.path)
  64. this.$store.commit('page/SET_MODE', 'source')
  65. if (this.effectivePermissions) {
  66. this.$store.set('page/effectivePermissions',JSON.parse(Buffer.from(this.effectivePermissions, 'base64').toString()))
  67. }
  68. },
  69. methods: {
  70. goLive() {
  71. window.location.assign(`/${this.locale}/${this.path}`)
  72. },
  73. goHistory () {
  74. window.location.assign(`/h/${this.locale}/${this.path}`)
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang='scss'>
  80. .source {
  81. pre > code {
  82. box-shadow: none;
  83. color: mc('grey', '800');
  84. font-family: 'Roboto Mono', sans-serif;
  85. font-weight: 400;
  86. font-size: 1rem;
  87. @at-root .theme--dark.source pre > code {
  88. background-color: mc('grey', '900');
  89. color: mc('grey', '400');
  90. }
  91. &::before {
  92. display: none;
  93. }
  94. }
  95. }
  96. </style>