mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +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.show()[0]).find("input").focus(); // <- aaaand a slideDown there...eventually
|
||||
} 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()
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
||||
(function () {
|
||||
$(function () {
|
||||
$("[data-controllerid]").each(function () {
|
||||
var controller = $("#" + $(this).attr("data-controllerid"));
|
||||
if (controller.data("isControlling")) {
|
||||
@@ -126,11 +126,12 @@
|
||||
$("[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
|
||||
(function () {
|
||||
$(function () {
|
||||
$("form.inline.link").each(function () {
|
||||
var _this = $(this);
|
||||
console.log(_this.html())
|
||||
var link = $("<a class='wasFormInlineLink' href='.'/>");
|
||||
var button = _this.children("button").first();
|
||||
link.text(button.text())
|
||||
@@ -141,7 +142,7 @@
|
||||
_this.css({ "position": "absolute", "left": "-9999em" });
|
||||
$("body").append(_this);
|
||||
});
|
||||
})();
|
||||
});
|
||||
// (do) a little better autofocus
|
||||
$(function () {
|
||||
$("body").helpfullyFocus();
|
||||
|
@@ -148,6 +148,11 @@ namespace Orchard.Roles.Controllers {
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[FormValueRequired("submit.Delete")]
|
||||
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")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
@@ -155,6 +160,10 @@ namespace Orchard.Roles.Controllers {
|
||||
_roleService.DeleteRole(id);
|
||||
|
||||
Services.Notifier.Information(T("Role was successfully deleted."));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(returnUrl))
|
||||
return Redirect(returnUrl);
|
||||
|
||||
return RedirectToAction("Index");
|
||||
} catch (Exception exception) {
|
||||
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
|
||||
|
@@ -6,7 +6,13 @@
|
||||
<fieldset>
|
||||
<legend>@T("Information")</legend>
|
||||
<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" />
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@@ -51,6 +57,8 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<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>
|
||||
}
|
||||
</fieldset>
|
||||
}
|
@@ -1,5 +1,9 @@
|
||||
@model RolesIndexViewModel
|
||||
@using Orchard.Roles.ViewModels;
|
||||
@using Orchard.Utility.Extensions;
|
||||
@{
|
||||
Script.Require("ShapesBase");
|
||||
}
|
||||
|
||||
<h1>@Html.TitleForPage(T("Manage Roles").ToString())</h1>
|
||||
@using(Html.BeginFormAntiForgeryPost()) {
|
||||
@@ -29,8 +33,14 @@
|
||||
@foreach (var row in Model.Rows) {
|
||||
<tr>
|
||||
<td><input type="checkbox" value="true" name="@("Checkbox." + row.Id)"/></td>
|
||||
<td>@row.Name</td>
|
||||
<td>@Html.ActionLink(T("Edit").ToString(), "Edit", new { row.Id })</td>
|
||||
<td>@Html.ActionLink(row.Name, "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>
|
||||
}
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user