Add viewer

This commit is contained in:
brunosimon
2017-08-12 12:02:36 +02:00
parent f7a52d970b
commit 0f33979085
11 changed files with 55 additions and 9 deletions
+3 -1
View File
@@ -1,4 +1,5 @@
import Versions from '@/components/versions'
import Viewer from '@/components/viewer'
export default
{
@@ -6,7 +7,8 @@ export default
components:
{
Versions
Versions,
Viewer
},
props:
+1
View File
@@ -4,4 +4,5 @@
{{ content.path.directory }} {{ content.name }}
</header>
<versions :content="content.versions"></versions>
<viewer></viewer>
</div>
@@ -1,5 +1,5 @@
<div>
<div class="name" :style="{ paddingLeft:depth * 20 + 'px' }" @click.prevent="onNameClick">
<a href="#" class="name" :style="{ paddingLeft:depth * 20 + 'px' }" @click.prevent="onNameClick">
{{ content.name }}
</div>
</a>
</div>
@@ -1,7 +1,7 @@
<div>
<div class="name" :style="{ paddingLeft:depth * 20 + 'px' }" @click.prevent="onNameClick">
<a href="#" class="name" :style="{ paddingLeft:depth * 20 + 'px' }" @click.prevent="onNameClick">
{{ content.name }}
</div>
</a>
<div v-show="open">
<files-tree-folder v-for="folder of content.folders" :key="folder.name" :content="folder" :depth="depth + 1"></files-tree-folder>
<files-tree-file v-for="file of content.files" :key="file.data.path.full" :content="file" :depth="depth + 1"></files-tree-file>
+8
View File
@@ -5,5 +5,13 @@ export default
props:
{
content: { type: Object }
},
methods:
{
onClick()
{
this.$store.commit('setVersion', this.content)
}
}
}
+3 -3
View File
@@ -1,3 +1,3 @@
<div class="version">
{{ content }}
</div>
<a href="#" class="version" @click.prevent="onClick">
{{ content.date }}
</a>
+3
View File
@@ -0,0 +1,3 @@
<template src="./template.html"></template>
<script src="./script.js"></script>
<style src="./style.styl" lang="stylus" scoped></style>
+16
View File
@@ -0,0 +1,16 @@
export default
{
name: 'viewer',
components:
{
},
computed:
{
version()
{
return this.$store.state.version
}
}
}
+7
View File
@@ -0,0 +1,7 @@
.viewer
position absolute
top 30px
right 0
width 75%
height 100%
background rgba(0, 0, 255, 0.3)
+3
View File
@@ -0,0 +1,3 @@
<div class="viewer" v-if="version">
<pre><code>{{ version.content }}</code></pre>
</div>
+7 -1
View File
@@ -10,7 +10,8 @@ export default new Vuex.Store({
projects: {},
project: null,
files: new FileTree({ autoWash: true }),
file: null
file: null,
version: null
},
mutations:
@@ -90,6 +91,11 @@ export default new Vuex.Store({
{
state.file = file
}
},
setVersion(state, data)
{
state.version = data
}
}
})