Skip to content

Commit

Permalink
Migrations from PropertyEditors folder without dependencies to DataVa…
Browse files Browse the repository at this point in the history
…lueEditor or ConfigurationEditor<TConfiguration>
  • Loading branch information
elit0451 committed Nov 19, 2020
1 parent 74262e1 commit 7809d15
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 59 deletions.
Expand Up @@ -25,17 +25,17 @@ public IEnumerable<UmbracoEntityReference> GetAllReferences(IPropertyCollection
//TODO: We will need to change this once we support tracking via variants/segments
// for now, we are tracking values from ALL variants

foreach(var propertyVal in p.Values)
foreach (var propertyVal in p.Values)
{
var val = propertyVal.EditedValue;

var valueEditor = editor.GetValueEditor();
if (valueEditor is IDataValueReference reference)
{
var refs = reference.GetReferences(val);
foreach(var r in refs)
foreach (var r in refs)
trackedRelations.Add(r);
}
}

// Loop over collection that may be add to existing property editors
// implementation of GetReferences in IDataValueReference.
Expand All @@ -48,14 +48,11 @@ public IEnumerable<UmbracoEntityReference> GetAllReferences(IPropertyCollection
// in the dataeditor/property has referecnes to media/content items
if (item.IsForEditor(editor))
{
foreach(var r in item.GetDataValueReference().GetReferences(val))
foreach (var r in item.GetDataValueReference().GetReferences(val))
trackedRelations.Add(r);
}

}
}


}

return trackedRelations;
Expand Down
@@ -1,13 +1,12 @@
using Umbraco.Core;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.Validators;

