aboutsummaryrefslogtreecommitdiff
path: root/viewer/src
diff options
context:
space:
mode:
authorZero~Informatique2020-08-20 00:14:27 +0200
committerG.Fouet2020-09-11 21:53:18 +0200
commit4c839e0f30fad9e5df29f1f0682380581c582713 (patch)
tree763b80f708a1c08137627610487db29bc38bb6ad /viewer/src
parentb46f0c99bb6f73ddc2ecdc0e47655b7110251cc9 (diff)
downloadldgallery-4c839e0f30fad9e5df29f1f0682380581c582713.tar.gz
viewer: information panel with markdown
github: resolves #214 github: resolves #37
Diffstat (limited to 'viewer/src')
-rw-r--r--viewer/src/components/LdInformation.vue59
-rw-r--r--viewer/src/locales/en.json3
-rw-r--r--viewer/src/views/PanelLeft.vue9
3 files changed, 58 insertions, 13 deletions
diff --git a/viewer/src/components/LdInformation.vue b/viewer/src/components/LdInformation.vue
index ac526d5..29bd1be 100644
--- a/viewer/src/components/LdInformation.vue
+++ b/viewer/src/components/LdInformation.vue
@@ -18,24 +18,67 @@
18--> 18-->
19 19
20<template> 20<template>
21 <div class="flex-column"> 21 <div class="flex-column" :class="$style.infopanel">
22 <div>{{item.title}}</div> 22 <div v-if="item.title" :class="$style.title">{{ item.title }}</div>
23 <div>{{item.description}}</div> 23 <time v-if="item.datetime" :datetime="item.datetime" :class="$style.datetime">{{ formatDate }}</time>
24 <div>{{item.datetime}}</div> 24 <div v-if="item.description" :class="$style.description" v-html="formatDescription" />
25 <b-taglist>
26 <b-tag v-for="tag in item.tags" :key="tag">{{tag}}</b-tag>
27 </b-taglist>
28 </div> 25 </div>
29</template> 26</template>
30 27
31<script lang="ts"> 28<script lang="ts">
32import { Component, Vue, Prop } from "vue-property-decorator"; 29import { Component, Vue, Prop } from "vue-property-decorator";
30import marked from "marked";
33 31
34@Component 32@Component
35export default class LdInformation extends Vue { 33export default class LdInformation extends Vue {
36 @Prop({ required: true }) readonly item!: Gallery.Item; 34 @Prop({ required: true }) readonly item!: Gallery.Item;
35
36 get formatDate() {
37 const date = this.item.datetime.substr(0, 10);
38 const time = this.item.datetime.substr(11, 5);
39 return `${date} ${time}`;
40 }
41
42 get formatDescription() {
43 if (!this.item.description) return "";
44 return marked(this.item.description);
45 }
37} 46}
38</script> 47</script>
39 48
40<style lang="scss"> 49<style lang="scss" module>
50@import "~@/assets/scss/theme.scss";
51
52.infopanel {
53 padding: 2px 2px 7px 7px;
54 overflow-wrap: break-word;
55
56 .title {
57 font-weight: bold;
58 }
59 .datetime {
60 font-size: 0.9em;
61 color: $palette-300;
62 }
63 .description {
64 padding-bottom: 7px;
65 > * {
66 margin-top: 5px;
67 }
68 ul,
69 ol {
70 margin-left: 1em;
71 }
72 ul {
73 list-style-type: disc;
74 }
75 a {
76 color: $palette-200;
77 &:hover {
78 color: $palette-050;
79 text-decoration: underline;
80 }
81 }
82 }
83}
41</style> 84</style>
diff --git a/viewer/src/locales/en.json b/viewer/src/locales/en.json
index 824064e..0bbc2cc 100644
--- a/viewer/src/locales/en.json
+++ b/viewer/src/locales/en.json
@@ -15,5 +15,6 @@
15 "command.back": "Go back", 15 "command.back": "Go back",
16 "command.parent": "Go to parent directory", 16 "command.parent": "Go to parent directory",
17 "directory.no-results": "Empty directory", 17 "directory.no-results": "Empty directory",
18 "panelLeft.propositions.other": "other filters" 18 "panelLeft.propositions.other": "other filters",
19 "panelLeft.information.title": "Information"
19} 20}
diff --git a/viewer/src/views/PanelLeft.vue b/viewer/src/views/PanelLeft.vue
index 6341beb..f8d6faf 100644
--- a/viewer/src/views/PanelLeft.vue
+++ b/viewer/src/views/PanelLeft.vue
@@ -38,9 +38,9 @@
38 /> 38 />
39 </div> 39 </div>
40 <b-collapse animation="slide" :open.sync="infoOpen"> 40 <b-collapse animation="slide" :open.sync="infoOpen">
41 <h1 slot="trigger" class="title flex"> 41 <h1 slot="trigger" class="flex title">
42 Informations 42 {{ $t("panelLeft.information.title") }}
43 <fa-icon :icon="infoOpen ? 'caret-up' : 'caret-down'" /> 43 <fa-icon :icon="infoOpen ? 'caret-down' : 'caret-up'" />
44 </h1> 44 </h1>
45 <ld-information :item="$galleryStore.currentItem" /> 45 <ld-information :item="$galleryStore.currentItem" />
46 </b-collapse> 46 </b-collapse>
@@ -105,7 +105,8 @@ export default class PanelLeft extends Vue {
105 user-select: none; 105 user-select: none;
106 > svg { 106 > svg {
107 color: $link; 107 color: $link;
108 } 108 margin-top: 2px; // Fixes a vertical centering issue with the carret
109 }
109 } 110 }
110} 111}
111</style> 112</style>