Correcting last updated, adding paging footer, and searching packages by title instead of id.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2011-02-21 13:00:18 -08:00
parent 68e8e7aef4
commit e8f36dcf21
3 changed files with 26 additions and 24 deletions

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
@@ -151,7 +150,8 @@ namespace Orchard.Packaging.Controllers {
source,
packages => {
packages = packages.Where(p => p.PackageType == packageType &&
(string.IsNullOrEmpty(options.SearchText) || p.Id.Contains(options.SearchText)));
p.IsLatestVersion &&
(string.IsNullOrEmpty(options.SearchText) || p.Title.Contains(options.SearchText)));
switch (options.Order) {
case PackagingExtensionsOrder.Downloads:
@@ -170,14 +170,14 @@ namespace Orchard.Packaging.Controllers {
}
return packages;
}
).ToArray();
}).ToArray();
// count packages separately to prevent loading everything just to count
totalCount += _packagingSourceManager.GetExtensionCount(
source,
packages => packages.Where(p => p.PackageType == packageType &&
(string.IsNullOrEmpty(options.SearchText) || p.Id.Contains(options.SearchText)))
p.IsLatestVersion &&
(string.IsNullOrEmpty(options.SearchText) || p.Title.Contains(options.SearchText)))
);
extensions = extensions == null ? sourceExtensions : extensions.Concat(sourceExtensions);

View File

@@ -18,7 +18,7 @@
<fieldset class="bulk-actions">
<label for="filterResults" class="bulk-filter">@T("Feed:")</label>
<select id="sourceId" name="sourceId">
@Html.SelectOption("", Model.SelectedSource == null, T("Any (show all feeds)").ToString())
@Html.SelectOption("", Model.SelectedSource == null, T("All feeds").ToString())
@foreach (var source in Model.Sources) {
@Html.SelectOption(source.Id, Model.SelectedSource != null && Model.SelectedSource.Id == source.Id, source.FeedTitle)
}
@@ -44,7 +44,7 @@
</fieldset>
<fieldset class="search-actions">
<input type="text" id="searchText" name="@Html.NameOf(m => m.Options.SearchText)" />
<input type="text" id="searchText" name="@Html.NameOf(m => m.Options.SearchText)" value="@Model.Options.SearchText" />
<button type="submit">@T("Search")</button>
</fieldset>
@@ -80,7 +80,7 @@
<div class="properties">
<p>@(item.Description == null ? T("(No description").Text : item.Description)</p>
<ul class="pageStatus">
<li>@T("Last Updated: {0}", DateTime.Now.ToLocalTime())</li>
<li>@T("Last Updated: {0}", item.LastUpdated)</li>
<li>&nbsp;&#124;&nbsp;@T("Author: {0}", !string.IsNullOrEmpty(item.Authors) ? item.Authors : T("Unknown").ToString())</li>
<li>&nbsp;&#124;&nbsp;@T("Downloads: {0}", item.DownloadCount)</li>
<li>&nbsp;&#124;&nbsp;@T("Website: ")

View File

@@ -85,7 +85,7 @@
<div class="properties">
<p>@(item.Description == null ? T("(No description").Text : item.Description)</p>
<ul class="pageStatus">
<li>@T("Last Updated: {0}", DateTime.Now.ToLocalTime())</li>
<li>@T("Last Updated: {0}", item.LastUpdated)</li>
<li>&nbsp;&#124;&nbsp;@T("Author: {0}", !string.IsNullOrEmpty(item.Authors) ? item.Authors : T("Unknown").ToString())</li>
<li>&nbsp;&#124;&nbsp;@T("Downloads: {0}", item.DownloadCount)</li>
<li>&nbsp;&#124;&nbsp;@T("Website: ")
@@ -108,4 +108,6 @@
</li>}
</ul>
}
@Display(Model.Pager)
}