wikijs-fork/client/components/source.vue

106 lines
2.7 KiB
Vue
Raw Normal View History

2018-11-25 06:28:20 +00:00
<template lang='pug'>
2020-05-08 22:48:07 +00:00
v-app(:dark='$vuetify.theme.dark').source
2018-11-25 06:28:20 +00:00
nav-header
v-content
v-toolbar(color='primary', dark)
2020-02-29 23:57:54 +00:00
i18next.subheading(v-if='versionId > 0', path='common:page.viewingSourceVersion', tag='div')
strong(place='date', :title='$options.filters.moment(versionDate, `LLL`)') {{versionDate | moment('lll')}}
strong(place='path') /{{path}}
i18next.subheading(v-else, path='common:page.viewingSource', tag='div')
2019-06-22 03:57:37 +00:00
strong(place='path') /{{path}}
template(v-if='$vuetify.breakpoint.mdAndUp')
v-spacer
2019-06-16 01:45:53 +00:00
.caption.blue--text.text--lighten-3 {{$t('common:page.id', { id: pageId })}}
2020-02-29 23:57:54 +00:00
.caption.blue--text.text--lighten-3.ml-4(v-if='versionId > 0') {{$t('common:page.versionId', { id: versionId })}}
v-btn.ml-4(v-if='versionId > 0', depressed, color='blue darken-1', @click='goHistory')
v-icon mdi-history
2019-06-16 01:45:53 +00:00
v-btn.ml-4(depressed, color='blue darken-1', @click='goLive') {{$t('common:page.returnNormalView')}}
2018-11-25 06:28:20 +00:00
v-card(tile)
v-card-text
2020-05-08 22:48:07 +00:00
v-card.grey.radius-7(flat, :class='$vuetify.theme.dark ? `darken-4` : `lighten-4`')
2018-11-25 06:28:20 +00:00
v-card-text
pre
slot
2018-11-25 06:28:20 +00:00
nav-footer
notify
search-results
2018-11-25 06:28:20 +00:00
</template>
<script>
export default {
props: {
pageId: {
type: Number,
default: 0
},
locale: {
type: String,
default: 'en'
},
path: {
type: String,
default: 'home'
2020-02-29 23:57:54 +00:00
},
versionId: {
type: Number,
default: 0
},
versionDate: {
type: String,
default: ''
},
effectivePermissions: {
type: String,
default: ''
2018-11-25 06:28:20 +00:00
}
},
data() {
return {}
},
created () {
this.$store.commit('page/SET_ID', this.id)
this.$store.commit('page/SET_LOCALE', this.locale)
this.$store.commit('page/SET_PATH', this.path)
this.$store.commit('page/SET_MODE', 'source')
if (this.effectivePermissions) {
this.$store.set('page/effectivePermissions', JSON.parse(Buffer.from(this.effectivePermissions, 'base64').toString()))
}
2018-11-25 06:28:20 +00:00
},
methods: {
goLive() {
2020-02-29 23:57:54 +00:00
window.location.assign(`/${this.locale}/${this.path}`)
},
goHistory () {
window.location.assign(`/h/${this.locale}/${this.path}`)
2018-11-25 06:28:20 +00:00
}
}
}
</script>
<style lang='scss'>
.source {
pre > code {
box-shadow: none;
background-color: transparent;
2018-11-25 06:28:20 +00:00
color: mc('grey', '800');
2019-05-31 16:41:25 +00:00
font-family: 'Roboto Mono', sans-serif;
2018-11-25 06:28:20 +00:00
font-weight: 400;
font-size: 1rem;
2018-12-02 04:03:14 +00:00
@at-root .theme--dark.source pre > code {
background-color: mc('grey', '900');
color: mc('grey', '400');
}
2018-11-25 06:28:20 +00:00
&::before {
display: none;
}
}
}
</style>