[+] Zotero details table

This commit is contained in:
Hykilpikonna
2021-12-25 13:33:13 -05:00
parent 583a292768
commit 8e11ae11c8
+23 -4
View File
@@ -4,11 +4,11 @@
<i class="icon fas fa-caret-right"></i> <i class="icon fas fa-caret-right"></i>
<div class="fbox-v"> <div class="fbox-v">
<div id="title">{{d.title}}</div> <div id="title">{{d.title}}</div>
<div id="subtitle">By {{d.creators.map(it => it.firstName + ' ' + it.lastName).join(' & ')}}{{date.year() ? ', ' + date.year() : ''}}</div> <div id="subtitle">By {{authors}}{{date.year() ? ', ' + date.year() : ''}}</div>
</div> </div>
</div> </div>
<div id="details"> <div id="details">
Text <MetaTable :table="tableData"/>
</div> </div>
</div> </div>
</template> </template>
@@ -19,6 +19,9 @@ import {Prop} from "vue-property-decorator";
import moment from "moment"; import moment from "moment";
import $ from "jquery"; import $ from "jquery";
import 'jqueryui'; import 'jqueryui';
import MetaTable from "@/components/MetaTable.vue";
import {capitalize} from "@/scripts/utils";
import linkifyUrls from "linkify-urls";
export interface ZoteroLink export interface ZoteroLink
{ {
@@ -40,6 +43,7 @@ export interface ZoteroCreator
export interface ZoteroData export interface ZoteroData
{ {
key: string key: string
version: number
itemType: string // 'document' itemType: string // 'document'
title: string title: string
creators: ZoteroCreator[] creators: ZoteroCreator[]
@@ -75,14 +79,26 @@ export interface ZoteroItem
data: ZoteroData data: ZoteroData
} }
@Options({components: {}}) @Options({components: {MetaTable}})
export default class ZoteroPublicationView extends Vue export default class ZoteroPublicationView extends Vue
{ {
@Prop({required: true}) item!: ZoteroItem @Prop({required: true}) item!: ZoteroItem
get d(): ZoteroData { return this.item.data } get d(): ZoteroData { return this.item.data }
get date(): moment.Moment { return moment(this.item.meta.parsedDate) } get date(): moment.Moment { return moment(this.item.meta.parsedDate) }
get authors(): string { return this.d.creators.map(it => it.firstName + ' ' + it.lastName).join(' & ') }
get tableData(): {[id: string]: unknown}
{
const t: {[id: string]: unknown} = {...this.d}
t.creators = this.authors
delete t.key
delete t.version
delete t.title
if (t.itemType) t.itemType = capitalize(t.itemType as string)
if (t.url) t.url = linkifyUrls(t.url as string)
return t
}
mounted(): void mounted(): void
{ {
@@ -103,6 +119,9 @@ export default class ZoteroPublicationView extends Vue
#subtitle #subtitle
font-size: 0.9em font-size: 0.9em
#details
padding-left: calc(1.6em + 6px)
.header .header
align-items: center align-items: center