Implementing search filter on Content Types and Content Parts screens.

--HG--
branch : 1.x
extra : rebase_source : 81dd70ddb4fadb4efc4d7d943fdd59d94bba9dd1
This commit is contained in:
Sipke Schoorstra
2013-03-11 22:21:20 +01:00
parent ffe345bfe0
commit e8640fda0c
7 changed files with 76 additions and 14 deletions

View File

@@ -5,6 +5,6 @@ Website: http://orchardproject.net
Version: 1.6
OrchardVersion: 1.5
Description: ContentTypes modules enables the creation and alteration of content types not based on code.
Dependencies: Contents
Dependencies: Contents, jQuery
Category: Content

View File

@@ -96,6 +96,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Scripts\admin-contenttypes.js" />
<Content Include="Styles\Images\menu.contenttypes.png" />
<Content Include="Styles\Images\move.gif" />
<Content Include="Styles\menu.contenttypes-admin.css" />
@@ -157,6 +158,11 @@
<ItemGroup>
<Content Include="Views\DefinitionTemplates\ContentPartSettings.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Scripts\Web.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
<handlers accessPolicy="Script,Read">
<!--
iis7 - for any request to a file exists on disk, return it via native http module.
accessPolicy 'Script' is to allow for a managed 404 page.
-->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>

View File

@@ -0,0 +1,16 @@
(function($) {
$(function() {
$("#search-box").focus().on("keyup", function() {
var text = $(this).val().toLowerCase();
if (text == "") {
$("[data-record-text]").show();
} else {
$("[data-record-text]").each(function() {
var recordText = $(this).data("record-text").toLowerCase();
$(this).toggle(recordText.indexOf(text) >= 0);
});
}
});
});
})(jQuery);

View File

@@ -1,14 +1,21 @@
@model Orchard.ContentTypes.ViewModels.ListContentTypesViewModel
@{
Style.Require("ContentTypesAdmin");
Script.Include("admin-contenttypes.js");
Layout.Title = T("Manage Content Types").ToString();
}
<div class="manage">
@Html.ActionLink(T("Create new type").ToString(), "Create", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button primaryAction" })
</div>
@Html.UnorderedList(
Model.Types,
(t,i) => Html.DisplayFor(m => t),
"contentItems"
)
<fieldset class="bulk-actions">
<label for="search-box">@T("Filter:")</label>
<input id="search-box" class="text-box" type="text" />
</fieldset>
<ul class="contentItems">
@foreach (var type in Model.Types) {
<li data-record-text="@type.DisplayName">
@Html.DisplayFor(m => type)
</li>
}
</ul>

View File

@@ -1,12 +1,19 @@
@model Orchard.ContentTypes.ViewModels.ListContentPartsViewModel
@{ Layout.Title = T("Content Parts").ToString(); }
@{
Script.Include("admin-contenttypes.js");
Layout.Title = T("Content Parts").ToString();
}
<div class="manage">
@Html.ActionLink(T("Create new part").ToString(), "CreatePart", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button primaryAction" })
</div>
@Html.UnorderedList(
Model.Parts,
(t,i) => Html.DisplayFor(m => t),
"contentItems"
)
<fieldset class="bulk-actions">
<label for="search-box">@T("Filter:")</label>
<input id="search-box" class="text-box" type="text" />
</fieldset>
<ul class="contentItems">
@foreach (var type in Model.Parts) {
<li data-record-text="@type.DisplayName">
@Html.DisplayFor(m => type)
</li>
}
</ul>

View File

@@ -899,6 +899,7 @@ table.items td .add
----------------------------------------------------------*/
.contentItems {
border:1px solid #eaeaea;
border-bottom: none;
background:#FFF;
clear:both;
margin:1em 0;