Fixed implementation of disabled color selection

This commit is contained in:
Andy Teijelo Pérez 2015-11-07 23:32:11 -05:00
parent cd231a1faa
commit 319c578ba9
2 changed files with 29 additions and 23 deletions

View file

@ -98,7 +98,7 @@ ff:ff:ff:ff:ff:fe,10.6.122.95
00:23:54:8c:65:13,10.6.122.96,set:client0023548c6513
ff:ff:ff:ff:ff:fe,10.6.122.97
ff:ff:ff:ff:ff:fe,10.6.122.98
# {"color": "purple", "reserved-by": "Zelda"}
# {"color": "red", "reserved-by": "Zelda"}
ff:ff:ff:ff:ff:fe,10.6.122.99
ff:ff:ff:ff:ff:fe,10.6.122.100
# {"reserved-by": "Andy"}

View file

@ -12,14 +12,16 @@
</div>
{% if meta.locked %}
<div class="alert alert-warning"><i class="fa fa-lock"></i> Esta dirección está reservada por <i>Ilúvatar</i></div>
<div class="row">
<div class="alert alert-warning"><i class="fa fa-lock"></i> Esta dirección está reservada por <i>Ilúvatar</i></div>
</div>
{% endif %}
<div class="row">
<form class="form-horizontal" method="POST">
{% if meta.locked %}
<fieldset disabled>
<fieldset id="whole-fieldset" disabled>
{% endif %}
<div class="form-group">
@ -29,8 +31,8 @@
checked="checked"
{%- endif -%}>
<label for="reserved">Etiqueta:</label>
<div class="row">
<fieldset id="label-fieldset" disabled>
<div class="row">
<div class="col-xs-6">
<input type="text" class="form-control"
id="reserved-by" name="reserved-by"
@ -132,7 +134,11 @@
$("#dhcp-specific-fieldset").prop("disabled", !$("#dhcp-client-specific").prop("checked"));
})
$(".color-sample").click(function() {
if ($("#label-fieldset").prop("disabled"))
var disabled = false;
$(this).parents("fieldset").each(function() {
disabled = $(this).prop("disabled") || disabled;
});
if (disabled)
return;
$(".color-sample").removeClass("selected");
$(this).addClass("selected");