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]]'> <template is='dom-if' if='[[icon]]'>
<iron-icon icon='[[icon]]'></iron-icon> <iron-icon icon='[[icon]]'></iron-icon>
</template> </template>
<template is='dom-if' if='[[value]]'>[[value]]</template>
<template is='dom-if' if='[[image]]'> <template is='dom-if' if='[[image]]'>
<iron-image sizing='cover' class='fit'src='[[image]]'></iron-image> <iron-image sizing='cover' class='fit'src='[[image]]'></iron-image>
</template> </template>

View File

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