refactor(thumb): add reason title

This commit is contained in:
Travis Shivers 2020-09-27 19:00:34 -05:00
parent 4e45eb7d4e
commit e9aadef261
No known key found for this signature in database
GPG Key ID: EE4CC2891B8FCD33
3 changed files with 36 additions and 11 deletions

View File

@ -78,30 +78,39 @@
> >
<v-col <v-col
cols="12" cols="12"
style="max-width: 100%;" class="text-subtitle-2 text-truncate"
> >
<div {{ getTitle(content, fullTitle) }}
class="text-subtitle-2 text-truncate"
>
{{ getTitle(content, fullTitle) }}
</div>
</v-col> </v-col>
<v-col <v-col
cols="12" cols="12"
class="text-caption text-truncate text--secondary"
> >
<div class="text-caption text-truncate text--secondary"> {{ getSecondaryTitle(content, fullTitle) }}
{{ getSecondaryTitle(content, fullTitle) }} </v-col>
</div>
<v-col
v-if="content.reason"
cols="12"
class="text-caption text-truncate text--secondary"
>
{{ getReasonTitle(content) }}
</v-col> </v-col>
</v-row> </v-row>
</template> </template>
<div>{{ getTitle(content, fullTitle) }}</div> <div>{{ getTitle(content, fullTitle) }}</div>
<div class="text-caption text--secondary">
{{ getSecondaryTitle(content, fullTitle) }}
</div>
<div <div
v-if="content.reason"
class="text-caption text--secondary" class="text-caption text--secondary"
> >
{{ getSecondaryTitle(content, fullTitle) }} {{ getReasonTitle(content) }}
</div> </div>
</v-tooltip> </v-tooltip>
</v-card> </v-card>
@ -295,6 +304,12 @@ export default {
} }
}, },
beforeDestroy() {
if (this.$el.vanillaTilt) {
this.$el.vanillaTilt.destroy();
}
},
methods: { methods: {
getImageUrl(width) { getImageUrl(width) {
return this.GET_MEDIA_IMAGE_URL({ return this.GET_MEDIA_IMAGE_URL({

View File

@ -160,7 +160,9 @@ export default {
]), ]),
getItemSecondaryTitle(item) { getItemSecondaryTitle(item) {
return item.reasonTitle || this.getSecondaryTitle(item); return item.reason
? this.getReasonTitle(item)
: this.getSecondaryTitle(item);
}, },
getItemThumb({ type, thumb, grandparentThumb }) { getItemThumb({ type, thumb, grandparentThumb }) {

View File

@ -1,3 +1,9 @@
const reasonWord = {
section: 'in',
actor: 'with',
director: 'by',
};
export default { export default {
getTitle: (metadata, fullTitle) => { getTitle: (metadata, fullTitle) => {
switch (metadata.type) { switch (metadata.type) {
@ -63,4 +69,6 @@ export default {
} }
} }
}, },
getReasonTitle: ({ reason, reasonTitle }) => `${reasonWord[reason]} ${reasonTitle}`,
}; };