mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -69,7 +69,10 @@ namespace Orchard.Widgets.Controllers {
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
public ActionResult IndexWidgetPOST(int? moveUp, int? moveDown, string returnUrl) {
|
||||
public ActionResult IndexWidgetPOST(int? layerId, int? moveUp, int? moveDown, int? moveHere, int? moveOut, string returnUrl) {
|
||||
if (moveOut.HasValue)
|
||||
return DeleteWidget(moveOut.Value, returnUrl);
|
||||
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
@@ -78,6 +81,8 @@ namespace Orchard.Widgets.Controllers {
|
||||
_widgetsService.MoveWidgetUp(moveUp.Value);
|
||||
if (moveDown.HasValue)
|
||||
_widgetsService.MoveWidgetDown(moveDown.Value);
|
||||
if (moveHere.HasValue)
|
||||
_widgetsService.MoveWidgetToLayer(moveHere.Value, layerId);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.Error(exception, T("Moving widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
@@ -86,6 +91,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||
}
|
||||
|
||||
|
||||
public ActionResult ChooseWidget(int layerId, string zone, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||
return new HttpUnauthorizedResult();
|
||||
@@ -333,6 +339,9 @@ namespace Orchard.Widgets.Controllers {
|
||||
[HttpPost, ActionName("EditWidget")]
|
||||
[FormValueRequired("submit.Delete")]
|
||||
public ActionResult EditWidgetDeletePOST(int id, string returnUrl) {
|
||||
return DeleteWidget(id, returnUrl);
|
||||
}
|
||||
private ActionResult DeleteWidget(int id, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
@@ -344,7 +353,8 @@ namespace Orchard.Widgets.Controllers {
|
||||
|
||||
_widgetsService.DeleteWidget(widgetPart.Id);
|
||||
Services.Notifier.Information(T("Widget was successfully deleted"));
|
||||
} catch (Exception exception) {
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.Error(exception, T("Removing Widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,8 @@ namespace Orchard.Widgets.Services {
|
||||
bool MoveWidgetUp(WidgetPart widgetPart);
|
||||
bool MoveWidgetDown(int widgetId);
|
||||
bool MoveWidgetDown(WidgetPart widgetPart);
|
||||
bool MoveWidgetToLayer(int widgetId, int? layerId);
|
||||
bool MoveWidgetToLayer(WidgetPart widgetPart, int? layerId);
|
||||
void MakeRoomForWidgetPosition(int widgetId);
|
||||
void MakeRoomForWidgetPosition(WidgetPart widgetPart);
|
||||
}
|
||||
|
@@ -153,6 +153,22 @@ namespace Orchard.Widgets.Services {
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool MoveWidgetToLayer(int widgetId, int? layerId) {
|
||||
return MoveWidgetToLayer(GetWidget(widgetId), layerId);
|
||||
}
|
||||
public bool MoveWidgetToLayer(WidgetPart widgetPart, int? layerId) {
|
||||
LayerPart layer = layerId.HasValue
|
||||
? GetLayer(layerId.Value)
|
||||
: GetLayers().FirstOrDefault();
|
||||
|
||||
if (layer != null) {
|
||||
widgetPart.LayerPart = layer;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void MakeRoomForWidgetPosition(int widgetId) {
|
||||
MakeRoomForWidgetPosition(GetWidget(widgetId));
|
||||
}
|
||||
|
@@ -57,8 +57,15 @@ color:#333;
|
||||
#widgets-zones li li {
|
||||
background:#F3F4F5;
|
||||
border:0;
|
||||
border-left:3px solid #EAEAEA;
|
||||
margin:10px 0;
|
||||
padding:5px 10px 5px 25px;
|
||||
padding:5px 100px 5px 25px;
|
||||
}
|
||||
#widgets-zones li li.widgets-this-layer {
|
||||
border-color:#898989;
|
||||
}
|
||||
#widgets-zones li li.widgets-this-layer:hover {
|
||||
border-color:#bfd3a7;
|
||||
}
|
||||
#widgets-zones .widgets-mover {
|
||||
margin-left:-18px;
|
||||
|
@@ -48,11 +48,20 @@
|
||||
@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>
|
||||
<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>
|
||||
}
|
||||
|
@@ -224,18 +224,18 @@ number of columns: 24; actual width: 946; column width: 26; gutter width:14
|
||||
/* Links
|
||||
***************************************************************/
|
||||
a, a:link, a:visited,
|
||||
form.link button {
|
||||
form.link button, button.link, button.link:hover {
|
||||
color:#1e5d7d;
|
||||
text-decoration:none;
|
||||
}
|
||||
form.link button {
|
||||
form.link button, button.link {
|
||||
height:1.3em;
|
||||
}
|
||||
a:hover, a:active, a:focus {
|
||||
color:#1e5d7d;
|
||||
text-decoration:none;
|
||||
}
|
||||
form.link button:hover {
|
||||
form.link button:hover, button.link:hover {
|
||||
border-bottom:1px solid #1e5d7d;
|
||||
}
|
||||
|
||||
@@ -757,6 +757,20 @@ button:active, .buton:active, a.button:active {
|
||||
button:focus::-moz-focus-inner, .button:focus::-moz-focus-inner {
|
||||
border: 1px dotted transparent;
|
||||
}
|
||||
/* and allow all of that button style to be undone and beyond - to look like a link */
|
||||
button.link {
|
||||
background:none;
|
||||
border:0;
|
||||
padding:inherit;
|
||||
text-shadow:none;
|
||||
-webkit-box-shadow:none;
|
||||
-moz-box-shadow:none;
|
||||
box-shadow:none;
|
||||
filter:none;
|
||||
-webkit-border-radius:0;
|
||||
-moz-border-radius:0;
|
||||
border-radius:0;
|
||||
}
|
||||
.cancel {
|
||||
margin:0 0 0 .93em;
|
||||
}
|
||||
|
Reference in New Issue
Block a user