namespace Umbraco.Web.PropertyEditors
{
/// <summary>
/// A custom pre-value editor class to deal with the legacy way that the pre-value data is stored.
/// </summary>
internal class DecimalConfigurationEditor : ConfigurationEditor
public class DecimalConfigurationEditor : ConfigurationEditor
{
public DecimalConfigurationEditor()
{
Expand Down
Expand Up @@ -13,6 +13,6 @@ public interface IDataValueReference
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
IEnumerable<UmbracoEntityReference> GetReferences(object value);
IEnumerable<UmbracoEntityReference> GetReferences(object value);
}
}
Expand Up @@ -5,7 +5,7 @@ public interface IDataValueReferenceFactory
/// <summary>
/// Gets a value indicating whether the DataValueReference lookup supports a datatype (data editor).
/// </summary>
/// <param name="dataType">The datatype.</param>
/// <param name="dataEditor"></param>
/// <returns>A value indicating whether the converter supports a datatype.</returns>
bool IsForEditor(IDataEditor dataEditor);

Expand Down
@@ -1,13 +1,12 @@
using Umbraco.Core;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.Validators;

namespace Umbraco.Web.PropertyEditors
{
/// <summary>
/// A custom pre-value editor class to deal with the legacy way that the pre-value data is stored.
/// </summary>
internal class IntegerConfigurationEditor : ConfigurationEditor
public class IntegerConfigurationEditor : ConfigurationEditor
{
public IntegerConfigurationEditor()
{
Expand Down
@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
using Umbraco.Core.PropertyEditors;

namespace Umbraco.Web.PropertyEditors
Expand Down Expand Up @@ -31,7 +31,7 @@ public ListViewConfiguration()
new Layout { Name = "grid", Icon = "icon-thumbnails-small", IsSystem = 1, Selected = true, Path = "views/propertyeditors/listview/layouts/grid/grid.html" }
};

IncludeProperties = new []
IncludeProperties = new[]
{
new Property { Alias = "sortOrder", Header = "Sort order", IsSystem = 1 },
new Property { Alias = "updateDate", Header = "Last edited", IsSystem = 1 },
Expand All @@ -41,7 +41,7 @@ public ListViewConfiguration()

[ConfigurationField("pageSize", "Page Size", "number", Description = "Number of items per page")]
public int PageSize { get; set; }

[ConfigurationField("orderBy", "Order By", "views/propertyeditors/listview/sortby.prevalues.html",
Description = "The default sort order for the list")]
public string OrderBy { get; set; }
Expand Down Expand Up @@ -69,54 +69,57 @@ public ListViewConfiguration()
[ConfigurationField("showContentFirst", "Show Content App First", "boolean", Description = "Enable this to show the content app by default instead of the list view app")]
public bool ShowContentFirst { get; set; }

[DataContract]
public class Property
{
[JsonProperty("alias")]
[DataMember(Name = "alias")]
public string Alias { get; set; }

[JsonProperty("header")]
[DataMember(Name = "header")]
public string Header { get; set; }

[JsonProperty("nameTemplate")]
[DataMember(Name = "nameTemplate")]
public string Template { get; set; }

[JsonProperty("isSystem")]
[DataMember(Name = "isSystem")]
public int IsSystem { get; set; } // TODO: bool
}

[DataContract]
public class Layout
{
[JsonProperty("name")]
[DataMember(Name = "name")]
public string Name { get; set; }

[JsonProperty("path")]
[DataMember(Name = "path")]
public string Path { get; set; }

[JsonProperty("icon")]
[DataMember(Name = "icon")]
public string Icon { get; set; }

[JsonProperty("isSystem")]
[DataMember(Name = "isSystem")]
public int IsSystem { get; set; } // TODO: bool

[JsonProperty("selected")]
[DataMember(Name = "selected")]
public bool Selected { get; set; }
}

[DataContract]
public class BulkActionPermissionSettings
{
[JsonProperty("allowBulkPublish")]
[DataMember(Name = "allowBulkPublish")]
public bool AllowBulkPublish { get; set; } = true;

[JsonProperty("allowBulkUnpublish")]
[DataMember(Name = "allowBulkUnpublish")]
public bool AllowBulkUnpublish { get; set; } = true;

[JsonProperty("allowBulkCopy")]
[DataMember(Name = "allowBulkCopy")]
public bool AllowBulkCopy { get; set; } = true;

[JsonProperty("allowBulkMove")]
[DataMember(Name = "allowBulkMove")]
public bool AllowBulkMove { get; set; } = true;

[JsonProperty("allowBulkDelete")]
[DataMember(Name = "allowBulkDelete")]
public bool AllowBulkDelete { get; set; } = true;
}
}
Expand Down
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using Umbraco.Core;
using Umbraco.Core.PropertyEditors;

namespace Umbraco.Web.PropertyEditors
{
Expand Down
@@ -0,0 +1,21 @@
using System.Runtime.Serialization;
using Umbraco.Core;

namespace Umbraco.Web.PropertyEditors
{
/// <summary>
/// Represents the 'startNode' value for the <see cref="Umbraco.Web.PropertyEditors.MultiNodePickerConfiguration"/>
/// </summary>
[DataContract]
public class MultiNodePickerConfigurationTreeSource
{
[DataMember(Name = "type")]
public string ObjectType { get; set; }

[DataMember(Name = "query")]
public string StartNodeQuery { get; set; }

[DataMember(Name = "id")]
public Udi StartNodeId { get; set; }
}
}
@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
using Umbraco.Core.PropertyEditors;

namespace Umbraco.Web.PropertyEditors
Expand Down Expand Up @@ -27,15 +27,17 @@ public class NestedContentConfiguration
[ConfigurationField("hideLabel", "Hide Label", "boolean", Description = "Hide the property label and let the item list span the full width of the editor window.")]
public bool HideLabel { get; set; }


[DataContract]
public class ContentType
{
[JsonProperty("ncAlias")]
[DataMember(Name = "ncAlias")]
public string Alias { get; set; }

[JsonProperty("ncTabAlias")]
[DataMember(Name = "ncTabAlias")]
public string TabAlias { get; set; }

[JsonProperty("nameTemplate")]
[DataMember(Name = "nameTemplate")]
public string Template { get; set; }
}
}
Expand Down
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Umbraco.Core;
using Umbraco.Core.PropertyEditors;

namespace Umbraco.Web.PropertyEditors
Expand Down

This file was deleted.

0 comments on commit 7809d15

Please sign in to comment.