added lock_device()
This commit is contained in:
parent
8f2c127d9c
commit
f0f786324d
Binary file not shown.
|
@ -46,7 +46,6 @@ nav span:hover {
|
|||
background-color: whitesmoke;
|
||||
}
|
||||
|
||||
|
||||
.ip_address {
|
||||
font-size: 0.8em;
|
||||
font-style: italic;
|
||||
|
@ -78,12 +77,12 @@ nav span:hover {
|
|||
src: url("/static/fontawesome-webfont.woff2");
|
||||
}
|
||||
|
||||
.edit, .save {
|
||||
.edit, .save, .lock, .unlock {
|
||||
font-size: 0.8em;
|
||||
color: dimgrey;
|
||||
}
|
||||
|
||||
.edit:hover, .save:hover {
|
||||
.edit:hover, .save:hover, .lock:hover, .unlock:hover {
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -120,3 +120,20 @@ function new_device() {
|
|||
children[children.length - 1].id = json.device_id;
|
||||
});
|
||||
}
|
||||
|
||||
function lock_device(device) {
|
||||
let fields = device.querySelectorAll('.editable');
|
||||
fields.forEach(function(field) {
|
||||
field.querySelector('.edit').remove();
|
||||
});
|
||||
device.querySelector('.id').querySelector('.lock').remove();
|
||||
let unlock = document.createElement('span');
|
||||
unlock.innerHTML = '';
|
||||
unlock.className = 'unlock font-awesome';
|
||||
unlock.setAttribute('onclick', 'unlock_device(this.parentElement.parentElement)');
|
||||
device.querySelector('.id').appendChild(unlock);
|
||||
}
|
||||
|
||||
function unlock_device(device) {
|
||||
console.log(device);
|
||||
}
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
<div id="devices">
|
||||
{% for device in network %}
|
||||
<div class="device {{ device.type }}" id="{{ device.id }}">
|
||||
<div class="id">{{ device.id }}</div>
|
||||
<div class="description"><span class="field_value">{{ device.description }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="location"><span class="field_value">{{ device.location }}</span> <span class="edit font-awesome" onclick="edit_field(this.parentElement)"></span></div>
|
||||
<div class="ip_address"><span class="field_value"><i>{{ device.ip_address }}</i></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"><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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user