Adding paging to search

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-06-05 01:26:14 -07:00
parent 412d21b234
commit 40f7b8bd8c
4 changed files with 89 additions and 10 deletions

View File

@@ -4,8 +4,9 @@ Html.RegisterStyle("search.css"); %>
<h1><%=Html.TitleForPage(T("Search").Text)%></h1><%
Html.Zone("search");
if (!string.IsNullOrWhiteSpace(Model.Query)) { %>
<p class="search-summary"><%=T("<em>{0}</em> results", Model.Results.Count()) %></p><%
<p class="search-summary"><%=T("<em>{0} - {1}</em> of <em>{2}</em> results", (Model.Page - 1) * Model.PageSize + 1, Model.Page * Model.PageSize > Model.Count ? Model.Count : Model.Page * Model.PageSize, Model.Count)%></p><%
}
if (Model.Results.Count() > 0) { %>
<%=Html.UnorderedList(Model.Results, (r, i) => Html.DisplayForItem(r.Content).ToHtmlString(), "search-results contentItems") %><%
if (Model.ResultsPage.Count() > 0) { %>
<%=Html.UnorderedList(Model.ResultsPage, (r, i) => Html.DisplayForItem(r.Content).ToHtmlString(), "search-results contentItems") %>
<%=Html.Pager(Model.TotalPageCount, Model.Page, new {q = Model.Query}, "<", ">", false) %><%
} %>