Compare commits
2 commits
9e33d3c7df
...
a1ecac5cb8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1ecac5cb8 | ||
|
|
3534fbcccf |
|
|
@ -645,6 +645,7 @@ class CookCliCardEditor extends HTMLElement {
|
||||||
* type: custom:cookcli-checklist-card
|
* type: custom:cookcli-checklist-card
|
||||||
* storage_key: chocolat-chaud.cook:2
|
* storage_key: chocolat-chaud.cook:2
|
||||||
* items: [{ quantity: "200 ml", name: "lait" }, ...]
|
* items: [{ quantity: "200 ml", name: "lait" }, ...]
|
||||||
|
* title: Ingrédients # optionnel
|
||||||
*/
|
*/
|
||||||
class CookCliChecklistCard extends HTMLElement {
|
class CookCliChecklistCard extends HTMLElement {
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
|
|
@ -739,6 +740,13 @@ class CookCliChecklistCard extends HTMLElement {
|
||||||
this.shadowRoot.innerHTML = `
|
this.shadowRoot.innerHTML = `
|
||||||
<style>
|
<style>
|
||||||
ha-card { padding: 8px 16px; }
|
ha-card { padding: 8px 16px; }
|
||||||
|
.title {
|
||||||
|
padding: 8px 0 4px;
|
||||||
|
font-size: var(--ha-card-header-font-size, 24px);
|
||||||
|
font-weight: var(--ha-card-header-font-weight, 400);
|
||||||
|
line-height: 32px;
|
||||||
|
color: var(--ha-card-header-color, var(--primary-text-color));
|
||||||
|
}
|
||||||
.row {
|
.row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -771,6 +779,7 @@ class CookCliChecklistCard extends HTMLElement {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<ha-card>
|
<ha-card>
|
||||||
|
${this._config.title ? `<div class="title">${this._escape(this._config.title)}</div>` : ""}
|
||||||
${rows}
|
${rows}
|
||||||
<button class="reset" data-reset>Tout décocher</button>
|
<button class="reset" data-reset>Tout décocher</button>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
|
|
|
||||||
|
|
@ -343,6 +343,7 @@ class CookCliRecipeViewStrategy extends HTMLElement {
|
||||||
if (ingredients.length) {
|
if (ingredients.length) {
|
||||||
rightCards.push({
|
rightCards.push({
|
||||||
type: "custom:cookcli-checklist-card",
|
type: "custom:cookcli-checklist-card",
|
||||||
|
title: "Ingrédients",
|
||||||
// État coché propre à cette recette, indépendant de celui des étapes.
|
// État coché propre à cette recette, indépendant de celui des étapes.
|
||||||
storage_key: `${config.path}:summary`,
|
storage_key: `${config.path}:summary`,
|
||||||
items: ingredients.map((ingredient) => {
|
items: ingredients.map((ingredient) => {
|
||||||
|
|
@ -393,6 +394,7 @@ class CookCliRecipeViewStrategy extends HTMLElement {
|
||||||
if (stepIngredients.length) {
|
if (stepIngredients.length) {
|
||||||
leftCards.push({
|
leftCards.push({
|
||||||
type: "custom:cookcli-checklist-card",
|
type: "custom:cookcli-checklist-card",
|
||||||
|
title: "Ingrédients",
|
||||||
// recette + étape : l'état coché est propre à chaque étape de chaque recette
|
// recette + étape : l'état coché est propre à chaque étape de chaque recette
|
||||||
storage_key: `${config.path}:${tabIndex}`,
|
storage_key: `${config.path}:${tabIndex}`,
|
||||||
items: stepIngredients.map((item) => ({
|
items: stepIngredients.map((item) => ({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue