Juice/templates/LightStrip.html

109 lines
7.4 KiB
HTML

<div class="device {{ device.type }}" id="{{ device.id }}">
<div class="id editable"><span class="field_value">{{ device.id }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span><span class="delete font-awesome" onclick="delete_device(this.parentElement.parentElement)">&#xe804;</span><span class="lock font-awesome" onclick="lock_device(this.parentElement.parentElement)">&#xe803;</span>{% else %}<span class="unlock font-awesome" onclick="unlock_device(this.parentElement.parentElement)">&#xf13e;</span>{% endif %}</div>
<div class="description editable"><span class="field_value">{{ device.description }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span>{% endif %}</div>
<div class="location editable"><span class="field_value">{{ device.location }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span>{% endif %}</div>
<div class="mqtt_root editable"><span class="field_value">{{ device.mqtt_root }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span>{% endif %}</div>
<div class="light_controls">
<div class="state">
<span>State</span><br>
<select class="state_select" onchange="state_select(this)">
<option{% if device.state == 'solid' %} selected{% endif %} value="solid">Solid</option>
<option{% if device.state == 'rainbow' %} selected{% endif %} value="rainbow">Rainbow</option>
<option{% if device.state == 'america' %} selected{% endif %} value="america">America</option>
</select>
<div class="state_solid" style="display: {% if device.state == 'solid' %}block{% else %}none{% endif %}">
<input type="radio" id="state_solid_all_{{ device.id }}" name="state_solid_{{ device.id }}" value="all" onchange="state_solid_amount(this)" checked>
<label for="state_solid_all_{{ device.id }}">All</label><br>
<input type="radio" id="state_solid_single_{{ device.id }}" name="state_solid_{{ device.id }}" value="single" onchange="state_solid_amount(this)">
<label for="state_solid_single_{{ device.id }}">Single</label><br>
<label for="state_solid_all_color_{{ device.id }}">All:</label>
<input type="color" id="state_solid_all_color_{{ device.id }}" value="{{ device.sub_devices[0].color|html_color }}" onchange="neopixel_state(this.closest('.device'))">
</div>
<div class="state_rainbow" style="display: {% if device.state == 'rainbow' %}block{% else %}none{% endif %}">
<table>
<tr>
<td>Red</td>
<td>
<input type="number" id="state_rainbow_red_freq_{{ device.id }}" min="0" max="1" step="0.1" value="{{ device.rainbow_params[0] }}" onchange="neopixel_state(this.closest('.device'))">
<label for="state_rainbow_red_freq_{{ device.id }}">f</label>
</td>
<td>
<input type="number" id="state_rainbow_red_phase_{{ device.id }}" min="0" max="10" step="1" value="{{ device.rainbow_params[3] }}" onchange="neopixel_state(this.closest('.device'))">
<label for="state_rainbow_red_phase_{{ device.id }}">Φ</label>
</td>
</tr>
<tr>
<td>Green</td>
<td>
<input type="number" id="state_rainbow_green_freq_{{ device.id }}" min="0" max="1" step="0.1" value="{{ device.rainbow_params[1] }}" onchange="neopixel_state(this.closest('.device'))">
<label for="state_rainbow_green_freq_{{ device.id }}">f</label>
</td>
<td>
<input type="number" id="state_rainbow_green_phase_{{ device.id }}" min="0" max="10" step="1" value="{{ device.rainbow_params[4] }}" onchange="neopixel_state(this.closest('.device'))">
<label for="state_rainbow_green_phase_{{ device.id }}">Φ</label>
</td>
</tr>
<tr>
<td>Blue</td>
<td>
<input type="number" id="state_rainbow_blue_freq_{{ device.id }}" min="0" max="1" step="0.1" value="{{ device.rainbow_params[2] }}" onchange="neopixel_state(this.closest('.device'))">
<label for="state_rainbow_blue_freq_{{ device.id }}">f</label>
</td>
<td>
<input type="number" id="state_rainbow_blue_phase_{{ device.id }}" min="0" max="10" step="1" value="{{ device.rainbow_params[5] }}" onchange="neopixel_state(this.closest('.device'))">
<label for="state_rainbow_blue_phase_{{ device.id }}">Φ</label>
</td>
</tr>
<tr>
<td><label for="state_rainbow_center_{{ device.id }}">Center</label></td>
<td><input type="number" id="state_rainbow_center_{{ device.id }}" min="0" max="255" step="1" value="{{ device.rainbow_params[6] }}" onchange="neopixel_state(this.closest('.device'))"></td>
</tr>
<tr>
<td><label for="state_rainbow_width_{{ device.id }}">Width</label></td>
<td><input type="number" id="state_rainbow_width_{{ device.id }}" min="0" max="128" step="1" value="{{ device.rainbow_params[7] }}" onchange="neopixel_state(this.closest('.device'))"></td>
</tr>
</table>
</div>
<div class="state_america" style="display: {% if device.state == 'america' %}block{% else %}none{% endif %}">
<table>
<tr>
<td><label for="state_america_stripe_{{ device.id }}">Stripe Length</label></td>
<td><input type="number" id="state_america_stripe_{{ device.id }}" min="1" max="256" step="1" value="{{ device.america_params[0] }}" onchange="neopixel_state(this.closest('.device'))"></td>
</tr>
<tr>
<td><label for="state_america_magnitude_{{ device.id }}">Magnitude</label></td>
<td><input type="number" id="state_america_magnitude_{{ device.id }}" min="0" max="255" step="1" value="{{ device.america_params[1] }}" onchange="neopixel_state(this.closest('.device'))"></td>
</tr>
</table>
</div>
</div>
<div class="animation">
<span>Animation</span><br>
<select class="animation_select" onchange="animation_select(this)">
<option{% if device.animation == 'static' %} selected{% endif %} value="static">Static</option>
<option{% if device.animation == 'rotate_left' %} selected{% endif %} value="rotate_left">Rotate Left</option>
<option{% if device.animation == 'rotate_right' %} selected{% endif %} value="rotate_right">Rotate Right</option>
</select>
<div class="animation_static" style="display: {% if device.animation == 'static' %}block{% else %}none{% endif %}">
</div>
<div class="animation_rotate" style="display: {% if device.animation == 'rotate_left' or device.animation == 'rotate_right' %}block{% else %}none{% endif %}">
<label for="animation_rotate_count_{{ device.id }}">Rotate Count</label>
<input type="number" id="animation_rotate_count_{{ device.id }}" min="1" max="255" step="1" value="{{ device.animation_rotate_count }}" onchange="neopixel_animation(this.closest('.device'))">
</div>
Delay
<input type="number" id="animation_delay_{{ device.id }}" min="1" max="255" step="1" value="{{ device.animation_delay }}" onchange="neopixel_animation(this)">
<label for="animation_delay{{ device.id }}">ms</label>
</div>
</div>
<div class="sub_devices">
{% for sub_device in device.sub_devices %}
<div class="sub_device {{ sub_device.type }} {{ sub_device.id }}">
<label class="NeoPixel_color" style="background-color: {{ sub_device.color|html_color }}">
<input class="NeoPixel_color_input" type="color" value="{{ sub_device.color|html_color }}" onchange="neopixel_state(this.closest('.sub_device'))" disabled>
</label>
</div>
{% endfor %}
</div>
</div>