diff options
author | Zero~Informatique | 2020-01-31 06:46:31 +0100 |
---|---|---|
committer | Zero~Informatique | 2020-01-31 06:46:31 +0100 |
commit | 252dd6fc6f53ecd8b28e05a0514429472d53d08e (patch) | |
tree | cecc440dd97372dc657d5048b6175b426ae7cd7d /viewer/src/views | |
parent | a6465c393be055680b3a7168cc8875936fdc8632 (diff) | |
download | ldgallery-252dd6fc6f53ecd8b28e05a0514429472d53d08e.tar.gz |
viewer: finalized the command buttons. added the 'up to parent' command
Diffstat (limited to 'viewer/src/views')
-rw-r--r-- | viewer/src/views/MainLayout.vue | 7 | ||||
-rw-r--r-- | viewer/src/views/PanelTop.vue | 64 | ||||
-rw-r--r-- | viewer/src/views/TopBreadcrumb.vue | 63 | ||||
-rw-r--r-- | viewer/src/views/TopCommand.vue | 68 |
4 files changed, 148 insertions, 54 deletions
diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index f0809b6..c202def 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue | |||
@@ -18,7 +18,7 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <div :class="{fullscreen: $uiStore.fullscreen}"> | 21 | <div :class="{fullscreen: $uiStore.fullscreen, fullWidth: $uiStore.fullWidth}"> |
22 | <panel-top v-if="!isLoading" class="layout layout-top" /> | 22 | <panel-top v-if="!isLoading" class="layout layout-top" /> |
23 | <panel-left v-if="!isLoading" class="layout layout-left" /> | 23 | <panel-left v-if="!isLoading" class="layout layout-left" /> |
24 | <router-view v-if="!isLoading" class="layout layout-content scrollbar" /> | 24 | <router-view v-if="!isLoading" class="layout layout-content scrollbar" /> |
@@ -98,8 +98,11 @@ html { | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | .fullscreen { | 100 | .fullscreen { |
101 | --layout-left: 0px; | ||
102 | --layout-top: 0px; | 101 | --layout-top: 0px; |
102 | @extend .fullWidth; | ||
103 | } | ||
104 | .fullWidth { | ||
105 | --layout-left: 0px; | ||
103 | .layout { | 106 | .layout { |
104 | &.layout-left { | 107 | &.layout-left { |
105 | transform: translate(-$layout-left, 0); | 108 | transform: translate(-$layout-left, 0); |
diff --git a/viewer/src/views/PanelTop.vue b/viewer/src/views/PanelTop.vue index e7421f0..3553789 100644 --- a/viewer/src/views/PanelTop.vue +++ b/viewer/src/views/PanelTop.vue | |||
@@ -19,64 +19,24 @@ | |||
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <div class="flex"> | 21 | <div class="flex"> |
22 | <div class="command-btns"> | 22 | <top-command /> |
23 | <fa-icon icon="tags" size="lg" class="disabled" /> | 23 | <top-breadcrumb /> |
24 | <router-link to="/" :class="{disabled: $galleryStore.currentItemPath.length <= 1}"> | ||
25 | <fa-icon icon="home" size="lg" /> | ||
26 | </router-link> | ||
27 | <div class="link" @click="$router.go(-1)"> | ||
28 | <fa-icon icon="arrow-left" size="lg" /> | ||
29 | </div> | ||
30 | </div> | ||
31 | <ul class="pathBreadcrumb"> | ||
32 | <li v-for="(item,idx) in $galleryStore.currentItemPath" :key="item.path"> | ||
33 | <router-link :to="item.path"> | ||
34 | <fa-icon :icon="getIcon(item)" size="lg" /> | ||
35 | {{item.title}} | ||
36 | </router-link> | ||
37 | <fa-icon v-if="(idx+1) < $galleryStore.currentItemPath.length" icon="angle-right" /> | ||
38 | </li> | ||
39 | </ul> | ||
40 | </div> | 24 | </div> |
41 | </template> | 25 | </template> |
42 | 26 | ||
43 | <script lang="ts"> | 27 | <script lang="ts"> |
44 | import { Component, Vue, Prop, Watch } from "vue-property-decorator"; | 28 | import { Component, Vue } from "vue-property-decorator"; |
45 | import Gallery from "./Gallery.vue"; | 29 | import TopBreadcrumb from "./TopBreadcrumb.vue"; |
30 | import TopCommand from "./TopCommand.vue"; | ||
46 | 31 | ||
47 | @Component | 32 | @Component({ |
48 | export default class PanelTop extends Vue { | 33 | components: { |
49 | getIcon(item: Gallery.Item) { | 34 | TopCommand, |
50 | if (item.path.length <= 1) return "home"; | 35 | TopBreadcrumb, |
51 | switch (item.properties.type) { | 36 | }, |
52 | case "picture": | 37 | }) |
53 | return "image"; | 38 | export default class PanelTop extends Vue {} |
54 | case "directory": | ||
55 | return "folder"; | ||
56 | } | ||
57 | } | ||
58 | } | ||
59 | </script> | 39 | </script> |
60 | 40 | ||
61 | <style lang="scss"> | 41 | <style lang="scss"> |
62 | @import "@/assets/scss/theme.scss"; | ||
63 | |||
64 | .pathBreadcrumb { | ||
65 | display: flex; | ||
66 | list-style: none; | ||
67 | margin: 5px; | ||
68 | a { | ||
69 | margin-right: 5px; | ||
70 | } | ||
71 | li:not(:first-child) { | ||
72 | margin-left: 10px; | ||
73 | } | ||
74 | } | ||
75 | .command-btns { | ||
76 | display: flex; | ||
77 | justify-content: space-around; | ||
78 | vertical-align: middle; | ||
79 | align-items: center; | ||
80 | width: $layout-left; | ||
81 | } | ||
82 | </style> | 42 | </style> |
diff --git a/viewer/src/views/TopBreadcrumb.vue b/viewer/src/views/TopBreadcrumb.vue new file mode 100644 index 0000000..1a14123 --- /dev/null +++ b/viewer/src/views/TopBreadcrumb.vue | |||
@@ -0,0 +1,63 @@ | |||
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 | <ul class="pathBreadcrumb"> | ||
22 | <li v-for="(item,idx) in $galleryStore.currentItemPath" :key="item.path"> | ||
23 | <router-link :to="item.path"> | ||
24 | <fa-icon :icon="getIcon(item)" size="lg" /> | ||
25 | {{item.title}} | ||
26 | </router-link> | ||
27 | <fa-icon v-if="(idx+1) < $galleryStore.currentItemPath.length" icon="angle-right" /> | ||
28 | </li> | ||
29 | </ul> | ||
30 | </template> | ||
31 | |||
32 | <script lang="ts"> | ||
33 | import { Component, Vue } from "vue-property-decorator"; | ||
34 | |||
35 | @Component | ||
36 | export default class TopBreadcrumb extends Vue { | ||
37 | getIcon(item: Gallery.Item) { | ||
38 | if (item.path.length <= 1) return "home"; | ||
39 | switch (item.properties.type) { | ||
40 | case "picture": | ||
41 | return "image"; | ||
42 | case "directory": | ||
43 | return "folder"; | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | </script> | ||
48 | |||
49 | <style lang="scss"> | ||
50 | .pathBreadcrumb { | ||
51 | border-left: 2px solid rgba(white, 0.1); | ||
52 | padding-left: 15px; | ||
53 | display: flex; | ||
54 | list-style: none; | ||
55 | margin: 5px; | ||
56 | a { | ||
57 | margin-right: 5px; | ||
58 | } | ||
59 | li:not(:first-child) { | ||
60 | margin-left: 10px; | ||
61 | } | ||
62 | } | ||
63 | </style> | ||
diff --git a/viewer/src/views/TopCommand.vue b/viewer/src/views/TopCommand.vue new file mode 100644 index 0000000..b5d16e8 --- /dev/null +++ b/viewer/src/views/TopCommand.vue | |||
@@ -0,0 +1,68 @@ | |||
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="flex command-btns"> | ||
22 | <div class="link" title="$t('title.tags')" @click="$uiStore.toggleFullWidth()"> | ||
23 | <fa-icon :icon="commandTagsIcon()" size="lg" /> | ||
24 | </div> | ||
25 | <router-link to="/" :class="{disabled: isRoot()}" title="$t('title.home')"> | ||
26 | <fa-icon icon="home" size="lg" /> | ||
27 | </router-link> | ||
28 | <div class="link" title="$t('title.back')" @click="$router.go(-1)"> | ||
29 | <fa-icon icon="arrow-left" size="lg" /> | ||
30 | </div> | ||
31 | <router-link :class="{disabled: isRoot()}" title="$t('title.parent')" :to="parent()"> | ||
32 | <fa-icon icon="folder" size="xs" /> | ||
33 | <fa-icon icon="level-up-alt" size="lg" /> | ||
34 | </router-link> | ||
35 | </div> | ||
36 | </template> | ||
37 | |||
38 | <script lang="ts"> | ||
39 | import { Component, Vue } from "vue-property-decorator"; | ||
40 | import { RawLocation } from "vue-router"; | ||
41 | |||
42 | @Component | ||
43 | export default class TopCommand extends Vue { | ||
44 | commandTagsIcon(): string { | ||
45 | return this.$uiStore.fullWidth ? "tags" : "window-close"; | ||
46 | } | ||
47 | |||
48 | isRoot(): boolean { | ||
49 | return this.$galleryStore.currentItemPath.length <= 1; | ||
50 | } | ||
51 | |||
52 | parent(): RawLocation { | ||
53 | if (!this.isRoot()) return this.$galleryStore.currentItemPath[this.$galleryStore.currentItemPath.length - 2]; | ||
54 | return ""; | ||
55 | } | ||
56 | } | ||