From e8f36dcf2196090fd2d93ea60b91c28a3aaf0e25 Mon Sep 17 00:00:00 2001 From: Andre Rodrigues Date: Mon, 21 Feb 2011 13:00:18 -0800 Subject: [PATCH] Correcting last updated, adding paging footer, and searching packages by title instead of id. --HG-- branch : dev --- .../Controllers/GalleryController.cs | 10 ++++----- .../Views/Gallery/Modules.cshtml | 18 +++++++-------- .../Views/Gallery/Themes.cshtml | 22 ++++++++++--------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Controllers/GalleryController.cs b/src/Orchard.Web/Modules/Orchard.Packaging/Controllers/GalleryController.cs index 5d4a14d26..848011a5c 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Controllers/GalleryController.cs +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Controllers/GalleryController.cs @@ -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); diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml index ea1eaaa3b..a7b5472f3 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml @@ -14,11 +14,11 @@ Layout.Title = T("Modules").ToString(); } -@using ( Html.BeginFormAntiForgeryPost(Url.Action("Modules", "Gallery")) ) { +@using (Html.BeginFormAntiForgeryPost(Url.Action("Modules", "Gallery")) ) {
@Html.SelectOption((int)Model.Pager.PageSize, 0, T("All").ToString()) - @foreach(int size in pageSizes.OrderBy(p => p)) { + @foreach (int size in pageSizes.OrderBy(p => p)) { @Html.SelectOption((int)Model.Pager.PageSize, size, size.ToString()) } @@ -44,7 +44,7 @@
- +
@@ -54,10 +54,10 @@ @foreach (var item in Model.Extensions) {
  • @{ - string iconUrl = @item.IconUrl; - if (string.IsNullOrWhiteSpace(iconUrl)) { - iconUrl = Href("../../Content/Images/ModuleDefaultIcon.png"); - } + string iconUrl = @item.IconUrl; + if (string.IsNullOrWhiteSpace(iconUrl)) { + iconUrl = Href("../../Content/Images/ModuleDefaultIcon.png"); + } }
    @@ -80,7 +80,7 @@

    @(item.Description == null ? T("(No description").Text : item.Description)

      -
    • @T("Last Updated: {0}", DateTime.Now.ToLocalTime())
    • +
    • @T("Last Updated: {0}", item.LastUpdated)
    •  | @T("Author: {0}", !string.IsNullOrEmpty(item.Authors) ? item.Authors : T("Unknown").ToString())
    •  | @T("Downloads: {0}", item.DownloadCount)
    •  | @T("Website: ") diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml index 394495853..2d9c2a636 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml @@ -54,15 +54,15 @@ @foreach (var item in Model.Extensions) {
    • @{ - string extensionClass = "iconThumbnail"; - string iconUrl = @item.IconUrl; - if (!string.IsNullOrWhiteSpace(@item.FirstScreenshot)) { - iconUrl = @item.FirstScreenshot; - extensionClass = "screenshotThumbnail"; - } else if (string.IsNullOrWhiteSpace(iconUrl)) { - iconUrl = Href("../../Content/Images/imagePlaceholder.png"); - extensionClass = "screenshotThumbnail"; - } + string extensionClass = "iconThumbnail"; + string iconUrl = @item.IconUrl; + if (!string.IsNullOrWhiteSpace(@item.FirstScreenshot)) { + iconUrl = @item.FirstScreenshot; + extensionClass = "screenshotThumbnail"; + } else if (string.IsNullOrWhiteSpace(iconUrl)) { + iconUrl = Href("../../Content/Images/imagePlaceholder.png"); + extensionClass = "screenshotThumbnail"; + } }
      @@ -85,7 +85,7 @@

      @(item.Description == null ? T("(No description").Text : item.Description)

        -
      • @T("Last Updated: {0}", DateTime.Now.ToLocalTime())
      • +
      • @T("Last Updated: {0}", item.LastUpdated)
      •  | @T("Author: {0}", !string.IsNullOrEmpty(item.Authors) ? item.Authors : T("Unknown").ToString())
      •  | @T("Downloads: {0}", item.DownloadCount)
      •  | @T("Website: ") @@ -108,4 +108,6 @@
      • }
      } + + @Display(Model.Pager) } \ No newline at end of file