Adding search box in Features page

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros 2011-09-20 18:10:55 -07:00
parent 1eb7993111
commit 77a37ae4a1
2 changed files with 37 additions and 4 deletions

View File

@ -1,5 +1,5 @@
.switch-for-switchable {
margin:0 0 -8px;
margin:0 0;
overflow:auto;
}
.switch-for-switchable .switch-button-group {

View File

@ -28,7 +28,7 @@
//temporarily "disable" actions on core features
bool showActions;
<li class="@categoryClassName">
<li class="category @categoryClassName">
<h2>@categoryName</h2>
<ul>@{
var features = featureGroup.OrderBy(f => f.Descriptor.Name);
@ -54,7 +54,7 @@
var missingDependencies = feature.Descriptor.Dependencies
.Where(d => !Model.Features.Any(f => f.Descriptor.Id == d));
showActions = categoryName.ToString() != "Core" && missingDependencies.Count() == 0;
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
<li class="feature @featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
<div class="summary">
<div class="properties">
<h3>@featureName</h3>
@ -101,4 +101,37 @@
</li>}
}</ul>
</li>}
}</ul>}
}</ul>}
@using(Script.Foot()) {
<script type="text/javascript">
//<![CDATA[
$(function () {
var searchBox = $("<span class=\"hint\">Filter</span> <input id=\"search-box\" class=\"text-box\" type=\"text\" />");
var theSwitch = $(".switch-for-switchable");
theSwitch.prepend(searchBox);
$("#search-box").focus().keyup(function () {
var text = $(this).val();
if (text == '') {
$("li.category").show();
$("li.feature:hidden").show();
return;
}
$("li.feature").each(function () {
var elt = $(this);
var value = elt.find('h3:first').text();
if (value.toLowerCase().indexOf(text.toLowerCase()) >= 0)
elt.show();
else
elt.hide();
});
$("li.category:hidden").show();
var toHide = $("li.category:not(:has(li.feature:visible))").hide();
});
})
//]]>
</script>
}