Map marker show abbreviated name

This commit is contained in:
Paulus Schoutsen 2015-09-25 07:43:35 -07:00
parent be2312de03
commit 431680a012
2 changed files with 11 additions and 3 deletions

View File

@ -30,6 +30,7 @@
<template is='dom-if' if='[[icon]]'>
<iron-icon icon='[[icon]]'></iron-icon>
</template>
<template is='dom-if' if='[[value]]'>[[value]]</template>
<template is='dom-if' if='[[image]]'>
<iron-image sizing='cover' class='fit'src='[[image]]'></iron-image>
</template>

View File

@ -31,6 +31,11 @@ export default new Polymer({
type: Object,
computed: 'computeImage(state)',
},
value: {
type: String,
computed: 'computeValue(state)',
},
},
listeners: {
@ -49,13 +54,15 @@ export default new Polymer({
},
computeIcon(state) {
return state ?
!state.attributes.entity_picture && domainIcon(state.domain) :
'home';
return !state && 'home';
},
computeImage(state) {
return state && state.attributes.entity_picture;
},
computeValue(state) {
return state &&
state.entityDisplay.split(' ').map(part => part.substr(0, 1)).join('');
},
});