diff --git a/TODO b/TODO
index f8201b9..a9b9ec1 100644
--- a/TODO
+++ b/TODO
@@ -39,7 +39,6 @@ Features
* Ability for reviewers to comment before publishing a layer?
* Show a note at the top of the layer edit form if there's a validation error
* Show count in duplicates page
-* Search on layer selection dialogs
* Close buttons on site-wide messages (using cookie to keep closed ?)
diff --git a/templates/layerindex/classicrecipes.html b/templates/layerindex/classicrecipes.html
index b7d961d..b2f46f8 100644
--- a/templates/layerindex/classicrecipes.html
+++ b/templates/layerindex/classicrecipes.html
@@ -1,5 +1,6 @@
{% extends "layerindex/classic_base.html" %}
{% load i18n %}
+{% load static %}
{% comment %}
@@ -94,6 +95,10 @@
+
@@ -402,6 +407,10 @@
});
}
}
+ function clearLayerSearch() {
+ $("#layersearchtext").val('');
+ $(".layerstable > tbody > tr").show();
+ }
$(document).ready(function() {
$('#id_selectedlayers_display').prop('readonly', true)
$('#id_excludeclasses_display').prop('readonly', true)
@@ -412,16 +421,17 @@
firstfield.focus()
});
$('#id_layerdialog_select_all').click(function (e) {
- $('.filterlayercheckbox').prop('checked', true);
+ $('.layerstable').find('tr:visible').find('.filterlayercheckbox').prop('checked', true);
});
$('#id_layerdialog_select_none').click(function (e) {
- $('.filterlayercheckbox').prop('checked', false);
+ $('.layerstable').find('tr:visible').find('.filterlayercheckbox').prop('checked', false);
});
$('#id_layerdialog_ok').click(function (e) {
update_selected_layer_display()
});
$('#id_select_layers').click(function (e) {
- setup_layer_list()
+ clearLayerSearch();
+ setup_layer_list();
});
$('#id_excludeclassdialog_select_none').click(function (e) {
$('.filterclasscheckbox').prop('checked', false);
@@ -435,6 +445,16 @@
$('#id_reversed').click(function (e) {
update_filters_enabled()
});
+ $("#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();
+ });
{% block scripts_extra %}
{% endblock %}
diff --git a/templates/layerindex/duplicates.html b/templates/layerindex/duplicates.html
index f5eed6c..41af842 100644
--- a/templates/layerindex/duplicates.html
+++ b/templates/layerindex/duplicates.html
@@ -1,5 +1,6 @@
{% extends "base_toplevel.html" %}
{% load i18n %}
+{% load static %}
{% comment %}
@@ -48,8 +49,12 @@