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
This commit is contained in:
Nathan Heskew
2011-03-16 14:38:54 -07:00
parent 3c41eea22f
commit d77cfce85e
2 changed files with 32 additions and 15 deletions

View File

@@ -29,9 +29,11 @@ background:#F3F4F5;
border:1px solid #E4E5E6; border:1px solid #E4E5E6;
padding:0 5px; padding:0 5px;
} }
/* The number seems slightly meaningless. Leaving it out for now. * /
#widgets-zones ol { #widgets-zones ol {
list-style:decimal inside; list-style:decimal inside;
} }
*/
#widgets-zones li, #widgets-available li { #widgets-zones li, #widgets-available li {
background:#FFF; background:#FFF;
color:#AEC3CE; color:#AEC3CE;
@@ -85,3 +87,12 @@ color:#333;
#widgets-available a p { #widgets-available a p {
margin-top:5px; 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 */

View File

@@ -2,6 +2,8 @@
@using Orchard.Widgets.Models; @using Orchard.Widgets.Models;
@{ @{
Style.Require("WidgetsAdmin"); Style.Require("WidgetsAdmin");
Script.Require("Switchable");
Style.Require("Switchable");
Layout.Title = T("Manage Widgets").ToString(); Layout.Title = T("Manage Widgets").ToString();
IEnumerable<LayerPart> layers = Model.Layers; IEnumerable<LayerPart> layers = Model.Layers;
IEnumerable<WidgetPart> widgets = Model.Widgets; IEnumerable<WidgetPart> widgets = Model.Widgets;
@@ -29,28 +31,32 @@
</div> </div>
<div id="layout-widgets-placement"> <div id="layout-widgets-placement">
<div id="widgets-placement"> <div id="widgets-placement">
<div id="widgets-layers" class="widgets-container"> <div id="widgets-layers" class="widgets-container detail-view switchable">
<div id="widgets-zones"> <div id="widgets-zones">
<ol> <ol>
@foreach (string zone in zones) { @foreach (string zone in zones) {
<li> int count = widgets.Where(w => w.Zone == zone).Count();
MvcHtmlString classA = null;
if (count == 0) {
classA = new MvcHtmlString(" class=\"widgets-none\"");
}
<li@(classA)>
<h2>@zone</h2> <h2>@zone</h2>
<div class="widgets-actions">@Html.ActionLink(T("Add").Text, "ChooseWidget", new { layerId = Model.CurrentLayer.Id, zone, returnUrl }, new { @class = "button" })</div> <div class="widgets-actions">@Html.ActionLink(T("Add").Text, "ChooseWidget", new { layerId = Model.CurrentLayer.Id, zone, returnUrl }, new { @class = "button" })</div>
<ul class="widgets-zone-widgets"> <ul class="widgets-zone-widgets">
@{ @if (count > 0) {
int count = widgets.Where(w => w.Zone == zone).Count() - 1;
int i = 0; int i = 0;
} foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) {
@foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) { <li>
<li> @if (i > 0) {
@if (i > 0) { <input class="widgets-mover" type="image" name="submit.MoveUp.@widget.Id" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/moveup.gif")" alt="Move up" value="@widget.Id" />
<input class="widgets-mover" type="image" name="submit.MoveUp.@widget.Id" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/moveup.gif")" alt="Move up" value="@widget.Id" /> }
} @if (++i < count) {
@if (i++ < count) { <input class="widgets-mover" type="image" name="submit.MoveDown.@widget.Id" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/movedown.gif")" alt="Move down" value="@widget.Id" />
<input class="widgets-mover" type="image" name="submit.MoveDown.@widget.Id" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/movedown.gif")" alt="Move down" value="@widget.Id" /> }
} @Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id })
@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id }) </li>
</li> }
} }
</ul> </ul>
</li> </li>