Skip to content

Commit

Permalink
feat(posts tag): use links instead of buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Oct 17, 2021
1 parent 30ee04e commit 833d9d0
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions components/pages/posts/post/Post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,27 @@

<!-- Tags -->
<div class="min-w-full tag-container">
<button
v-for="tag in post.data.tags"
:key="tag"
class="tag link"
type="button"
@click="fetchSpecificTag(tag)"
>
{{ tag }}
</button>
<template v-for="tag in post.data.tags">
<template v-if="viewOnly">
<span :key="tag" class="tag link">
{{ tag }}
</span>
</template>

<template v-else>
<NuxtLink
:key="tag"
:to="
generatePostsRoute(getActiveBooru.domain, undefined, [
tag,
])
"
class="tag link"
>
{{ tag }}
</NuxtLink>
</template>
</template>
</div>
</div>
</TransitionCollapse>
Expand Down Expand Up @@ -182,9 +194,10 @@
</template>

<script>
import { mapActions, mapGetters } from 'vuex'
import { mapGetters } from 'vuex'
import { ExternalLinkIcon, TagIcon } from 'vue-feather-icons'
import { Intersect } from 'vuetify/lib/directives/intersect'
import { RouterHelper } from '~/assets/js/RouterHelper'
export default {
components: { ExternalLinkIcon, TagIcon },
Expand Down Expand Up @@ -232,6 +245,7 @@ export default {
computed: {
...mapGetters('user', ['getUserSettings']),
...mapGetters('booru', ['getActiveBooru']),
// #region Post media
isImage() {
Expand Down Expand Up @@ -305,7 +319,7 @@ export default {
},
methods: {
...mapActions('booru', ['tagsManager']),
generatePostsRoute: RouterHelper.generatePostsRoute,
toggleTags() {
this.isActive = !this.isActive
Expand Down Expand Up @@ -442,20 +456,6 @@ export default {
.replace(currentURL.hostname, currentURL.hostname + '/')
},
// #endregion
// #region Post tags
fetchSpecificTag(tag) {
if (this.viewOnly) {
console.info('View only')
return
}
this.tagsManager({
operation: 'set',
value: [tag],
})
},
// #endregion
},
}
</script>

0 comments on commit 833d9d0

Please sign in to comment.