-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from scaife-viewer/develop
Prepare for v2020-06-11-002 release
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<template> | ||
<div class="scholia"> | ||
<div v-if="!lines">No commentary found.</div> | ||
<div v-for="line in lines" :key="line.idx" class="line"> | ||
<span class="lemma">{{ line.lemma }} </span> | ||
<span class="comment">{{ line.comment }}</span> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import gql from 'graphql-tag'; | ||
import { URN } from '@scaife-viewer/scaife-widgets'; | ||
import { MODULE_NS } from '@/reader/constants'; | ||
export default { | ||
scaifeConfig: { | ||
displayName: 'Scholia', | ||
location: 'sidebar', | ||
singleton: true, | ||
}, | ||
computed: { | ||
urn() { | ||
return this.$route.query.urn | ||
? new URN(this.$route.query.urn) | ||
: this.$store.getters[`${MODULE_NS}/firstPassageUrn`]; | ||
}, | ||
lines() { | ||
return ( | ||
this.gqlData && | ||
this.gqlData.textAnnotations.edges.map(e => { | ||
return { | ||
idx: e.node.idx, | ||
dse: e.node.data.dse, | ||
comment: e.node.data.comment, | ||
lemma: e.node.data.lemma, | ||
references: e.node.data.references, | ||
} | ||
}) | ||
); | ||
}, | ||
gqlQuery() { | ||
if (this.urn) { | ||
return gql` | ||
{ | ||
textAnnotations(reference: "${this.urn}") { | ||
edges { | ||
node { | ||
idx | ||
data | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
} | ||
return null; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.scholia { | ||
margin: 0 2em; | ||
} | ||
.line { | ||
font-family: $font-family-serif; | ||
font-size: 14px; | ||
.lemma { | ||
font-weight: 700; | ||
} | ||
margin-bottom: 10px; | ||
} | ||
</style> |