Fixed implementation of disabled color selection
This commit is contained in:
parent
cd231a1faa
commit
319c578ba9
2 changed files with 29 additions and 23 deletions
|
@ -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"}
|
||||
|
|
|
@ -12,25 +12,27 @@
|
|||
</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">
|
||||
<div class="col-xs-11">
|
||||
<input type="checkbox" id="reserved" name="reserved"
|
||||
{% if meta.reserved_by -%}
|
||||
checked="checked"
|
||||
{%- endif -%}>
|
||||
<label for="reserved">Etiqueta:</label>
|
||||
<div class="row">
|
||||
<fieldset id="label-fieldset" disabled>
|
||||
<div class="col-xs-11">
|
||||
<input type="checkbox" id="reserved" name="reserved"
|
||||
{% if meta.reserved_by -%}
|
||||
checked="checked"
|
||||
{%- endif -%}>
|
||||
<label for="reserved">Etiqueta:</label>
|
||||
<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"
|
||||
|
@ -39,19 +41,19 @@
|
|||
{%- endif -%}
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
{% set meta_color = "black" %}
|
||||
{% if meta.color %}{% set meta_color = meta.color %}{% endif %}
|
||||
<div class="col-xs-6">
|
||||
{% set meta_color = "black" %}
|
||||
{% if meta.color %}{% set meta_color = meta.color %}{% endif %}
|
||||
|
||||
{% for color in valid_colors %}
|
||||
<span class="color-sample c-{{ color }}
|
||||
{%- if color == meta_color %} selected{% endif -%}"
|
||||
{%- if color != 'black' %} data-color="{{ color }}"{% endif %}
|
||||
><i class="fa fa-square"></i></span>
|
||||
{% endfor %}
|
||||
<input type="hidden" id="label-color" name="label-color" value=""/>
|
||||
{% for color in valid_colors %}
|
||||
<span class="color-sample c-{{ color }}
|
||||
{%- if color == meta_color %} selected{% endif -%}"
|
||||
{%- if color != 'black' %} data-color="{{ color }}"{% endif %}
|
||||
><i class="fa fa-square"></i></span>
|
||||
{% endfor %}
|
||||
<input type="hidden" id="label-color" name="label-color" value=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue