Archetype Label Template for nuPicker Property Editors
Not a question. Just a bit of code some others may be interested in:
// ALT = Archetype Label Templates.
window.NuPickerAlt = {};
/**
* Used in Archetype as a label template to show a value for a NuPicker drop down.
* @param {any} value The value to show the label template for.
* @returns {Function} The function that subsequently returns a promise that resolves
* to the string value to show in the Archetype label.
*/
window.NuPickerAlt.nuPickerDropDown = function (value) {
return function ($q) {
var deferred = $q.defer();
if (value && value.length) {
// Get the value of the nuPicker drop down. Note that this doesn't
// seem to update until publishing the content node.
deferred.resolve(value[0].label);
} else {
deferred.resolve(null);
}
return deferred.promise;
};
};
That adds NuPickerAlt.nuPickerDropDown as an Archetype label function that shows the value of a nuPicker drop down (useful when you want to show the value of a nuPicker drop down in the header of an Archetype fieldset, such as when it's collapsed). Might work for the other nuPickers as well, but I've only tested it with the drop down.
You can just toss this in a JavaScript file, then load the JavaScript file with a package.manifest file in App_Plugins that points to the JavaScript file (that way, it will run in the back office).
Archetype Label Template for nuPicker Property Editors
Not a question. Just a bit of code some others may be interested in:
That adds
NuPickerAlt.nuPickerDropDown
as an Archetype label function that shows the value of a nuPicker drop down (useful when you want to show the value of a nuPicker drop down in the header of an Archetype fieldset, such as when it's collapsed). Might work for the other nuPickers as well, but I've only tested it with the drop down.You can just toss this in a JavaScript file, then load the JavaScript file with a
package.manifest
file inApp_Plugins
that points to the JavaScript file (that way, it will run in the back office).is working on a reply...