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 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.97
ff:ff:ff:ff:ff:fe,10.6.122.98 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.99
ff:ff:ff:ff:ff:fe,10.6.122.100 ff:ff:ff:ff:ff:fe,10.6.122.100
# {"reserved-by": "Andy"} # {"reserved-by": "Andy"}

View file

@ -12,14 +12,16 @@
</div> </div>
{% if meta.locked %} {% 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 %} {% endif %}
<div class="row"> <div class="row">
<form class="form-horizontal" method="POST"> <form class="form-horizontal" method="POST">
{% if meta.locked %} {% if meta.locked %}
<fieldset disabled> <fieldset id="whole-fieldset" disabled>
{% endif %} {% endif %}
<div class="form-group"> <div class="form-group">
@ -29,8 +31,8 @@
checked="checked" checked="checked"
{%- endif -%}> {%- endif -%}>
<label for="reserved">Etiqueta:</label> <label for="reserved">Etiqueta:</label>
<div class="row">
<fieldset id="label-fieldset" disabled> <fieldset id="label-fieldset" disabled>
<div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
<input type="text" class="form-control" <input type="text" class="form-control"
id="reserved-by" name="reserved-by" id="reserved-by" name="reserved-by"
@ -132,7 +134,11 @@
$("#dhcp-specific-fieldset").prop("disabled", !$("#dhcp-client-specific").prop("checked")); $("#dhcp-specific-fieldset").prop("disabled", !$("#dhcp-client-specific").prop("checked"));
}) })
$(".color-sample").click(function() { $(".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; return;
$(".color-sample").removeClass("selected"); $(".color-sample").removeClass("selected");
$(this).addClass("selected"); $(this).addClass("selected");