U4-9497 - Update Related Links Property Editor to support UDIs

Created by Shannon Deminick 08 Feb 2017, 02:51:13 Updated by Shannon Deminick 29 May 2017, 18:15:38

Relates to: U4-9619

Relates to: U4-9310

Subtask of: UAASSCRUM-810

For this we need to create a new Related Links Property Editor (suffixed with "2" like we did for the pickers and new UDI configurations) and then deprecate the original property editor by specifying that in it's attribute - just like we did for the non-udi pickers.

We should try to minimize code duplication where possible like we did with the pickers.

Comments

Shannon Deminick 13 Mar 2017, 05:54:59

PR: https://github.com/umbraco/Umbraco-CMS/pull/1792

This deprecates the old related links property editor and creates a new one. The new one will store UDIs for the internal node Ids

We'll need to update the property value converter for this in http://issues.umbraco.org/issue/U4-9611

You can test by creating a new data type with the Related Links Property Editor (not the deprecated one), then add to a doc type and create some content with it and choose some internal items and save. Then check the db:

SELECT TOP 20 * FROM cmsPropertyData WHERE contentNodeId = 3439
ORDER BY id DESC

And have a look to see that the json value saved for that item contains UDI ids and not INT.

I've updated the original property value converter to also deal with these UDIs, which you can test. To do that you'll need to make sure that the new property value converters are not enabled which is in your umbracoSettings.config, set it to false: <EnablePropertyValueConverters>false</EnablePropertyValueConverters>

Then render out a value from this property which will have the resolved URL in the json now, you can test by (if youre property is called "relatedLinks"):

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Test>
@using ContentModels = Umbraco.Web.PublishedContentModels;
@using Newtonsoft.Json;
@using Newtonsoft.Json.Linq;
@{
	Layout = null;
}
<html>
    <body>
        <code>
            @(JsonConvert.SerializeObject(Model.Content.GetPropertyValue<JArray>("relatedLinks")))
        </code>
    </body>
</html>

You should see the json but the 'link' property for each item will be converted to a real link instead of the id


Warren Buckley 13 Mar 2017, 14:08:31

OK done the tests above The first one was not working - but this is where a couple of places was still using the int id in the AngularJS controller for the RelatedLinks property editor and not using the UDI or Int depending on the config value passed to it.

So I have pushed a commit to fix this up - but I would like a quick sanity check from someone else.

I can confirm when the property value converter config switch is turned off - we still convert the stored UDI to the URL of the content node.

The same goes for when using the int based/legacy editor (Saving values in the DB & using the value converter - when the new one is not enabled/set to false)


Shannon Deminick 14 Mar 2017, 00:37:29

Thanks @warren.buckley ! looks good to me, so i guess part of the tests should be editing an existing one and ensuring the UDI is retained instead of an INT, good catch!


Priority: Normal

Type: Feature (request)

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.6.0

Sprint: Sprint 54

Story Points: 2

Cycle: