Make Folder and Tag links (fix #115)
parent
3f915f1e8c
commit
cb878d76e6
|
@ -1,10 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="folder fill-block" :class="{
|
<router-link class="folder fill-block" :class="{
|
||||||
hasPreview: previewFileInfos.length > 0,
|
hasPreview: previewFileInfos.length > 0,
|
||||||
onePreview: previewFileInfos.length === 1,
|
onePreview: previewFileInfos.length === 1,
|
||||||
hasError: error,
|
hasError: error,
|
||||||
}"
|
}"
|
||||||
@click="openFolder(data)">
|
:to="target">
|
||||||
<div class="big-icon fill-block">
|
<div class="big-icon fill-block">
|
||||||
<FolderIcon class="memories__big-folder-icon" />
|
<FolderIcon class="memories__big-folder-icon" />
|
||||||
<div class="name">{{ data.name }}</div>
|
<div class="name">{{ data.name }}</div>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
@error="info.flag |= c.FLAG_LOAD_FAIL" />
|
@error="info.flag |= c.FLAG_LOAD_FAIL" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -96,8 +96,8 @@ export default class Folder extends Mixins(GlobalMixin, UserConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Open folder */
|
/** Open folder */
|
||||||
openFolder(folder: IFolder) {
|
get target() {
|
||||||
const path = folder.path.split('/').filter(x => x).slice(2) as string[];
|
const path = this.data.path.split('/').filter(x => x).slice(2) as string[];
|
||||||
|
|
||||||
// Remove base path if present
|
// Remove base path if present
|
||||||
const basePath = this.config_foldersPath.split('/').filter(x => x);
|
const basePath = this.config_foldersPath.split('/').filter(x => x);
|
||||||
|
@ -105,7 +105,7 @@ export default class Folder extends Mixins(GlobalMixin, UserConfig) {
|
||||||
path.splice(0, basePath.length);
|
path.splice(0, basePath.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$router.push({ name: 'folders', params: { path: path as any }});
|
return { name: 'folders', params: { path: path as any }};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="tag fill-block" :class="{
|
<router-link class="tag fill-block" :class="{
|
||||||
hasPreview: previews.length > 0,
|
hasPreview: previews.length > 0,
|
||||||
onePreview: previews.length === 1,
|
onePreview: previews.length === 1,
|
||||||
hasError: error,
|
hasError: error,
|
||||||
isFace: isFace,
|
isFace: isFace,
|
||||||
}"
|
}"
|
||||||
|
:to="target"
|
||||||
@click="openTag(data)">
|
@click="openTag(data)">
|
||||||
|
|
||||||
<div class="bbl"> <NcCounterBubble> {{ data.count }} </NcCounterBubble> </div>
|
<div class="bbl"> <NcCounterBubble> {{ data.count }} </NcCounterBubble> </div>
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
@error="info.flag |= c.FLAG_LOAD_FAIL" />
|
@error="info.flag |= c.FLAG_LOAD_FAIL" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -49,6 +50,13 @@ export default class Tag extends Mixins(GlobalMixin) {
|
||||||
// Error occured fetching thumbs
|
// Error occured fetching thumbs
|
||||||
private error = false;
|
private error = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open tag event
|
||||||
|
* Unless noNavigate is set, the tag will be opened
|
||||||
|
*/
|
||||||
|
@Emit('open')
|
||||||
|
openTag(tag: ITag) {}
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.refreshPreviews();
|
this.refreshPreviews();
|
||||||
}
|
}
|
||||||
|
@ -95,19 +103,16 @@ export default class Tag extends Mixins(GlobalMixin) {
|
||||||
this.error = this.previews.length === 0;
|
this.error = this.previews.length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Open tag */
|
/** Target URL to navigate to */
|
||||||
@Emit('open')
|
get target() {
|
||||||
openTag(tag: ITag) {
|
if (this.noNavigate) return {};
|
||||||
if (this.noNavigate) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isFace) {
|
if (this.isFace) {
|
||||||
const name = this.data.name || this.data.fileid.toString();
|
const name = this.data.name || this.data.fileid.toString();
|
||||||
const user = this.data.user_id;
|
const user = this.data.user_id;
|
||||||
this.$router.push({ name: 'people', params: { name, user }});
|
return { name: 'people', params: { name, user }};
|
||||||
} else {
|
} else {
|
||||||
this.$router.push({ name: 'tags', params: { name: this.data.name }});
|
return { name: 'tags', params: { name: this.data.name }};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue