wvhn
Können wir den Dimmer noch um eine Option erweitern, so das man das Einschaltsymbol auch als Button darstellen kann?
Mein Vorschlag:
Nur wird der Button dann nicht mehr neben dem Slider dargestellt…
Grüße, Marc
Können wir den Dimmer noch um eine Option erweitern, so das man das Einschaltsymbol auch als Button darstellen kann?
Mein Vorschlag:
Code:
/** * Standard dimmer with switching and dimming function * * @param {id=} unique id for this widget (optional) * @param {text=} name of the dimmer * @param {item(bool,num)} an item for switching * @param {item(num)} an item for dimming * @param {value=0} the minimum value if the slider is moved to total left (optional, default: 0) * @param {value=255} the maximum value if the slider is moved to total right (optional, default: 255) * @param {value=5} step between two values (optional, default: 5) * @param {image=light_light} the pic for the 'on' state (optional) * @param {image=light_light} the pic for the 'off' state (optional) * @param {color(icon0to5)=icon1} the color for the 'on' state (optional) * @param {color(icon0to5)=icon0} the color for the 'off' state (optional) * @param {text(input,handle,both,none)=none} how should the value be shown; possible options: 'input', 'handle', 'both', 'none' (optional, default 'none') * @param {value=} the minimum value to display if the slider is moved to total left if this should differ from sent/received value (optional, default like min) * @param {value=} the maximum value to display if the slider is moved to total right if this should differ from sent/received value (optional, default like max) * @param {text(left,right)=left} position of the switch: left (default) or right * @param {value=1} 'live mode': if enabled, values will be sent during sliding. '0' sends values only when sliding is stopped, after click into track or if value is edited in input field. (optional, default = 1) * @param {value='micro', 'mini', 'midi', 'icon'} 'type': (optional, default = ‚icon‘) */ {% macro dimmer(id, txt, item_switch, item_value, min, max, step, pic_on, pic_off, color_on, color_off, value_display, min_display, max_display, picpos, live, type) %} {% import "@widgets/basic.html" as basic %} {% if picpos is empty or picpos=='left' %}<div class="dimmer-left" {% else %} <div class="dimmer-right" {% endif %} data-widget="device.dimmer"{% if not id is empty %} id="{{ uid(page, id) }}"{% endif %}> {{ basic.stateswitch('', item_switch, [type|default('icon')], '', [ pic_off|default('light_light.svg'), pic_on|default('light_light.svg') ], '', [ color_off , color_on|default('icon1') ]) }} <p>{{ txt|e }}</p> {{ basic.slider('', item_value, min, max, step, 'horizontal', value_display|default('none'), min_display, max_display, live) }} </div> {% endmacro %}

Grüße, Marc
Kommentar