Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeavon committed Oct 25, 2016
2 parents cd06bca + 1a5ed8d commit 0e7a834
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#VS 2015 hidden folder
**/.vs/*

.DS_Store
.AppleDouble
.LSOverride
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# 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.

Authored by Tom Fulton, Kevin Giszewski, Jeavon Leopold, Bjarne Fyrstenborg and others.

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<UrlPicker>` depending on if the developer has set UrlPicker to multiple mode in the data type prevalues

## Installation ##

Both NuGet and Umbraco packages are available.
Expand All @@ -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)
|**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)
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.16.0.{build}
version: 0.16.1.{build}
os: Visual Studio 2015

cache:
Expand Down
Binary file added assets/urlpicker-icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions urlpicker/app/scripts/controllers/url.picker.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion urlpicker/config/meta.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
5 changes: 3 additions & 2 deletions urlpicker/src/UrlPicker.Umbraco/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Original file line number Diff line number Diff line change
Expand Up @@ -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<IEnumerable<Models.UrlPicker>>(sourceString);

var helper = new UmbracoHelper(UmbracoContext.Current);
Expand Down Expand Up @@ -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<bool>();
var attemptConvert = multiPickerPreValue.Value.TryConvertTo<bool>();

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<bool>(cacheKey, () => multipleItems);
Expand Down

0 comments on commit 0e7a834

Please sign in to comment.