diff --git a/src/Orchard.Web/Modules/Orchard.Tags/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Tags/Controllers/AdminController.cs index f739d7a8e..a63154956 100644 --- a/src/Orchard.Web/Modules/Orchard.Tags/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Tags/Controllers/AdminController.cs @@ -111,6 +111,24 @@ namespace Orchard.Tags.Controllers { return RedirectToAction("Index"); } + [HttpPost] + public ActionResult Remove(int id, string returnUrl) { + if (!Services.Authorizer.Authorize(Permissions.ManageTags, T("Couldn't remove tag"))) + return new HttpUnauthorizedResult(); + + Tag tag = _tagService.GetTag(id); + + if (tag == null) + return new HttpNotFoundResult(); + + _tagService.DeleteTag(id); + + if (!string.IsNullOrWhiteSpace(returnUrl)) + return Redirect(returnUrl); + + return RedirectToAction("Index"); + } + public ActionResult Search(int id) { Tag tag = _tagService.GetTag(id); diff --git a/src/Orchard.Web/Modules/Orchard.Tags/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.Tags/Views/Admin/Index.cshtml index f16c3fb52..46df12f8b 100644 --- a/src/Orchard.Web/Modules/Orchard.Tags/Views/Admin/Index.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Tags/Views/Admin/Index.cshtml @@ -1,11 +1,13 @@ @model Orchard.Tags.ViewModels.TagsAdminIndexViewModel - @using Orchard.Tags.ViewModels; +@using Orchard.Utility.Extensions; +@{ + Script.Require("ShapesBase"); +}

@Html.TitleForPage(T("Manage Tags").ToString())

- +@using(Html.BeginFormAntiForgeryPost()) { @Html.ValidationSummary() -
-
@Html.ActionLink(T("Add a tag").ToString(), "Create", new { }, new { @class = "button primaryAction" })
@@ -36,13 +37,15 @@ tagIndex = tagIndex + 1; }
- @Html.ActionLink(Html.Encode(tagEntry.Tag.TagName), "Search", new {id = tagEntry.Tag.Id}) + @Html.ActionLink(tagEntry.Tag.TagName, "Edit", new {id = tagEntry.Tag.Id}) - @Html.ActionLink(T("Edit").ToString(), "Edit", new {id = tagEntry.Tag.Id}) + @Html.ActionLink(T("Edit").ToString(), "Edit", new {id = tagEntry.Tag.Id}) @T(" | ") + @T("Remove")
-
\ No newline at end of file + +} \ No newline at end of file