From ad2701003fb2e65f6db84e3ee922292403b21fdc Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Wed, 7 Nov 2018 09:07:51 +1300 Subject: [PATCH] Add search to layer dependencies list on edit/submit layer form The layer index has quite a number of layers in it these days and thus this list is quite long to scroll through. Use the same layer filtering method as we do on the layers page for the dependencies list. Signed-off-by: Paul Eggleton --- templates/layerindex/editlayer.html | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/templates/layerindex/editlayer.html b/templates/layerindex/editlayer.html index c79d488..a06c317 100644 --- a/templates/layerindex/editlayer.html +++ b/templates/layerindex/editlayer.html @@ -1,11 +1,12 @@ {% extends "base.html" %} {% load i18n %} +{% load static %} {% comment %} layerindex-web - layer editing form page template - Copyright (C) 2013 Intel Corporation + Copyright (C) 2013-2018 Intel Corporation Licensed under the MIT license, see COPYING.MIT for details {% endcomment %} @@ -52,8 +53,12 @@
{% if field.name == 'deps' %} +
+ + +
- +
{% for deplayer in deplistlayers %} {% if deplayer.id in form.checked_deps %} @@ -382,6 +387,11 @@ return false; } + function clearLayerSearch() { + $("#layersearchtext").val(''); + $(".layerstable > tbody > tr").show(); + } + $(document).ready(function() { $('.maintainerform').hide() @@ -408,5 +418,18 @@ if( ! firstfield.val() ) firstfield.focus() }); + + $("#layersearchtext").on("input", function() { + var value = $(this).val().toLowerCase(); + $(".layerstable > tbody > tr").filter(function() { + $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) + }); + }); + + $("#layersearchclear").click(function(){ + clearLayerSearch(); + $("#layersearchtext").focus(); + }); + {% endblock %}