From 9af135e7e7adf70c7b00fea33c09dc5ac70aa3f4 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Thu, 17 Oct 2019 21:19:17 +0200 Subject: [PATCH] Make the color class prefix configurable for the umb-color-swatches directive --- .../directives/components/umbcolorswatches.directive.js | 9 ++++++++- .../src/views/components/umb-color-swatches.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbcolorswatches.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbcolorswatches.directive.js index d998504d1b..9d7927f59a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbcolorswatches.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbcolorswatches.directive.js @@ -18,6 +18,7 @@ Use this directive to generate color swatches to pick from. @param {string} size (attribute): The size (s, m). @param {string} useLabel (attribute): Specify if labels should be used. @param {string} useColorClass (attribute): Specify if color values are css classes. +@param {string} colorClassNamePrefix (attribute): Specify the prefix used for the class for each color (defaults to "btn"). @param {function} onSelect (expression): Callback function when the item is selected. **/ @@ -32,6 +33,11 @@ Use this directive to generate color swatches to pick from. if (angular.isUndefined(scope.useColorClass)) { scope.useColorClass = false; } + + // Set default to "btn" if not defined + if (angular.isUndefined(scope.colorClassNamePrefix)) { + scope.colorClassNamePrefix = "btn"; + } scope.setColor = function (color, $index, $event) { if (scope.onSelect) { @@ -66,7 +72,8 @@ Use this directive to generate color swatches to pick from. selectedColor: '=', onSelect: '&', useLabel: '=', - useColorClass: '=?' + useColorClass: '=?', + colorClassNamePrefix: '@?' }, link: link }; diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-color-swatches.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-color-swatches.html index 91d461668f..7e6bf443b2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/umb-color-swatches.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-color-swatches.html @@ -1,6 +1,6 @@ 
-