Skip to content

Commit

Permalink
re #67
Browse files Browse the repository at this point in the history
  • Loading branch information
wellcaffeinated committed Aug 17, 2020
1 parent 7ab2ba4 commit a0e314a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/tol-leaf-view/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,22 @@
a.toolbar-control(@click="hovering && $emit('remove', leaf.node_id)", @touchstart="hovering && $emit('remove', leaf.node_id)")
b-icon(icon="close-network", size="is-large")
.minimal(v-if="!isAddedToTree", @click="$emit('add-node', leaf.node_id)")
.card-title {{ (commonName || shortScientificName) | titleCase }}
.card-title {{ commonName || shortScientificName }}
//- .pin-btn
//- b-icon(icon="file-plus", size="is-small")
</template>

<script>
import _capitalize from 'lodash/capitalize'
import LeafViewMenu from './leaf-view-menu'
import { getTxnInfo, isMRCA } from '@/lib/taxonomy'
import { getSubtree } from '@/lib/otol'
import TaxonomyInfoWindow from '@/components/taxonomy-info-window'
function titleCase( str = '' ){
return str.split(' ').map( w => _capitalize(w) ).join(' ')
}
function shortName( str, target ){
let words = str.split(' ')
let out = str
Expand Down Expand Up @@ -147,11 +152,11 @@ export default {
if ( this.isMRCA ){ return '' }
if ( !this.txnInfo || !this.txnInfo.vernacularNameList ){
if ( this.otherCommonNames ){
return this.otherCommonNames[0]
return titleCase(this.otherCommonNames[0])
}
return ''
}
return this.txnInfo.vernacularNameList
return titleCase(this.txnInfo.vernacularNameList)
}
, shortScientificName(){
return shortName(this.scientificName, this.isMRCA ? 1000 : this.truncateLength)
Expand Down

0 comments on commit a0e314a

Please sign in to comment.