src/Orchard.Web/Modules/Orchard.Widgets/Views/WidgetPlacement.Zones.cshtml

(完整代码) 2KB

@using Orchard.Utility.Extensions;
@using Orchard.Widgets.Models;
@{
    Style.Require("WidgetsAdmin");
    IEnumerable<WidgetPart> widgets = Model.Widgets;
    IEnumerable<string> zones = Model.Zones;
    var returnUrl = Request.RawUrl;
}
<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 grey" })</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 widgets-layer-@widget.LayerId@(i == 0 ? " first" : (i == count ? " last" : ""))">
                            @using (Html.BeginFormAntiForgeryPost()) {
                                <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" class="link" type="submit" value="1">@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" class="link" type="submit" value="1" itemprop="RemoveUrl">@T("Remove")</button>
                                    }
                                </div>
                                <div class="widgets-move-somewhere">
                                    <button name="moveUp" @(new MvcHtmlString(i == 0 ? "disabled='disabled'" : "")) class="widgets-move widgets-move-up" type="submit" title="@T("Move up")" value="1">@T("Move up")</button>
                                    <button name="moveDown" @(new MvcHtmlString(++i == count ? "disabled='disabled'" : "")) class="widgets-move widgets-move-down" type="submit" title="@T("Move down")" value="1">@T("Move down")</button>
                                </div>
                                @Html.Hidden("widgetId", widget.Id)
                                @Html.Hidden("returnUrl", returnUrl)
                            }
                       </li>
                    }
                }
            </ul>
        </li>
    }
</ol>

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。