Admin Nav Search

Topics: Customizing Orchard
Aug 26, 2013 at 8:49 AM
I quickly wrote the following code to create a Admin Nav Filter.
I am looking for someone who could suggest better optimized code for the same function

Please try the following and lemme know your thoughts

File : <orchard path>\Themes\TheAdmin\Views\menu.cshtml

Section : @using (Script.Foot()){....................}

Code :
(function ($) {
        $("ul.menu-admin").prepend('<li id="NavFilter"><div ><input id="AdminFilter"  type="text" style="padding: 5px 5px;width: 93%;"> </div></li>'); var allLI = $("ul.menu-admin li ul li").not("#NavFilter"); var headLI = $("ul.menu-admin li h3"); var filteredChildLI; var filteredHeadLI; $("#AdminFilter").keyup(function () { var a = $(this).val(); filteredHeadLI = headLI.filter(function (b, c) { return $(c).text().toLowerCase().indexOf(a) !== -1 }); headLI.show(); headLI.parent().hide(); filteredHeadLI.parent().show(); if (filteredHeadLI.length == 0) { headLI.parent().hide(); filteredChildLI = allLI.filter(function (b, c) { return $(c).text().toLowerCase().indexOf(a) !== -1 }); allLI.hide(); filteredChildLI.parent().parent().show(); filteredChildLI.show() } else { allLI.show() } });

    })(jQuery);

Coordinator
Aug 28, 2013 at 12:09 AM
Interesting, we have also had some discussion about adding a search box to search for content and actions like the one you have done here.
Aug 28, 2013 at 1:44 AM
I would appreciate if someone tries it and rate its value. I would want this to become a part of orchard since I know a few ppl asking for this feature.

Question : The search box for the content and actions that you are looking for. Is that for what's on the current page or across the whole dashboard?