fix(webui): display custom roles in book edit dialog

This commit is contained in:
Gauthier Roebroeck 2021-09-06 14:47:03 +08:00
parent 2d14e698e6
commit 055fb1c827

View file

@ -376,9 +376,15 @@ export default Vue.extend({
},
computed: {
authorRoles(): NameValue[] {
return authorRoles.map((x: string) => ({
name: this.$t(`author_roles.${x}`).toString(),
value: x,
let remoteRoles = []
if (Array.isArray(this.books))
remoteRoles = this.books.flatMap(b => b.metadata.authors).map(a => a.role)
else
remoteRoles = this.books.metadata.authors.map(a => a.role)
const allRoles = this.$_.uniq([...authorRoles, ...remoteRoles])
return allRoles.map((role: string) => ({
name: this.$te(`author_roles.${role}`) ? this.$t(`author_roles.${role}`).toString() : role,
value: role,
}))
},
single(): boolean {