diff options
author | Zero~Informatique | 2020-01-31 09:17:57 +0100 |
---|---|---|
committer | Zero~Informatique | 2020-01-31 09:27:06 +0100 |
commit | 170da2d55fec0359cbac780786383710b734eda7 (patch) | |
tree | eb6fe6f60e9b83a9e5886b504aa65521711fd4a3 /viewer/src/views | |
parent | a7d459a2620fa9523dd7ce8c9de519133ad5b1b7 (diff) | |
download | ldgallery-170da2d55fec0359cbac780786383710b734eda7.tar.gz |
viewer: code cleaning, moved some views to components
Diffstat (limited to 'viewer/src/views')
-rw-r--r-- | viewer/src/views/GalleryDirectory.vue | 8 | ||||
-rw-r--r-- | viewer/src/views/GalleryPicture.vue | 74 | ||||
-rw-r--r-- | viewer/src/views/GallerySearch.vue | 7 | ||||
-rw-r--r-- | viewer/src/views/GalleryThumbnail.vue | 81 | ||||
-rw-r--r-- | viewer/src/views/MainGallery.vue | 10 | ||||
-rw-r--r-- | viewer/src/views/PanelTop.vue | 13 | ||||
-rw-r--r-- | viewer/src/views/TopBreadcrumb.vue | 58 | ||||
-rw-r--r-- | viewer/src/views/TopCommand.vue | 68 |
8 files changed, 13 insertions, 306 deletions
diff --git a/viewer/src/views/GalleryDirectory.vue b/viewer/src/views/GalleryDirectory.vue index d01032d..baf627e 100644 --- a/viewer/src/views/GalleryDirectory.vue +++ b/viewer/src/views/GalleryDirectory.vue | |||
@@ -21,7 +21,7 @@ | |||
21 | <div class="thumbnail-tiles"> | 21 | <div class="thumbnail-tiles"> |
22 | <div v-for="(item) in orderedItems" :key="item.path"> | 22 | <div v-for="(item) in orderedItems" :key="item.path"> |
23 | <router-link :to="item.path"> | 23 | <router-link :to="item.path"> |
24 | <gallery-thumbnail :item="item" /> | 24 | <ld-thumbnail :item="item" /> |
25 | </router-link> | 25 | </router-link> |
26 | </div> | 26 | </div> |
27 | <div> | 27 | <div> |
@@ -33,12 +33,8 @@ | |||
33 | <script lang="ts"> | 33 | <script lang="ts"> |
34 | import { Component, Vue, Prop } from "vue-property-decorator"; | 34 | import { Component, Vue, Prop } from "vue-property-decorator"; |
35 | import Tools from "@/tools"; | 35 | import Tools from "@/tools"; |
36 | import GalleryThumbnail from "./GalleryThumbnail.vue"; | ||
37 | import Gallery from "./Gallery.vue"; | ||
38 | 36 | ||
39 | @Component({ | 37 | @Component |
40 | components: { GalleryThumbnail }, | ||
41 | }) | ||
42 | export default class GalleryDirectory extends Vue { | 38 | export default class GalleryDirectory extends Vue { |
43 | @Prop({ required: true }) readonly directory!: Gallery.Directory; | 39 | @Prop({ required: true }) readonly directory!: Gallery.Directory; |
44 | 40 | ||
diff --git a/viewer/src/views/GalleryPicture.vue b/viewer/src/views/GalleryPicture.vue deleted file mode 100644 index 9f26282..0000000 --- a/viewer/src/views/GalleryPicture.vue +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | <!-- ldgallery - A static generator which turns a collection of tagged | ||
2 | -- pictures into a searchable web gallery. | ||
3 | -- | ||
4 | -- Copyright (C) 2019-2020 Guillaume FOUET | ||
5 | -- | ||
6 | -- This program is free software: you can redistribute it and/or modify | ||
7 | -- it under the terms of the GNU Affero General Public License as | ||
8 | -- published by the Free Software Foundation, either version 3 of the | ||
9 | -- License, or (at your option) any later version. | ||
10 | -- | ||
11 | -- This program is distributed in the hope that it will be useful, | ||
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | -- GNU Affero General Public License for more details. | ||
15 | -- | ||
16 | -- You should have received a copy of the GNU Affero General Public License | ||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
18 | --> | ||
19 | |||
20 | <template> | ||
21 | <div | ||
22 | v-dragscroll | ||
23 | class="scrollbar" | ||
24 | :class="{'fit-to-screen': !$uiStore.fullscreen, 'original-size': $uiStore.fullscreen}" | ||
25 | @click="onClick" | ||
26 | @dragscrollstart="dragging=true" | ||
27 | > | ||
28 | <v-lazy-image :src="pictureSrc" /> | ||
29 | </div> | ||
30 | </template> | ||
31 | |||
32 | <script lang="ts"> | ||
33 | import { Component, Vue, Prop } from "vue-property-decorator"; | ||
34 | |||
35 | @Component | ||
36 | export default class GalleryPicture extends Vue { | ||
37 | @Prop({ required: true }) readonly picture!: Gallery.Picture; | ||
38 | |||
39 | dragging: boolean = false; | ||
40 | |||
41 | get pictureSrc() { | ||
42 | return `${process.env.VUE_APP_DATA_URL}${this.picture.properties.resource}`; | ||
43 | } | ||
44 | |||
45 | onClick() { | ||
46 | if (!this.dragging) this.$uiStore.toggleFullscreen(); | ||
47 | this.dragging = false; | ||
48 | } | ||
49 | } | ||
50 | </script> | ||
51 | |||
52 | <style lang="scss"> | ||
53 | .fit-to-screen { | ||
54 | display: flex; | ||
55 | justify-content: space-around; | ||
56 | height: 100%; | ||
57 | & > img { | ||
58 | object-fit: contain; | ||
59 | cursor: zoom-in; | ||
60 | } | ||
61 | } | ||
62 | .original-size { | ||
63 | display: block; | ||
64 | text-align: center; | ||
65 | cursor: grab; | ||
66 | height: 100%; | ||
67 | & > img { | ||
68 | max-width: unset; | ||
69 | max-height: unset; | ||
70 | object-fit: none; | ||
71 | cursor: zoom-out; | ||
72 | } | ||
73 | } | ||
74 | </style> | ||
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue index 870d3e2..4e843b9 100644 --- a/viewer/src/views/GallerySearch.vue +++ b/viewer/src/views/GallerySearch.vue | |||
@@ -21,7 +21,7 @@ | |||
21 | <div class="thumbnail-tiles"> | 21 | <div class="thumbnail-tiles"> |
22 | <div v-for="(item) in items" :key="item.path"> | 22 | <div v-for="(item) in items" :key="item.path"> |
23 | <router-link :to="item.path" @click.native="$uiStore.setModeNavigation()"> | 23 | <router-link :to="item.path" @click.native="$uiStore.setModeNavigation()"> |
24 | <gallery-thumbnail :item="item" /> | 24 | <ld-thumbnail :item="item" /> |
25 | </router-link> | 25 | </router-link> |
26 | </div> | 26 | </div> |
27 | <div v-if="items.length===0">{{$t('search.no-results')}}</div> | 27 | <div v-if="items.length===0">{{$t('search.no-results')}}</div> |
@@ -33,11 +33,8 @@ | |||
33 | 33 | ||
34 | <script lang="ts"> | 34 | <script lang="ts"> |
35 | import { Component, Vue, Prop } from "vue-property-decorator"; | 35 | import { Component, Vue, Prop } from "vue-property-decorator"; |
36 | import GalleryThumbnail from "./GalleryThumbnail.vue"; | ||
37 | 36 | ||
38 | @Component({ | 37 | @Component |
39 | components: { GalleryThumbnail }, | ||
40 | }) | ||
41 | export default class GalleryPicture extends Vue { | 38 | export default class GalleryPicture extends Vue { |
42 | @Prop({ required: true }) readonly items!: Gallery.Item[]; | 39 | @Prop({ required: true }) readonly items!: Gallery.Item[]; |
43 | } | 40 | } |
diff --git a/viewer/src/views/GalleryThumbnail.vue b/viewer/src/views/GalleryThumbnail.vue deleted file mode 100644 index 2a372cd..0000000 --- a/viewer/src/views/GalleryThumbnail.vue +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | <!-- ldgallery - A static generator which turns a collection of tagged | ||
2 | -- pictures into a searchable web gallery. | ||
3 | -- | ||
4 | -- Copyright (C) 2019-2020 Guillaume FOUET | ||
5 | -- | ||
6 | -- This program is free software: you can redistribute it and/or modify | ||
7 | -- it under the terms of the GNU Affero General Public License as | ||
8 | -- published by the Free Software Foundation, either version 3 of the | ||
9 | -- License, or (at your option) any later version. | ||
10 | -- | ||
11 | -- This program is distributed in the hope that it will be useful, | ||
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | -- GNU Affero General Public License for more details. | ||
15 | -- | ||
16 | -- You should have received a copy of the GNU Affero General Public License | ||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
18 | --> | ||
19 | |||
20 | <template> | ||
21 | <div class="forcedsize" :class="{'preload': loading}"> | ||
22 | <v-lazy-image | ||
23 | v-if="item.thumbnail" | ||
24 | class="thumbnail" | ||
25 | :src="pictureSrc()" | ||
26 | :title="item.path" | ||
27 | @intersect="loading=true" | ||
28 | @load="loading=false" | ||
29 | /> | ||
30 | <div v-else class="flex-column flex-center"> | ||
31 | <fa-icon :icon="getIcon()" size="4x" /> | ||
32 | {{item.title}} | ||
33 | </div> | ||
34 | </div> | ||
35 | </template> | ||
36 | |||
37 | <script lang="ts"> | ||
38 | import { Component, Vue, Prop } from "vue-property-decorator"; | ||
39 | import Tools from "@/tools"; | ||
40 | |||
41 | @Component | ||
42 | export default class GalleryThumbnail extends Vue { | ||
43 | @Prop({ required: true }) readonly item!: Gallery.Item; | ||
44 | |||
45 | loading: boolean = false; | ||
46 | |||
47 | pictureSrc() { | ||
48 | return `${process.env.VUE_APP_DATA_URL}${this.item.thumbnail}`; | ||
49 | } | ||
50 | |||
51 | getIcon() { | ||
52 | return Tools.getIcon(this.item); | ||
53 | } | ||
54 | } | ||
55 | </script> | ||
56 | |||
57 | <style lang="scss"> | ||
58 | @import "@/assets/scss/theme.scss"; | ||
59 | |||
60 | .thumbnail { | ||
61 | max-width: 250px; | ||
62 | max-height: 250px; | ||
63 | } | ||
64 | .preload { | ||
65 | animation: preloadAnimation 1s infinite ease-in-out alternate; | ||
66 | } | ||
67 | @keyframes preloadAnimation { | ||
68 | from { | ||
69 | background-color: $content-bgcolor; | ||
70 | } | ||
71 | to { | ||
72 | background-color: $loader-color; | ||
73 | } | ||
74 | } | ||
75 | // Temporary size until we get the true thumbnail size | ||
76 | .forcedsize { | ||
77 | width: 250px; | ||
78 | height: 250px; | ||
79 | text-align: center; | ||
80 | } | ||
81 | </style> | ||
diff --git a/viewer/src/views/MainGallery.vue b/viewer/src/views/MainGallery.vue index 06cf512..5767cce 100644 --- a/viewer/src/views/MainGallery.vue +++ b/viewer/src/views/MainGallery.vue | |||