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.

102 lines
2.5 KiB

  1. <template lang='pug'>
  2. v-app(:dark='darkMode').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='darkMode ? `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. import { get } from 'vuex-pathify'
  31. export default {
  32. props: {
  33. pageId: {
  34. type: Number,
  35. default: 0
  36. },
  37. locale: {
  38. type: String,
  39. default: 'en'
  40. },
  41. path: {
  42. type: String,
  43. default: 'home'
  44. },
  45. versionId: {
  46. type: Number,
  47. default: 0
  48. },
  49. versionDate: {
  50. type: String,
  51. default: ''
  52. }
  53. },
  54. data() {
  55. return {}
  56. },
  57. computed: {
  58. darkMode: get('site/dark')
  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', 'history')
  65. },
  66. methods: {
  67. goLive() {
  68. window.location.assign(`/${this.locale}/${this.path}`)
  69. },
  70. goHistory () {
  71. window.location.assign(`/h/${this.locale}/${this.path}`)
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang='scss'>
  77. .source {
  78. pre > code {
  79. box-shadow: none;
  80. color: mc('grey', '800');
  81. font-family: 'Roboto Mono', sans-serif;
  82. font-weight: 400;
  83. font-size: 1rem;
  84. @at-root .theme--dark.source pre > code {
  85. background-color: mc('grey', '900');
  86. color: mc('grey', '400');
  87. }
  88. &::before {
  89. display: none;
  90. }
  91. }
  92. }
  93. </style>