-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
275 additions
and
40 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
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
119 changes: 119 additions & 0 deletions
119
app/javascript/vue/tasks/otu/browse/components/specimens/SpecimenInformation.vue
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,119 @@ | ||
<template> | ||
<div class="content"> | ||
<span class="middle"> | ||
<span class="mark-box button-default separate-right" /> | ||
<span><a :href="`/tasks/collection_objects/browse?collection_object_id=${specimen.collection_objects_id}`">Specimen</a> | <a :href="`/tasks/accessions/comprehensive?collection_object_id=${specimen.collection_objects_id}`">Edit</a></span> | ||
</span> | ||
<ul class="no_bullets"> | ||
<li> | ||
<span>Counts: <b v-html="countAndBiocurations" /></span> | ||
</li> | ||
<li> | ||
<span>Repository: <b>{{ repositoryLabel }}</b></span> | ||
</li> | ||
<li> | ||
<span>Citation: <b><span v-html="citationsLabel" /></b></span> | ||
</li> | ||
<li> | ||
<span>Collecting event: <b><span v-html="collectingEventLabel" /></b></span> | ||
</li> | ||
</ul> | ||
<div | ||
v-if="depictions.length" | ||
class="horizontal-left-content margin-medium-top"> | ||
<span class="middle"> | ||
<span class="mark-box button-default separate-right" /> Images | ||
</span> | ||
<image-viewer | ||
v-for="depiction in depictions" | ||
:key="depiction.id" | ||
:depiction="depiction" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { | ||
GetBiocurations, | ||
GetDepictions, | ||
GetRepository, | ||
GetCitations | ||
} from '../../request/resources' | ||
import { GetterNames } from '../../store/getters/getters' | ||
export default { | ||
props: { | ||
specimen: { | ||
type: Object, | ||
required: true | ||
} | ||
}, | ||
computed: { | ||
citationsLabel () { | ||
return this.citations.length ? this.citations.map(item => { return item.source.cached }).join('; ') : 'not specified' | ||
}, | ||
countAndBiocurations () { | ||
return this.biocurations.length ? `${this.specimen.individualCount} ${this.biocurations.map(item => { return item.object_tag.toLowerCase() }).join(', ')}` : this.specimen.individualCount | ||
}, | ||
collectingEvents () { | ||
return this.$store.getters[GetterNames.GetCollectingEvents] | ||
}, | ||
collectingEventLabel () { | ||
const ce = this.collectingEvents.find(item => { | ||
return this.specimen.collecting_event_id === item.id | ||
}) | ||
return ce ? ce.object_tag : 'not specified' | ||
}, | ||
repositoryLabel () { | ||
return this.repository ? this.repository.name : 'not specified' | ||
}, | ||
ceLabel () { | ||
const levels = ['country', 'stateProvince', 'county', 'verbatimLocality'] | ||
let tmp = [] | ||
levels.forEach(item => { | ||
if(this.specimen[item]) { tmp.push(this.specimen[item]) } | ||
}) | ||
return tmp.join(', ') | ||
} | ||
}, | ||
data () { | ||
return { | ||
depictions: [], | ||
biocurations: [], | ||
repository: undefined, | ||
citations: [], | ||
expand: false, | ||
alreadyLoaded: false | ||
} | ||
}, | ||
watch: { | ||
expand (newVal) { | ||
if (!this.alreadyLoaded) { | ||
this.alreadyLoaded = true | ||
this.loadData() | ||
} | ||
} | ||
}, | ||
mounted () { | ||
GetBiocurations(this.specimen.collection_objects_id).then(response => { | ||
this.biocurations = response.body | ||
}) | ||
}, | ||
methods: { | ||
loadData () { | ||
GetDepictions('collection_objects', this.specimen.collection_objects_id).then(response => { | ||
this.depictions = response.body | ||
}) | ||
GetRepository(this.collectionObject.repository_id).then(response => { | ||
this.repository = response.body | ||
}) | ||
GetCitations('collection_objects', this.specimen.collection_objects_id).then(response => { | ||
this.citations = response.body | ||
}) | ||
} | ||
} | ||
} | ||
</script> |
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
36 changes: 36 additions & 0 deletions
36
app/javascript/vue/tasks/otu/browse/components/specimens/TypeData.vue
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,36 @@ | ||
<template> | ||
<div class="content"> | ||
<span><span v-html="type.object_tag"/> | <a :href="urlType">Edit</a></span> | ||
<ul> | ||
<li> | ||
<span>Citation: <b><span v-html="citationsLabel"/></b></span> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { RouteNames } from 'routes/routes' | ||
import { GetterNames } from '../../store/getters/getters' | ||
export default { | ||
props: { | ||
type: { | ||
type: Object, | ||
required: true | ||
} | ||
}, | ||
computed: { | ||
citationsLabel () { | ||
return this.type.origin_citation ? this.type.origin_citation.source.object_tag : 'not specified' | ||
}, | ||
otu () { | ||
return this.$store.getters[GetterNames.GetCurrentOtu] | ||
}, | ||
urlType () { | ||
return `${RouteNames.TypeMaterial}?taxon_name_id=${this.otu.taxon_name_id}&type_material_id=${this.type.id}` | ||
} | ||
} | ||
} | ||
</script> |
59 changes: 59 additions & 0 deletions
59
app/javascript/vue/tasks/otu/browse/components/specimens/TypeInformation.vue
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,59 @@ | ||
<template> | ||
<div> | ||
<div | ||
@click="expand = !expand" | ||
class="cursor-pointer inline"> | ||
<div | ||
:data-icon="expand ? 'w_less' : 'w_plus'" | ||
class="expand-box button-default separate-right"/> | ||
<span>[<span v-html="types.map(type => type.object_tag).join('; ')"/>] <span>{{ ceLabel }}</span></span> | ||
</div> | ||
<template v-if="expand"> | ||
<type-data | ||
v-for="type in types" | ||
:key="type.id" | ||
:type="type"/> | ||
<specimen-information | ||
v-if="expand" | ||
:specimen="specimen"/> | ||
</template> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import SpecimenInformation from './SpecimenInformation' | ||
import TypeData from './TypeData' | ||
export default { | ||
components: { | ||
SpecimenInformation, | ||
TypeData | ||
}, | ||
props: { | ||
specimen: { | ||
type: Object, | ||
required: true | ||
}, | ||
types: { | ||
type: Array, | ||
default: () => [] | ||
} | ||
}, | ||
computed: { | ||
ceLabel () { | ||
const levels = ['country', 'stateProvince', 'county', 'verbatimLocality'] | ||
const tmp = [] | ||
levels.forEach(item => { | ||
if (this.specimen[item]) { tmp.push(this.specimen[item]) } | ||
}) | ||
return tmp.join(', ') | ||
} | ||
}, | ||
data () { | ||
return { | ||
expand: false | ||
} | ||
} | ||
} | ||
</script> |
Oops, something went wrong.