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.

97 lines
2.4 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. },
  53. data() {
  54. return {}
  55. },
  56. created () {
  57. this.$store.commit('page/SET_ID', this.id)
  58. this.$store.commit('page/SET_LOCALE', this.locale)
  59. this.$store.commit('page/SET_PATH', this.path)
  60. this.$store.commit('page/SET_MODE', 'history')
  61. },
  62. methods: {
  63. goLive() {
  64. window.location.assign(`/${this.locale}/${this.path}`)
  65. },
  66. goHistory () {
  67. window.location.assign(`/h/${this.locale}/${this.path}`)
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang='scss'>
  73. .source {
  74. pre > code {
  75. box-shadow: none;
  76. color: mc('grey', '800');
  77. font-family: 'Roboto Mono', sans-serif;
  78. font-weight: 400;
  79. font-size: 1rem;
  80. @at-root .theme--dark.source pre > code {
  81. background-color: mc('grey', '900');
  82. color: mc('grey', '400');
  83. }
  84. &::before {
  85. display: none;
  86. }
  87. }
  88. }
  89. </style>