Tidy up - remove obsoleted classes

This commit is contained in:
James Coxhead
2018-12-02 18:17:20 +00:00
parent 2dfcb8ed4e
commit 4617c0c24f
9 changed files with 34 additions and 122 deletions

View File

@@ -1,3 +1,11 @@
/**
* @ngdoc controller
* @name Umbraco.Editors.RelationTypes.CreateController
* @function
*
* @description
* The controller for creating relation types.
*/
function RelationTypeCreateController($scope, $location, relationTypeResource, navigationService, formHelper, appState, notificationsService) {
var vm = this;
vm.relationType = {};

View File

@@ -1,3 +1,11 @@
/**
* @ngdoc controller
* @name Umbraco.Editors.RelationTypes.DeleteController
* @function
*
* @description
* The controller for deleting relation types.
*/
function RelationTypeDeleteController($scope, $location, relationTypeResource, treeService, navigationService, appState) {
var vm = this;

View File

@@ -1,3 +1,11 @@
/**
* @ngdoc controller
* @name Umbraco.Editors.RelationTypes.EditController
* @function
*
* @description
* The controller for editing relation types.
*/
function RelationTypeEditController($scope, $routeParams, relationTypeResource, editorState, navigationService, dateHelper, userService, entityResource, formHelper, contentEditingHelper) {
var vm = this;

View File

@@ -6,40 +6,40 @@ using System.Web.Http;
using AutoMapper;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
using Relation = Umbraco.Web.Models.ContentEditing.Relation;
namespace Umbraco.Web.Editors
{
[PluginController("UmbracoApi")]
[UmbracoApplicationAuthorizeAttribute(Constants.Applications.Content)]
[UmbracoApplicationAuthorize(Constants.Applications.Content)]
public class RelationController : UmbracoAuthorizedJsonController
{
public Relation GetById(int id)
public RelationDisplay GetById(int id)
{
return Mapper.Map<IRelation, Relation>(Services.RelationService.GetById(id));
return Mapper.Map<IRelation, RelationDisplay>(Services.RelationService.GetById(id));
}
//[EnsureUserPermissionForContent("childId")]
public IEnumerable<Relation> GetByChildId(int childId, string relationTypeAlias = "")
public IEnumerable<RelationDisplay> GetByChildId(int childId, string relationTypeAlias = "")
{
var relations = Services.RelationService.GetByChildId(childId).ToArray();
if (relations.Any() == false)
{
return Enumerable.Empty<Relation>();
return Enumerable.Empty<RelationDisplay>();
}
if (string.IsNullOrWhiteSpace(relationTypeAlias) == false)
{
return
Mapper.Map<IEnumerable<IRelation>, IEnumerable<Relation>>(
Mapper.Map<IEnumerable<IRelation>, IEnumerable<RelationDisplay>>(
relations.Where(x => x.RelationType.Alias.InvariantEquals(relationTypeAlias)));
}
return Mapper.Map<IEnumerable<IRelation>, IEnumerable<Relation>>(relations);
return Mapper.Map<IEnumerable<IRelation>, IEnumerable<RelationDisplay>>(relations);
}
[HttpDelete]

View File

@@ -1,45 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[Obsolete("Use Umbraco.Web.Models.ContentEditing.RelationDisplay instead")]
[DataContract(Name = "relation", Namespace = "")]
public class Relation
{
public Relation()
{
RelationType = new RelationType();
}
/// <summary>
/// Gets or sets the Parent Id of the Relation (Source)
/// </summary>
[DataMember(Name = "parentId")]
public int ParentId { get; set; }
/// <summary>
/// Gets or sets the Child Id of the Relation (Destination)
/// </summary>
[DataMember(Name = "childId")]
public int ChildId { get; set; }
/// <summary>
/// Gets or sets the <see cref="RelationType"/> for the Relation
/// </summary>
[DataMember(Name = "relationType", IsRequired = true)]
public RelationType RelationType { get; set; }
/// <summary>
/// Gets or sets a comment for the Relation
/// </summary>
[DataMember(Name = "comment")]
public string Comment { get; set; }
}
}

View File

@@ -1,43 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[Obsolete("Use Umbraco.Web.Models.ContentEditing.RelationTypeDisplay instead")]
[DataContract(Name = "relationType", Namespace = "")]
public class RelationType
{
/// <summary>
/// Gets or sets the Name of the RelationType
/// </summary>
[DataMember(Name = "name", IsRequired = true)]
public string Name { get; set; }
/// <summary>
/// Gets or sets the Alias of the RelationType
/// </summary>
[DataMember(Name = "alias", IsRequired = true)]
public string Alias { get; set; }
/// <summary>
/// Gets or sets a boolean indicating whether the RelationType is Bidirectional (true) or Parent to Child (false)
/// </summary>
[DataMember(Name = "isBidirectional", IsRequired = true)]
public bool IsBidirectional { get; set; }
/// <summary>
/// Gets or sets the Parents object type id
/// </summary>
/// <remarks>Corresponds to the NodeObjectType in the umbracoNode table</remarks>
[DataMember(Name = "parentObjectType", IsRequired = true)]
public Guid ParentObjectType { get; set; }
/// <summary>
/// Gets or sets the Childs object type id
/// </summary>
/// <remarks>Corresponds to the NodeObjectType in the umbracoNode table</remarks>
[DataMember(Name = "childObjectType", IsRequired = true)]
public Guid ChildObjectType { get; set; }
}
}

View File

@@ -2,8 +2,6 @@
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web.Models.ContentEditing;
using Relation = Umbraco.Web.Models.ContentEditing.Relation;
using RelationType = Umbraco.Web.Models.ContentEditing.RelationType;
namespace Umbraco.Web.Models.Mapping
{
@@ -40,12 +38,6 @@ namespace Umbraco.Web.Models.Mapping
// FROM RelationTypeSave to IRelationType
CreateMap<RelationTypeSave, IRelationType>();
//FROM IRelationType TO RelationType
CreateMap<IRelationType, RelationType>();
//FROM IRelation TO Relation
CreateMap<IRelation, Relation>();
}
}
}

View File

@@ -1,13 +1,10 @@
using System;
using System.Linq;
using System.Linq;
using System.Net.Http.Formatting;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.WebApi.Filters;
using Umbraco.Core;
using Umbraco.Web._Legacy.Actions;
using Umbraco.Core.Services;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
namespace Umbraco.Web.Trees
{
@@ -36,18 +33,7 @@ namespace Umbraco.Web.Trees
if (relationType == null) return new MenuItemCollection();
menu.Items.Add<ActionDelete>(Services.TextService.Localize("actions", ActionDelete.Instance.Alias));
/*menu.Items.Add<ActionDelete>(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
{
Id = relationType.Id,
Level = 1,
ParentId = -1,
Name = relationType.Name
}, "relationTypes", queryStrings.GetValue<string>("application"));*/
return menu;
}

View File

@@ -640,9 +640,7 @@
<Compile Include="UI\JavaScript\UmbracoClientDependencyLoader.cs" />
<Compile Include="UmbracoDefaultOwinStartup.cs" />
<Compile Include="IUmbracoContextAccessor.cs" />
<Compile Include="Models\ContentEditing\Relation.cs" />
<Compile Include="HtmlStringUtilities.cs" />
<Compile Include="Models\ContentEditing\RelationType.cs" />
<Compile Include="ITagQuery.cs" />
<Compile Include="IUmbracoComponentRenderer.cs" />
<Compile Include="Models\Mapping\RelationMapperProfile.cs" />