From d77cfce85e228fbd2cd7d65b289258a52a14ce99 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Wed, 16 Mar 2011 14:38:54 -0700 Subject: [PATCH] Making the zones view "switchable". It could use some more relevant icons but what is there by default is fine for now. --HG-- branch : dev --- .../Styles/orchard-widgets-admin.css | 11 ++++++ .../Orchard.Widgets/Views/Admin/Index.cshtml | 36 +++++++++++-------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Styles/orchard-widgets-admin.css b/src/Orchard.Web/Modules/Orchard.Widgets/Styles/orchard-widgets-admin.css index 44151e1cf..052bccb30 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Styles/orchard-widgets-admin.css +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Styles/orchard-widgets-admin.css @@ -29,9 +29,11 @@ background:#F3F4F5; border:1px solid #E4E5E6; padding:0 5px; } +/* The number seems slightly meaningless. Leaving it out for now. * / #widgets-zones ol { list-style:decimal inside; } +*/ #widgets-zones li, #widgets-available li { background:#FFF; color:#AEC3CE; @@ -85,3 +87,12 @@ color:#333; #widgets-available a p { margin-top:5px; } + +/* begin: switchable tweaks for admin/widgets */ +#widgets-placement .switch-for-switchable { +margin:-32px 10px -2px 0; +} +#widgets-placement .summary-view .widgets-none { +display:none; +} +/* end: switchable tweaks */ \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.Widgets/Views/Admin/Index.cshtml index db91391a7..d7a70e6f5 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Views/Admin/Index.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Views/Admin/Index.cshtml @@ -2,6 +2,8 @@ @using Orchard.Widgets.Models; @{ Style.Require("WidgetsAdmin"); + Script.Require("Switchable"); + Style.Require("Switchable"); Layout.Title = T("Manage Widgets").ToString(); IEnumerable layers = Model.Layers; IEnumerable widgets = Model.Widgets; @@ -29,28 +31,32 @@
-
+
    @foreach (string zone in zones) { -
  1. + int count = widgets.Where(w => w.Zone == zone).Count(); + MvcHtmlString classA = null; + if (count == 0) { + classA = new MvcHtmlString(" class=\"widgets-none\""); + } +

    @zone

    @Html.ActionLink(T("Add").Text, "ChooseWidget", new { layerId = Model.CurrentLayer.Id, zone, returnUrl }, new { @class = "button" })
      - @{ - int count = widgets.Where(w => w.Zone == zone).Count() - 1; + @if (count > 0) { int i = 0; - } - @foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) { -
    • - @if (i > 0) { - - } - @if (i++ < count) { - - } - @Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id }) -
    • + foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) { +
    • + @if (i > 0) { + + } + @if (++i < count) { + + } + @Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id }) +
    • + } }