diff --git a/.gitignore b/.gitignore index 1bb174e..f667f4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +#VS 2015 hidden folder +**/.vs/* + .DS_Store .AppleDouble .LSOverride diff --git a/README.md b/README.md index 3cef18d..73c811b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # UrlPicker for Umbraco v7 # -![UrlPicker](assets/urlpicker-icon.png) +![UrlPicker](assets/urlpicker-icon-128.png) + +[![Build status](https://ci.appveyor.com/api/projects/status/k92sy9ea8oak14n6?svg=true)](https://ci.appveyor.com/project/JeavonLeopold/uwestfest-x4mvd) Originally built during uWestFest 2014 and released on NuGet only. Now available to non-Nugeteers. @@ -8,6 +10,8 @@ Authored by Tom Fulton, Kevin Giszewski, Jeavon Leopold, Bjarne Fyrstenborg and If using v0.15.x+ with Umbraco Core 7.2.8 and lower, please note you will need to merge translation keys manually into the language file of choice. +v0.16.0 contains an (un)breaking change as the value converter will now return either a `UrlPicker` object or a `IEnumerable` depending on if the developer has set UrlPicker to multiple mode in the data type prevalues + ## Installation ## Both NuGet and Umbraco packages are available. @@ -20,4 +24,8 @@ Both NuGet and Umbraco packages are available. |Umbraco Packages | | |:-----------------|:-----------------| |**Release**|[![Our Umbraco project page](https://img.shields.io/badge/our-umbraco-orange.svg)](https://our.umbraco.org/projects/backoffice-extensions/urlpicker/) -|**Pre-release**| [![AppVeyor Artifacts](https://img.shields.io/badge/appveyor-umbraco-orange.svg)](https://ci.appveyor.com/project/JeavonLeopold/uwestfest-x4mvd/build/artifacts) \ No newline at end of file +|**Pre-release**| [![AppVeyor Artifacts](https://img.shields.io/badge/appveyor-umbraco-orange.svg)](https://ci.appveyor.com/project/JeavonLeopold/uwestfest-x4mvd/build/artifacts) + +## Usage ## + +Examples available in the [Wiki](https://github.com/kgiszewski/uWestFest/wiki/Usage) \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index befeee5..e3ce7bb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.16.0.{build} +version: 0.16.1.{build} os: Visual Studio 2015 cache: diff --git a/assets/urlpicker-icon-128.png b/assets/urlpicker-icon-128.png new file mode 100644 index 0000000..6abbb58 Binary files /dev/null and b/assets/urlpicker-icon-128.png differ diff --git a/urlpicker/app/scripts/controllers/url.picker.controller.js b/urlpicker/app/scripts/controllers/url.picker.controller.js index 10ad771..7991512 100644 --- a/urlpicker/app/scripts/controllers/url.picker.controller.js +++ b/urlpicker/app/scripts/controllers/url.picker.controller.js @@ -348,6 +348,13 @@ angular.module('umbraco').controller('UrlPickerController', function ($scope, $t // Setup "render model" & defaults function init() { + // hack to update v0.14 or lower version items to new format + var stringValue = JSON.stringify($scope.model.value); + if (stringValue.substring(0, 1) === '{') { + var newStringValue = "[" + JSON.stringify($scope.model.value) + "]"; + $scope.model.value = newStringValue; + } + // content start node if (!$scope.model.config.contentStartNode) $scope.model.config.contentStartNode = -1; diff --git a/urlpicker/config/meta.json b/urlpicker/config/meta.json index f449a6b..c02dcae 100644 --- a/urlpicker/config/meta.json +++ b/urlpicker/config/meta.json @@ -1,6 +1,6 @@ { "name": "UrlPicker", - "version": "0.15.0.1", + "version": "1.0.0.0", "url": "https://github.com/imulus/uWestFest", "author": "Imulus - Kevin Giszewski - Tom Fulton - Jeavon Leopold - Bjarne Fyrstenborg, Et. Al.", "authorUrl": "http://imulus.com/", diff --git a/urlpicker/src/UrlPicker.Umbraco/Properties/AssemblyInfo.cs b/urlpicker/src/UrlPicker.Umbraco/Properties/AssemblyInfo.cs index 40b2124..66ce536 100644 --- a/urlpicker/src/UrlPicker.Umbraco/Properties/AssemblyInfo.cs +++ b/urlpicker/src/UrlPicker.Umbraco/Properties/AssemblyInfo.cs @@ -32,5 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.13.0.0")] -[assembly: AssemblyFileVersion("0.15.0.1")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyInformationalVersion("1.0.0.0")] \ No newline at end of file diff --git a/urlpicker/src/UrlPicker.Umbraco/PropertyConverters/UrlPickerValueConverter.cs b/urlpicker/src/UrlPicker.Umbraco/PropertyConverters/UrlPickerValueConverter.cs index 168f3a6..06e37bd 100644 --- a/urlpicker/src/UrlPicker.Umbraco/PropertyConverters/UrlPickerValueConverter.cs +++ b/urlpicker/src/UrlPicker.Umbraco/PropertyConverters/UrlPickerValueConverter.cs @@ -33,6 +33,12 @@ public override object ConvertSourceToObject(PublishedPropertyType propertyType, { try { + // hack to update v0.14 or lower version items to new format + if (sourceString.StartsWith("{")) + { + sourceString = string.Format("[{0}]", sourceString); + } + var pickers = JsonConvert.DeserializeObject>(sourceString); var helper = new UmbracoHelper(UmbracoContext.Current); @@ -151,20 +157,28 @@ private bool IsMultipleDataType(int dataTypeId) return (bool) cachedValue; } - var dts = ApplicationContext.Current.Services.DataTypeService; + var multipleItems = false; - var multiPickerPreValue = - dts.GetPreValuesCollectionByDataTypeId(dataTypeId) - .PreValuesAsDictionary.FirstOrDefault( - x => string.Equals(x.Key, "multipleItems", StringComparison.InvariantCultureIgnoreCase)).Value; + try + { + var dts = ApplicationContext.Current.Services.DataTypeService; - var multipleItems = false; + var multiPickerPreValue = + dts.GetPreValuesCollectionByDataTypeId(dataTypeId) + .PreValuesAsDictionary.FirstOrDefault( + x => string.Equals(x.Key, "multipleItems", StringComparison.InvariantCultureIgnoreCase)) + .Value; - var attemptConvert = multiPickerPreValue.Value.TryConvertTo(); + var attemptConvert = multiPickerPreValue.Value.TryConvertTo(); - if (attemptConvert.Success) + if (attemptConvert.Success) + { + multipleItems = attemptConvert.Result; + } + } + catch { - multipleItems = attemptConvert.Result; + LogHelper.Warn(typeof(UrlPickerValueConverter), string.Format("Error finding multipleItems data type prevalue, likely you've updated UrlPicker, plesae resave data type with id:{0}", dataTypeId)); } LocalCache.InsertLocalCacheItem(cacheKey, () => multipleItems);