From 063b753892cb0fe5faa4730a2a3bc0ec531c1241 Mon Sep 17 00:00:00 2001 From: Garvin Hicking <blog@garv.in> Date: Thu, 24 Apr 2014 15:21:25 +0200 Subject: [PATCH] Proof of concept idea for the "filter category" idea http://board.s9y.org/viewtopic.php?f=11&t=19862 --- templates/2k11/admin/entries.tpl | 6 ++++++ templates/2k11/admin/serendipity_editor.js.tpl | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/templates/2k11/admin/entries.tpl b/templates/2k11/admin/entries.tpl index 361b9f17..614eda55 100644 --- a/templates/2k11/admin/entries.tpl +++ b/templates/2k11/admin/entries.tpl @@ -107,6 +107,12 @@ <div id="edit_entry_category" class="clearfix mfp-hide"> <fieldset> <span class="wrap_legend"><legend>{$CONST.CATEGORY}</legend></span> + + <div class="category_filter"> + <label for="categoryfilter">{$CONST.FILTERS}</label> + <input type="text" id="categoryfilter"> + </div> + {foreach from=$entry_vars.category_options item="entry_cat"} <div class="form_check"> {$entry_cat.depth_pad} diff --git a/templates/2k11/admin/serendipity_editor.js.tpl b/templates/2k11/admin/serendipity_editor.js.tpl index 2c5f58bc..8647d393 100644 --- a/templates/2k11/admin/serendipity_editor.js.tpl +++ b/templates/2k11/admin/serendipity_editor.js.tpl @@ -983,6 +983,22 @@ $(function() { } {/if} + $('#categoryfilter').keyup(function() { + var current_categoryfilter = $(this).val().toLowerCase(); + + if (current_categoryfilter == '') { + $('#edit_entry_category .form_check').toggle(true); + } else { + $('#edit_entry_category .form_check').each(function() { + if ($(this).find('label').html().toLowerCase().indexOf(current_categoryfilter) > -1) { + $(this).toggle(true); + } else { + $(this).toggle(false); + } + }); + } + }); + // Advanced options if($('#advanced_options').length > 0) { $('#toggle_advanced').click(function() {