Skip to content

Commit

Permalink
Add image source
Browse files Browse the repository at this point in the history
  • Loading branch information
José Luis Pereira committed Aug 3, 2022
1 parent 3ba8cf1 commit aee74ca
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
15 changes: 15 additions & 0 deletions src/components/ImageViewer/ImageSource.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<div>
<p v-html="source.label" />
</div>
</template>

<script setup>
defineProps({
source: {
type: Object,
default: () => ({})
}
})
</script>
5 changes: 5 additions & 0 deletions src/components/ImageViewer/ImageViewer.global.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
class="my-auto"
:attribution="image.attribution"
/>
<ImageSource
class="my-auto"
:source="image.source"
/>
</div>
<div class="flex justify-center">
<GalleryThumbnailList
Expand All @@ -77,6 +81,7 @@
import { onMounted, onUnmounted, ref, watch, computed } from 'vue'
import ImageAttribution from './ImageAttribution.vue'
import ImageDepictions from './ImageDepictions.vue'
import ImageSource from './ImageSource.vue'
import ImageViewerCounter from './ImageViewerCounter.vue'
import ControlNextImage from './ControlImageNext.vue'
import ControlPreviousImage from './ControlImagePrevious.vue'
Expand Down
2 changes: 1 addition & 1 deletion src/modules/otus/components/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ watch(
() => props.otuId,
async () => {
const params = {
extend: ['depictions', 'attribution'],
extend: ['depictions', 'attribution', 'source', 'citations'],
otu_scope: ['all']
}
Expand Down
18 changes: 5 additions & 13 deletions src/modules/otus/components/TypeSpecimen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,9 @@

<script setup>
import { ref, watch } from 'vue'
import { SPECIMEN_TYPES } from '../constants'
import OtuService from '../services/OtuService'
const TYPE_ORDER = [
'neotype',
'holotype',
'neolectotype',
'lectotype',
'syntype',
'paratype',
'paratypes'
]
const props = defineProps({
otuId: {
type: [String, Number],
Expand All @@ -37,11 +28,12 @@ const props = defineProps({
const typeMaterials = ref([])
watch(
() => props.otuId, async () => {
() => props.otuId,
() => {
if (!props.otuId) { return }
OtuService.getTypes(props.otuId).then(({ data }) => {
typeMaterials.value = data.type_materials_catalog_labels.sort((a, b) => TYPE_ORDER.indexOf(a.type_type) - TYPE_ORDER.indexOf(b.type_type))
typeMaterials.value = data.type_materials_catalog_labels.sort((a, b) => SPECIMEN_TYPES.indexOf(a.type_type) - SPECIMEN_TYPES.indexOf(b.type_type))
})
}, { immediate: true })
</script>
</script>
1 change: 1 addition & 0 deletions src/modules/otus/constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './typeOrder';
9 changes: 9 additions & 0 deletions src/modules/otus/constants/typeOrder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const SPECIMEN_TYPES = [
'neotype',
'holotype',
'neolectotype',
'lectotype',
'syntype',
'paratype',
'paratypes'
]

0 comments on commit aee74ca

Please sign in to comment.