1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-02-15 07:25:54 +00:00
Files
frontend/src/state-summary/state-card-script.html
Paulus Schoutsen 8b6db691ef Road to polymer 2 pt 2 (#310)
* Remove default-primary-color var

* Swap out paper-menu for paper-listbox
2017-06-18 19:30:18 -07:00

62 lines
1.6 KiB
HTML

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../components/entity/state-info.html">
<link rel="import" href="../components/entity/ha-entity-toggle.html">
<dom-module id="state-card-script">
<template>
<style is="custom-style" include="iron-flex iron-flex-alignment"></style>
<style>
paper-button {
color: var(--primary-color);
font-weight: 500;
top: 3px;
height: 37px;
margin-right: -.57em;
}
ha-entity-toggle {
margin-left: 16px;
}
</style>
<div class='horizontal justified layout'>
<state-info state-obj="[[stateObj]]" in-dialog='[[inDialog]]'></state-info>
<template is='dom-if' if='[[stateObj.attributes.can_cancel]]'>
<ha-entity-toggle state-obj='[[stateObj]]' hass='[[hass]]'></ha-entity-toggle>
</template>
<template is='dom-if' if='[[!stateObj.attributes.can_cancel]]'>
<paper-button on-tap='fireScript'>ACTIVATE</paper-button>
</template>
</div>
</template>
</dom-module>
<script>
Polymer({
is: 'state-card-script',
properties: {
inDialog: {
type: Boolean,
value: false,
},
stateObj: {
type: Object,
},
},
fireScript: function (ev) {
ev.stopPropagation();
this.hass.callService(
'script', 'turn_on',
{ entity_id: this.stateObj.entity_id });
},
});
</script>