prevent locking while edit_field is open
This commit is contained in:
parent
b3111c8d12
commit
b942ab8e71
|
@ -80,6 +80,7 @@ nav span:hover {
|
|||
.edit, .save, .lock, .unlock {
|
||||
font-size: 0.8em;
|
||||
color: dimgrey;
|
||||
margin-left: 0.4em;
|
||||
}
|
||||
|
||||
.edit:hover, .save:hover, .lock:hover, .unlock:hover {
|
||||
|
|
|
@ -122,6 +122,7 @@ function new_device() {
|
|||
}
|
||||
|
||||
function lock_device(device) {
|
||||
if (device.querySelector('.save')) { return; }
|
||||
let fields = device.querySelectorAll('.editable');
|
||||
fields.forEach(function(field) {
|
||||
field.querySelector('.edit').remove();
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
<div id="devices">
|
||||
{% for device in network %}
|
||||
<div class="device {{ device.type }}" id="{{ device.id }}">
|
||||
<div class="id editable"><span class="field_value">{{ device.id }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span> <span class="lock font-awesome" onclick="lock_device(this.parentElement.parentElement)"></span></div>
|
||||
<div class="description editable"><span class="field_value">{{ device.description }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="location editable"><span class="field_value">{{ device.location }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="ip_address editable"><span class="field_value">{{ device.ip_address }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="id editable"><span class="field_value">{{ device.id }}</span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span><span class="lock font-awesome" onclick="lock_device(this.parentElement.parentElement)"></span></div>
|
||||
<div class="description editable"><span class="field_value">{{ device.description }}</span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="location editable"><span class="field_value">{{ device.location }}</span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="ip_address editable"><span class="field_value">{{ device.ip_address }}</span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="sub_devices">
|
||||
{% for sub_dev in device.sub_devices %}
|
||||
<div class="sub_device {{ sub_dev.type }}" id="{{ sub_dev.id }}">
|
||||
<div class="id">{{ sub_dev.id }}</div>
|
||||
<object class="outlet_image" data="/static/outlet.svg"></object>
|
||||
<div class="description editable"><span class="field_value">{{ sub_dev.description }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="description editable"><span class="field_value">{{ sub_dev.description }}</span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -38,19 +38,19 @@
|
|||
<template id="RelayDevice_template">
|
||||
<div class="device RelayDevice" id="">
|
||||
<div class="id"></div>
|
||||
<div class="description"><span class="field_value"></span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="location"><span class="field_value"></span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="ip_address"><span class="field_value"></span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="description"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="location"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="ip_address"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="sub_devices">
|
||||
<div class="sub_device RelayOutlet" id="OUT0">
|
||||
<div class="id">OUT0</div>
|
||||
<object class="outlet_image" data="/static/outlet.svg"></object>
|
||||
<div class="description"><span class="field_value"></span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="description"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
</div>
|
||||
<div class="sub_device RelayOutlet" id="OUT2">
|
||||
<div class="id">OUT2</div>
|
||||
<object class="outlet_image" data="/static/outlet.svg"></object>
|
||||
<div class="description"><span class="field_value"></span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="description"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user