diff --git a/src/Umbraco.Web.UI.Client/src/views/relationtypes/delete.html b/src/Umbraco.Web.UI.Client/src/views/relationtypes/delete.html
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/Umbraco.Web/Editors/RelationTypeController.cs b/src/Umbraco.Web/Editors/RelationTypeController.cs
index 3751dd5bcf..05de96699d 100644
--- a/src/Umbraco.Web/Editors/RelationTypeController.cs
+++ b/src/Umbraco.Web/Editors/RelationTypeController.cs
@@ -126,9 +126,23 @@ namespace Umbraco.Web.Editors
}
}
- public void DeleteById()
+ ///
+ /// Deletes a relation type with a given ID.
+ ///
+ /// The ID of the relation type to delete.
+ /// A .
+ [HttpPost]
+ [HttpDelete]
+ public HttpResponseMessage DeleteById(int id)
{
- throw new NotImplementedException();
+ var relationType = Services.RelationService.GetRelationTypeById(id);
+
+ if(relationType == null)
+ throw new HttpResponseException(HttpStatusCode.NotFound);
+
+ Services.RelationService.Delete(relationType);
+
+ return Request.CreateResponse(HttpStatusCode.OK);
}
}
}
diff --git a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs
index 096c7a6870..6131ca8646 100644
--- a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs
+++ b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs
@@ -34,9 +34,10 @@ namespace Umbraco.Web.Trees
var relationType = Services.RelationService.GetRelationTypeById(int.Parse(id));
if (relationType == null) return new MenuItemCollection();
+
+ menu.Items.Add(Services.TextService.Localize("actions", ActionDelete.Instance.Alias));
- //add delete option for all macros
- menu.Items.Add(Services.TextService.Localize("actions", ActionDelete.Instance.Alias))
+ /*menu.Items.Add(Services.TextService.Localize("actions", ActionDelete.Instance.Alias))
//Since we haven't implemented anything for relationtypes in angular, this needs to be converted to
//use the legacy format
.ConvertLegacyMenuItem(new EntitySlim
@@ -45,7 +46,7 @@ namespace Umbraco.Web.Trees
Level = 1,
ParentId = -1,
Name = relationType.Name
- }, "relationTypes", queryStrings.GetValue("application"));
+ }, "relationTypes", queryStrings.GetValue("application"));*/
return menu;
}
@@ -56,15 +57,9 @@ namespace Umbraco.Web.Trees
if (id == Constants.System.Root.ToInvariantString())
{
- nodes.AddRange(Services.RelationService
- .GetAllRelationTypes().Select(rt => CreateTreeNode(
- rt.Id.ToString(),
- id,
- queryStrings,
- rt.Name,
- "icon-trafic",
- false
- )));
+ nodes.AddRange(Services.RelationService.GetAllRelationTypes()
+ .Select(rt => CreateTreeNode(rt.Id.ToString(), id, queryStrings, rt.Name,
+ "icon-trafic", false)));
}
return nodes;
}