mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Breaking the global widget management UI into seperate, more task-focused, tempaltes
--HG-- branch : dev
This commit is contained in:
@@ -145,6 +145,18 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Admin\ChooseWidget.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\WidgetLayersControl.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\WidgetPlacement.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\WidgetSimplePreview.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\WidgetLayerVisibility.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
float:left;
|
||||
width:65%;
|
||||
}
|
||||
#widgets-placement { }
|
||||
#layout-widgets-assistance {
|
||||
float:right;
|
||||
width:35%;
|
||||
|
||||
@@ -1,86 +1,18 @@
|
||||
@using Orchard.Utility.Extensions;
|
||||
@using Orchard.Widgets.Models;
|
||||
@{
|
||||
@{
|
||||
Style.Require("WidgetsAdmin");
|
||||
Script.Require("Switchable");
|
||||
Style.Require("Switchable");
|
||||
Layout.Title = T("Manage Widgets").ToString();
|
||||
IEnumerable<LayerPart> layers = Model.Layers;
|
||||
IEnumerable<WidgetPart> widgets = Model.Widgets;
|
||||
IEnumerable<string> zones = Model.Zones;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
}
|
||||
|
||||
<div id="widgets" class="group">
|
||||
<div id="widgets-layers-control" class="widgets-container">
|
||||
@if (layers.Count() > 0) {
|
||||
using (Html.BeginForm("index", "admin", FormMethod.Get, new {area = "Orchard.Widgets"})) {
|
||||
<fieldset class="bulk-actions-auto">
|
||||
<label for="layerId">@T("Current Layer:")</label>
|
||||
<select id="layerId" name="layerId">
|
||||
@foreach (var layer in Model.Layers) {
|
||||
@Html.SelectOption((int)Model.CurrentLayer.Id, (int)layer.Id, (string)layer.Name)
|
||||
}
|
||||
</select>
|
||||
<button type="submit" class="apply-bulk-actions-auto">@T("Show")</button>
|
||||
@Html.Link(T("Edit").Text, Url.Action("EditLayer", "Admin", new { area = "Orchard.Widgets", id = Model.CurrentLayer.Id, returnUrl }), new { @class = "button" })
|
||||
</fieldset>
|
||||
}
|
||||
}
|
||||
@Html.Link(T("Add a new layer...").Text, Url.Action("AddLayer", "Admin", new { area = "Orchard.Widgets", returnUrl }))
|
||||
</div>
|
||||
@Display.WidgetLayersControl(Layers: Model.Layers, CurrentLayer: Model.CurrentLayer)
|
||||
<div id="layout-widgets-placement">
|
||||
<div id="widgets-placement">
|
||||
<div id="widgets-layers" class="widgets-container detail-view switchable">
|
||||
<div id="widgets-zones">
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
<ol>
|
||||
@foreach (string zone in zones) {
|
||||
int count = widgets.Where(w => w.Zone == zone).Count();
|
||||
MvcHtmlString classAttr = null;
|
||||
if (count == 0) {
|
||||
classAttr = new MvcHtmlString(" class=\"widgets-none\"");
|
||||
}
|
||||
<li@(classAttr)>
|
||||
<h2>@zone</h2>
|
||||
<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">
|
||||
@if (count > 0) {
|
||||
int i = 0;
|
||||
foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) {
|
||||
<li class="widgets-@(widget.LayerId == Model.CurrentLayer.Id ? "this" : "other")-layer">
|
||||
<h3>@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id, returnUrl })</h3>
|
||||
<div class="widgets-actions">
|
||||
@if (widget.LayerId != Model.CurrentLayer.Id) {
|
||||
<button name="moveHere" value="@widget.Id" class="link" type="submit">@T("Move to current layer")</button>
|
||||
}
|
||||
else { /* it could be useful to remove the widget regardless of the layer it's on but there's no place in the current UI for this and "Move to current layer" */
|
||||
<button name="moveOut" value="@widget.Id" class="link" type="submit">@T("Remove")</button>
|
||||
}
|
||||
</div>
|
||||
<div class="widgets-move-somewhere">
|
||||
<button name="moveUp" value="@widget.Id" @(i == 0 ? "disabled='disabled'" : "") class="widgets-move widgets-move-up" type="submit" title="@T("Move up")">@T("Move up")</button>
|
||||
<button name="moveDown" value="@widget.Id" @(++i == count ? "disabled='disabled'" : "") class="widgets-move widgets-move-down" type="submit" title="@T("Move down")">@T("Move down")</button>
|
||||
@Html.Hidden("returnUrl", returnUrl)
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
</ol>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@Display.WidgetPlacement(Widgets: Model.Widgets, Zones: Model.Zones, CurrentLayer: Model.CurrentLayer)
|
||||
</div>
|
||||
<div id="layout-widgets-assistance">
|
||||
<div id="widgets-assistance">
|
||||
<div class="widgets-container">
|
||||
<p>[theme preview image]</p>
|
||||
<p>[layer visibility]</p>
|
||||
@Display.WidgetSimplePreview()
|
||||
@Display.WidgetLayerVisibility(Layers: Model.Layers, CurrentLayer: Model.CurrentLayer)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<p>[[layer visibility]]</p>
|
||||
@@ -0,0 +1,26 @@
|
||||
@using Orchard.Utility.Extensions;
|
||||
@using Orchard.Widgets.Models;
|
||||
@{
|
||||
Style.Require("WidgetsAdmin");
|
||||
Script.Require("Switchable");
|
||||
Style.Require("Switchable");
|
||||
IEnumerable<LayerPart> layers = Model.Layers;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
}
|
||||
<div id="widgets-layers-control" class="widgets-container">
|
||||
@if (layers.Count() > 0) {
|
||||
using (Html.BeginForm("index", "admin", FormMethod.Get, new {area = "Orchard.Widgets"})) {
|
||||
<fieldset class="bulk-actions-auto">
|
||||
<label for="layerId">@T("Current Layer:")</label>
|
||||
<select id="layerId" name="layerId">
|
||||
@foreach (var layer in layers) {
|
||||
@Html.SelectOption((int)Model.CurrentLayer.Id, (int)layer.Id, (string)layer.Name)
|
||||
}
|
||||
</select>
|
||||
<button type="submit" class="apply-bulk-actions-auto">@T("Show")</button>
|
||||
@Html.Link(T("Edit").Text, Url.Action("EditLayer", "Admin", new { area = "Orchard.Widgets", id = Model.CurrentLayer.Id, returnUrl }), new { @class = "button" })
|
||||
</fieldset>
|
||||
}
|
||||
}
|
||||
@Html.Link(T("Add a new layer...").Text, Url.Action("AddLayer", "Admin", new { area = "Orchard.Widgets", returnUrl }))
|
||||
</div>
|
||||
@@ -0,0 +1,52 @@
|
||||
@using Orchard.Utility.Extensions;
|
||||
@using Orchard.Widgets.Models;
|
||||
@{
|
||||
Style.Require("WidgetsAdmin");
|
||||
IEnumerable<WidgetPart> widgets = Model.Widgets;
|
||||
IEnumerable<string> zones = Model.Zones;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
}
|
||||
<div id="widgets-placement">
|
||||
<div id="widgets-layers" class="widgets-container detail-view switchable">
|
||||
<div id="widgets-zones">
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
<ol>
|
||||
@foreach (string zone in zones) {
|
||||
int count = widgets.Where(w => w.Zone == zone).Count();
|
||||
MvcHtmlString classAttr = null;
|
||||
if (count == 0) {
|
||||
classAttr = new MvcHtmlString(" class=\"widgets-none\"");
|
||||
}
|
||||
<li@(classAttr)>
|
||||
<h2>@zone</h2>
|
||||
<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">
|
||||
@if (count > 0) {
|
||||
int i = 0;
|
||||
foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) {
|
||||
<li class="widgets-@(widget.LayerId == Model.CurrentLayer.Id ? "this" : "other")-layer">
|
||||
<h3>@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id, returnUrl })</h3>
|
||||
<div class="widgets-actions">
|
||||
@if (widget.LayerId != Model.CurrentLayer.Id) {
|
||||
<button name="moveHere" value="@widget.Id" class="link" type="submit">@T("Move to current layer")</button>
|
||||
}
|
||||
else { /* it could be useful to remove the widget regardless of the layer it's on but there's no place in the current UI for this and "Move to current layer" */
|
||||
<button name="moveOut" value="@widget.Id" class="link" type="submit">@T("Remove")</button>
|
||||
}
|
||||
</div>
|
||||
<div class="widgets-move-somewhere">
|
||||
<button name="moveUp" value="@widget.Id" @(i == 0 ? "disabled='disabled'" : "") class="widgets-move widgets-move-up" type="submit" title="@T("Move up")">@T("Move up")</button>
|
||||
<button name="moveDown" value="@widget.Id" @(++i == count ? "disabled='disabled'" : "") class="widgets-move widgets-move-down" type="submit" title="@T("Move down")">@T("Move down")</button>
|
||||
@Html.Hidden("returnUrl", returnUrl)
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
</ol>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<p>[[theme preview image]]</p>
|
||||
Reference in New Issue
Block a user