diff --git a/README.md b/README.md
index 595a616..b647479 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
# Property List
[![Build status](https://img.shields.io/appveyor/ci/UMCO/umbraco-property-list.svg)](https://ci.appveyor.com/project/UMCO/umbraco-property-list)
+[![NuGet release](https://img.shields.io/nuget/v/Our.Umbraco.PropertyList.svg)](https://www.nuget.org/packages/Our.Umbraco.PropertyList)
Property List is a property editor for making repeatable lists of a datatype for Umbraco 7.6+
@@ -10,7 +11,16 @@ Property List is a property editor for making repeatable lists of a datatype for
> *Note:* Property List has been developed against **Umbraco v7.6.0** and will support that version and above.
-Property List can be built manually from the source-code:
+Property List can be installed from either NuGet package repositories, or build manually from the source-code:
+
+
+#### NuGet package repository
+
+To [install from NuGet](https://www.nuget.org/packages/Our.Umbraco.PropertyList), you can run the following command from within Visual Studio:
+
+ PM> Install-Package Our.Umbraco.PropertyList
+
+We also have a [MyGet package repository](https://www.myget.org/gallery/umbraco-packages) - for bleeding-edge / development releases.
#### Manual build
@@ -44,60 +54,11 @@ Anyone and everyone is welcome to contribute. Please take a moment to review the
What's left to do?
-- [x] Pre Value Editor
- - [x] Prevalues
- - [x] DataType Picker
- - [x] Only save the ID
- - [x] Minimum items
- - [x] Maximum items
- - [x] Hide label
- - **Ideas**
- - [ ] Disable sorting?
-
-- [ ] Value Editor
- - [x] ContentType preview
- - [x] HTML view
- - [x] Check if we can we reuse any Umbraco directives?
- - [x] Check if any UMCO projects are useful for reuse?
- - [x] CSS
- - [x] Angular / JS
- - [x] Prepare the value-editor
- - [x] Get the DataType by ID; then get...
- - [x] config/prevalues
- - [x] view-path
- - [x] property alias
- - [x] Initialize the list values
- - [x] Set the list values
- - [x] Set the IsDirty flag
- - [x] Render the DataType/property-editor
- - [x] Repeatable
- - [x] Addable
- - [x] Removeable
- - [x] Sortable
- - [x] Saving the values
- - [x] PropertyValueEditor
- - [x] ConvertDbToString
- - [x] ConvertDbToEditor
- - [x] ConvertEditorToDb
- - [x] Browser testing (Chrome, Firefox, IE/Edge)
-
-- [x] PropertyValueConverter
- - [x] Get target DataType definition
- - [x] Create dummy PropertyType (in order to run the target property-editor's value-converter)
- - [x] Return as IEnumerable of that type
- - [x] Investigate ModelsBuilder support - think it's to provide the return type
-
-- [x] Packaging
- - [x] MSBuild script
- - [x] Umbraco package
- - [x] NuGet package
- - [x] AppVeyor
-
-- [ ] Courier data-resolver
- - [ ] Pre Value Editor
- - [ ] Add DataType dependency
- - [ ] Value Editor
- - [ ] Processing all list item DataTypes
+- [ ] Deploy ValueConnector
+ - [ ] Pre Value Editor
+ - [ ] Add DataType dependency
+ - [ ] Value Editor
+ - [ ] Processing all list item DataTypes
---
diff --git a/appveyor.yml b/appveyor.yml
index 61eb05e..af9a8c4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,7 +6,7 @@ version: 1.0.0.{build}
# UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha
# example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta
init:
- - set UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta
+ - set UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta2
cache:
- src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
diff --git a/src/Our.Umbraco.PropertyList/Bootstrap.cs b/src/Our.Umbraco.PropertyList/Bootstrap.cs
index dc7600e..d33a973 100644
--- a/src/Our.Umbraco.PropertyList/Bootstrap.cs
+++ b/src/Our.Umbraco.PropertyList/Bootstrap.cs
@@ -1,5 +1,5 @@
using Newtonsoft.Json;
-using Our.Umbraco.PropertyList.Converters;
+using Our.Umbraco.PropertyList.ValueConverters;
using Umbraco.Core;
using Umbraco.Core.Sync;
using Umbraco.Web.Cache;
diff --git a/src/Our.Umbraco.PropertyList/Our.Umbraco.PropertyList.csproj b/src/Our.Umbraco.PropertyList/Our.Umbraco.PropertyList.csproj
index 12fd292..0a7ea38 100644
--- a/src/Our.Umbraco.PropertyList/Our.Umbraco.PropertyList.csproj
+++ b/src/Our.Umbraco.PropertyList/Our.Umbraco.PropertyList.csproj
@@ -35,38 +35,10 @@
..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dllFalse
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\businesslogic.dll
- False
- ..\packages\ClientDependency.1.9.2\lib\net45\ClientDependency.Core.dllFalse
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\cms.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\controls.dll
- False
-
-
- ..\packages\Examine.0.1.82\lib\net45\Examine.dll
- False
-
-
- ..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll
- False
-
-
- ..\packages\ImageProcessor.2.5.3\lib\net45\ImageProcessor.dll
- False
-
-
- ..\packages\ImageProcessor.Web.4.8.3\lib\net45\ImageProcessor.Web.dll
- False
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\interfaces.dllFalse
@@ -75,18 +47,6 @@
..\packages\UmbracoCms.Core.7.6.0\lib\net45\log4net.dllFalse
-
- ..\packages\Log4Net.Async.2.0.4\lib\net40\Log4Net.Async.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\Microsoft.ApplicationBlocks.Data.dll
- False
-
-
- ..\packages\Microsoft.AspNet.SignalR.Core.2.2.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll
- False
- ..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dllFalse
@@ -95,59 +55,22 @@
..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dllFalse
-
- ..\packages\Owin.1.0\lib\net40\Owin.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\SQLCE4Umbraco.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\System.Data.SqlServerCe.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\System.Data.SqlServerCe.Entity.dll
- False
-
-
- ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll
- False
-
-
- ..\packages\System.Threading.Tasks.Dataflow.4.7.0\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll
- False
-
-
- ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll
- False
- ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dllFalse
-
- ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll
- False
- ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dllFalse
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\TidyNet.dll
- False
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\umbraco.dllFalse
@@ -156,34 +79,10 @@
..\packages\UmbracoCms.Core.7.6.0\lib\net45\Umbraco.Core.dllFalse
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\umbraco.DataLayer.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\umbraco.editorControls.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\umbraco.MacroEngines.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\umbraco.providers.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\Umbraco.Web.UI.dll
- False
-
-
- ..\packages\UmbracoCms.Core.7.6.0\lib\net45\UmbracoExamine.dll
- False
-
-
+
@@ -198,9 +97,7 @@
-
-
-
+
diff --git a/src/Our.Umbraco.PropertyList/PropertyEditors/PropertyListPreValueEditor.cs b/src/Our.Umbraco.PropertyList/PropertyEditors/PropertyListPreValueEditor.cs
index c1e7fa6..b017b2b 100644
--- a/src/Our.Umbraco.PropertyList/PropertyEditors/PropertyListPreValueEditor.cs
+++ b/src/Our.Umbraco.PropertyList/PropertyEditors/PropertyListPreValueEditor.cs
@@ -1,19 +1,47 @@
-using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.IO;
+using Umbraco.Core.PropertyEditors;
namespace Our.Umbraco.PropertyList.PropertyEditors
{
internal class PropertyListPreValueEditor : PreValueEditor
{
- [PreValueField("dataType", "Data Type", "~/App_Plugins/PropertyList/views/propertylist.datatypepicker.html", Description = "Select a data type.")]
- public string DataType { get; set; }
+ public PropertyListPreValueEditor()
+ : base()
+ {
+ // In terms of inheritance, we'd like the "dataType" field to always be at the top.
+ Fields.Insert(0, new PreValueField
+ {
+ Key = "dataType",
+ Name = "Data Type",
+ View = IOHelper.ResolveUrl("~/App_Plugins/PropertyList/views/propertylist.datatypepicker.html"),
+ Description = "Select a data type."
+ });
- [PreValueField("minItems", "Min Items", "number", Description = "Set the minimum number of items allowed.")]
- public string MinItems { get; set; }
-
- [PreValueField("maxItems", "Max Items", "number", Description = "Set the maximum number of items allowed.")]
- public string MaxItems { get; set; }
-
- [PreValueField("hideLabel", "Hide Label", "boolean", Description = "Set whether to hide the editor label and have the list take up the full width of the editor window.")]
- public string HideLabel { get; set; }
+ // The rest of the fields can be added at the bottom.
+ Fields.AddRange(new[]
+ {
+ new PreValueField
+ {
+ Key = "minItems",
+ Name = "Min Items",
+ View = "number",
+ Description = "Set the minimum number of items allowed."
+ },
+ new PreValueField
+ {
+ Key = "maxItems",
+ Name = "Max Items",
+ View = "number",
+ Description = "Set the maximum number of items allowed."
+ },
+ new PreValueField
+ {
+ Key = "hideLabel",
+ Name = "Hide Label",
+ View = "boolean",
+ Description = "Set whether to hide the editor label and have the list take up the full width of the editor window."
+ }
+ });
+ }
}
}
\ No newline at end of file
diff --git a/src/Our.Umbraco.PropertyList/PropertyEditors/PropertyListPropertyEditor.cs b/src/Our.Umbraco.PropertyList/PropertyEditors/PropertyListPropertyEditor.cs
index 81300a1..c919767 100644
--- a/src/Our.Umbraco.PropertyList/PropertyEditors/PropertyListPropertyEditor.cs
+++ b/src/Our.Umbraco.PropertyList/PropertyEditors/PropertyListPropertyEditor.cs
@@ -1,36 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Xml.Linq;
+using System.Collections.Generic;
using ClientDependency.Core;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Our.Umbraco.PropertyList.Models;
-using Umbraco.Core;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
-using Umbraco.Core.Services;
using Umbraco.Web.PropertyEditors;
namespace Our.Umbraco.PropertyList.PropertyEditors
{
- [PropertyEditor(
- PropertyEditorAlias,
- "Property List",
- "JSON",
- "~/App_Plugins/PropertyList/Views/propertylist.html",
- Group = "Lists",
- Icon = "icon-bulleted-list",
- IsParameterEditor = false)]
- [PropertyEditorAsset(ClientDependencyType.Css, "~/App_Plugins/PropertyList/css/propertylist.css")]
- [PropertyEditorAsset(ClientDependencyType.Javascript, "~/App_Plugins/PropertyList/js/propertylist.controllers.js")]
- [PropertyEditorAsset(ClientDependencyType.Javascript, "~/App_Plugins/PropertyList/js/propertylist.resources.js")]
+ [PropertyEditor(PropertyEditorAlias, PropertyEditorName, "JSON", PropertyEditorViewPath, Group = "Lists", Icon = "icon-bulleted-list", IsParameterEditor = false)]
+ [PropertyEditorAsset(ClientDependencyType.Javascript, "~/App_Plugins/PropertyList/js/propertylist.js")]
public class PropertyListPropertyEditor : PropertyEditor
{
public const string PropertyEditorAlias = "Our.Umbraco.PropertyList";
+ public const string PropertyEditorName = "Property List";
+ public const string PropertyEditorViewPath = "~/App_Plugins/PropertyList/Views/propertylist.html";
internal const string DefaultTextstringPropertyEditorGuid = "0cc0eba1-9960-42c9-bf9b-60e150b429ae"; // Guid for default Textstring
diff --git a/src/Our.Umbraco.PropertyList/Converters/PropertyListValueConverter.cs b/src/Our.Umbraco.PropertyList/ValueConverters/PropertyListValueConverter.cs
similarity index 84%
rename from src/Our.Umbraco.PropertyList/Converters/PropertyListValueConverter.cs
rename to src/Our.Umbraco.PropertyList/ValueConverters/PropertyListValueConverter.cs
index 915b410..0ef3750 100644
--- a/src/Our.Umbraco.PropertyList/Converters/PropertyListValueConverter.cs
+++ b/src/Our.Umbraco.PropertyList/ValueConverters/PropertyListValueConverter.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Xml.Linq;
using System.Xml.XPath;
@@ -12,7 +11,7 @@
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
-namespace Our.Umbraco.PropertyList.Converters
+namespace Our.Umbraco.PropertyList.ValueConverters
{
public class PropertyListValueConverter : PropertyValueConverterBase, IPropertyValueConverterMeta
{
@@ -23,8 +22,8 @@ public override bool IsConverter(PublishedPropertyType propertyType)
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
- var sourceString = source?.ToString();
- if (string.IsNullOrWhiteSpace(sourceString))
+ var data = source?.ToString();
+ if (string.IsNullOrWhiteSpace(data))
return null;
var innerPropertyType = this.GetInnerPublishedPropertyType(propertyType);
@@ -36,16 +35,16 @@ public override object ConvertDataToSource(PublishedPropertyType propertyType, o
// NOTE: We can't be sure which format the data is in.
// With "nested property-editors", (e.g. Nested Content, Stacked Content),
// they don't convert the call `ConvertDbToXml`.
- if (sourceString.DetectIsJson())
+ if (data.DetectIsJson())
{
- var model = JsonConvert.DeserializeObject(sourceString);
+ var model = JsonConvert.DeserializeObject(data);
if (model != null)
items.AddRange(model.Values);
}
else
{
// otherwise we assume it's XML
- var elements = XElement.Parse(sourceString);
+ var elements = XElement.Parse(data);
if (elements != null && elements.HasElements)
items.AddRange(elements.XPathSelectElements("value").Select(x => x.Value));
}
@@ -96,12 +95,29 @@ public override object ConvertSourceToObject(PublishedPropertyType propertyType,
public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview)
{
- // TODO: Review if we need to call `ConvertSourceToXPath` for each of the values?
+ if (source is List