mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Updating the role management UI to link up the role name to the edit page and implement & remove some removes
--HG-- branch : dev
This commit is contained in:
@@ -103,14 +103,14 @@
|
|||||||
_controllees.hide(); // <- unhook this when the following comment applies
|
_controllees.hide(); // <- unhook this when the following comment applies
|
||||||
$(_controllees.show()[0]).find("input").focus(); // <- aaaand a slideDown there...eventually
|
$(_controllees.show()[0]).find("input").focus(); // <- aaaand a slideDown there...eventually
|
||||||
} else if (!(_this.is(":checked") && _controlleesAreHidden)) {
|
} else if (!(_this.is(":checked") && _controlleesAreHidden)) {
|
||||||
//_controllees.slideUp(200); <- hook this back up when chrome behaves, or when I care less
|
//_controllees.slideUp(200); <- hook this back up when chrome behaves, or when I care less...or when chrome behaves
|
||||||
_controllees.hide()
|
_controllees.hide()
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
||||||
(function () {
|
$(function () {
|
||||||
$("[data-controllerid]").each(function () {
|
$("[data-controllerid]").each(function () {
|
||||||
var controller = $("#" + $(this).attr("data-controllerid"));
|
var controller = $("#" + $(this).attr("data-controllerid"));
|
||||||
if (controller.data("isControlling")) {
|
if (controller.data("isControlling")) {
|
||||||
@@ -126,11 +126,12 @@
|
|||||||
$("[name=" + controller.attr("name") + "]").click(function () { $("[name=" + $(this).attr("name") + "]").each($(this).toggleWhatYouControl); });
|
$("[name=" + controller.attr("name") + "]").click(function () { $("[name=" + $(this).attr("name") + "]").each($(this).toggleWhatYouControl); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
});
|
||||||
// inline form link buttons (form.inline.link button) swapped out for a link that submits said form
|
// inline form link buttons (form.inline.link button) swapped out for a link that submits said form
|
||||||
(function () {
|
$(function () {
|
||||||
$("form.inline.link").each(function () {
|
$("form.inline.link").each(function () {
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
|
console.log(_this.html())
|
||||||
var link = $("<a class='wasFormInlineLink' href='.'/>");
|
var link = $("<a class='wasFormInlineLink' href='.'/>");
|
||||||
var button = _this.children("button").first();
|
var button = _this.children("button").first();
|
||||||
link.text(button.text())
|
link.text(button.text())
|
||||||
@@ -141,7 +142,7 @@
|
|||||||
_this.css({ "position": "absolute", "left": "-9999em" });
|
_this.css({ "position": "absolute", "left": "-9999em" });
|
||||||
$("body").append(_this);
|
$("body").append(_this);
|
||||||
});
|
});
|
||||||
})();
|
});
|
||||||
// (do) a little better autofocus
|
// (do) a little better autofocus
|
||||||
$(function () {
|
$(function () {
|
||||||
$("body").helpfullyFocus();
|
$("body").helpfullyFocus();
|
||||||
|
@@ -148,6 +148,11 @@ namespace Orchard.Roles.Controllers {
|
|||||||
[HttpPost, ActionName("Edit")]
|
[HttpPost, ActionName("Edit")]
|
||||||
[FormValueRequired("submit.Delete")]
|
[FormValueRequired("submit.Delete")]
|
||||||
public ActionResult EditDeletePOST(int id) {
|
public ActionResult EditDeletePOST(int id) {
|
||||||
|
return Delete(id, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult Delete(int id, string returnUrl) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageRoles, T("Not authorized to manage roles")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageRoles, T("Not authorized to manage roles")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -155,6 +160,10 @@ namespace Orchard.Roles.Controllers {
|
|||||||
_roleService.DeleteRole(id);
|
_roleService.DeleteRole(id);
|
||||||
|
|
||||||
Services.Notifier.Information(T("Role was successfully deleted."));
|
Services.Notifier.Information(T("Role was successfully deleted."));
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(returnUrl))
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
|
||||||
|
@@ -6,7 +6,13 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>@T("Information")</legend>
|
<legend>@T("Information")</legend>
|
||||||
<label for="pageTitle">@T("Role Name:")</label>
|
<label for="pageTitle">@T("Role Name:")</label>
|
||||||
<input id="Name" class="text" name="Name" type="text" value="@Model.Name" />
|
@if (Model.Name == "Administrator") { // the one special case
|
||||||
|
<input id="Name" class="text" type="text" value="@Model.Name" readonly="readonly" />
|
||||||
|
<input class="text" name="Name" type="hidden" value="@Model.Name" />
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<input id="Name" class="text" name="Name" type="text" value="@Model.Name" />
|
||||||
|
}
|
||||||
<input type="hidden" value="@Model.Id" name="Id" />
|
<input type="hidden" value="@Model.Id" name="Id" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@@ -51,6 +57,8 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<button class="primaryAction" type="submit" name="submit.Save" value="@T("Save")">@T("Save")</button>
|
<button class="primaryAction" type="submit" name="submit.Save" value="@T("Save")">@T("Save")</button>
|
||||||
|
@if (Model.Name != "Administrator") {
|
||||||
<button type="submit" name="submit.Delete" value="@T("Remove")">@T("Remove")</button>
|
<button type="submit" name="submit.Delete" value="@T("Remove")">@T("Remove")</button>
|
||||||
|
}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
}
|
}
|
@@ -1,5 +1,9 @@
|
|||||||
@model RolesIndexViewModel
|
@model RolesIndexViewModel
|
||||||
@using Orchard.Roles.ViewModels;
|
@using Orchard.Roles.ViewModels;
|
||||||
|
@using Orchard.Utility.Extensions;
|
||||||
|
@{
|
||||||
|
Script.Require("ShapesBase");
|
||||||
|
}
|
||||||
|
|
||||||
<h1>@Html.TitleForPage(T("Manage Roles").ToString())</h1>
|
<h1>@Html.TitleForPage(T("Manage Roles").ToString())</h1>
|
||||||
@using(Html.BeginFormAntiForgeryPost()) {
|
@using(Html.BeginFormAntiForgeryPost()) {
|
||||||
@@ -29,8 +33,14 @@
|
|||||||
@foreach (var row in Model.Rows) {
|
@foreach (var row in Model.Rows) {
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="checkbox" value="true" name="@("Checkbox." + row.Id)"/></td>
|
<td><input type="checkbox" value="true" name="@("Checkbox." + row.Id)"/></td>
|
||||||
<td>@row.Name</td>
|
<td>@Html.ActionLink(row.Name, "Edit", new { row.Id })</td>
|
||||||
<td>@Html.ActionLink(T("Edit").ToString(), "Edit", new { row.Id })</td>
|
<td>
|
||||||
|
@Html.ActionLink(T("Edit").ToString(), "Edit", new { row.Id })
|
||||||
|
@if (row.Name != "Administrator") {
|
||||||
|
@T(" | ")
|
||||||
|
<a href="@Url.Action("Delete", new {row.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()})" itemprop="RemoveUrl UnsafeUrl">@T("Remove")</a>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
|
Reference in New Issue
Block a user