Rename domain-card -> entities-card

This commit is contained in:
Paulus Schoutsen 2016-02-16 21:24:09 -08:00
parent 70b04333f1
commit 1fb3f2bbf4
4 changed files with 11 additions and 13 deletions

View File

@ -4,7 +4,7 @@
<link rel='import' href='../components/entity/ha-entity-toggle.html'>
<link rel='import' href='../state-summary/state-card-content.html'>
<dom-module id='ha-domain-card'>
<dom-module id='ha-entities-card'>
<style>
.states {
padding-bottom: 16px;
@ -29,7 +29,7 @@
<template>
<ha-card>
<div class='header horizontal layout center'>
<div class='flex name'>[[computeDomainTitle(domain)]]</div>
<div class='flex name'>[[computeTitle(states, groupEntity)]]</div>
<template is='dom-if' if='[[showGroupToggle(groupEntity, states)]]'>
<ha-entity-toggle state-obj='[[groupEntity]]'></ha-entity-toggle>
</template>

View File

@ -9,12 +9,9 @@ require('../state-summary/state-card-content');
const { moreInfoActions } = hass;
export default new Polymer({
is: 'ha-domain-card',
is: 'ha-entities-card',
properties: {
domain: {
type: String,
},
states: {
type: Array,
},
@ -23,8 +20,9 @@ export default new Polymer({
},
},
computeDomainTitle(domain) {
return domain.replace(/_/g, ' ');
computeTitle(states, groupEntity) {
return groupEntity ? groupEntity.entityDisplay :
states[0].domain.replace(/_/g, ' ');
},
entityTapped(ev) {
@ -43,6 +41,6 @@ export default new Polymer({
}
// only show if we can toggle 2+ entities in group
return states.reduce((sum, state) => sum + canToggle(state.entityId), 0) > 1;
return states.reduce((sum, state) => sum + canToggle(state.entityId)) > 1;
},
});

View File

@ -2,7 +2,7 @@
<link rel="import" href="./ha-demo-badge.html">
<link rel="import" href="../cards/ha-badges-card.html">
<link rel="import" href="../cards/ha-domain-card.html">
<link rel="import" href="../cards/ha-entities-card.html">
<link rel="import" href="../cards/ha-introduction-card.html">
<dom-module id="ha-cards">
@ -77,10 +77,10 @@
</template>
<template is='dom-repeat' items='[[column]]' as='domain'>
<div class='zone-card'>
<ha-domain-card domain='[[domain]]'
<ha-entities-card
states='[[computeStatesOfCard(cards, domain)]]'
group-entity='[[computeGroupEntityOfCard(cards, domain)]]'
></ha-domain-card>
></ha-entities-card>
</div>
</template>
</div>

View File

@ -3,7 +3,7 @@ import hass from '../util/home-assistant-js-instance';
require('.//ha-demo-badge');
require('../cards/ha-badges-card');
require('../cards/ha-domain-card');
require('../cards/ha-entities-card');
require('../cards/ha-introduction-card');
const { util } = hass;