I'm trying to create a custom property type that uses the built in property type for the Umbraco color picker but not having much luck!
I'm a bit of an Angular noob so forgive me if I'm missing something obvious!
I've had a look at the Umbraco source to get the HTML for the view and the code for the controller and created them in files in UIMatic\backoffice\views as colorpicker.html and colorpicker.controller.js. Both of these files get called but I'm getting console errors when I use them. Code for the HTML file is (copied from Umbraco source)
<div ng-controller="UIOMatic.Views.ColorPickerController">
<div ng-if="!isConfigured">
<localize key="colorpicker_noColors">You haven't defined any colors</localize>
</div>
<ul class="thumbnails color-picker">
<li ng-repeat="(key, val) in property.config.items" ng-class="{active: property.value === val}">
<a ng-click="toggleItem(val)" class="thumbnail" hex-bg-color="{{val}}">
</a>
</li>
</ul>
Sorry Tim, maybe I am misunderstanding but I don't actually need to create a new property type editor. I just need to use the built in Umbraco one that is located here /umbraco/Views/propertyeditors/colorpicker/colorpicker.html
and then save and retrieve the values from the UI-O-Matic screen.
Is this possible?
I've tried the following but still get the config error:
[UIOMaticField("Color", "", View = "~/umbraco/Views/propertyeditors/colorpicker/colorpicker.html")]
public string Color { get; set; }
Colorpicker custom property type
I'm trying to create a custom property type that uses the built in property type for the Umbraco color picker but not having much luck!
I'm a bit of an Angular noob so forgive me if I'm missing something obvious!
I've had a look at the Umbraco source to get the HTML for the view and the code for the controller and created them in files in UIMatic\backoffice\views as colorpicker.html and colorpicker.controller.js. Both of these files get called but I'm getting console errors when I use them. Code for the HTML file is (copied from Umbraco source)
Code for controller is :
However, I get the following error:
TypeError: Cannot read property 'config' of undefined at new ColorPickerController
and it refers to this line:
I suspect its something about not being able to get the approved color values from Umbraco but not sure where this would go.
In my package.manifest the only thing I'm doing is referencing the colorpicker.controller.js file
Thanks in advance
Comment author was deleted
Yeah your color pickers needs config (you need to define the colors) so in your package manifest you'll also need to setup those
Thanks Tim, could you point me in the direction of example where I can do that? I'd like it to get the colors from the approved colors in Umbraco
Comment author was deleted
Some details here https://our.umbraco.org/documentation/tutorials/Creating-a-Property-Editor/part-2 you'll have to update the package.manifest
There is probably a built in view you can point it to, check the umbraco\Views\propertyeditors\colorpicker directory
Sorry Tim, maybe I am misunderstanding but I don't actually need to create a new property type editor. I just need to use the built in Umbraco one that is located here /umbraco/Views/propertyeditors/colorpicker/colorpicker.html
and then save and retrieve the values from the UI-O-Matic screen.
Is this possible?
I've tried the following but still get the config error:
Comment author was deleted
Ah I see well then you would need to wrap it in a custom UI-O-Matic property view,
These 2 link should get you started http://uiomatic.readthedocs.org/en/latest/04.CustomPropertyViews/
http://www.enkelmedia.se/blogg/2013/12/4/umbraco-7-use-the-rich-text-editor-tinymce-in-a-custom-section.aspx
is working on a reply...