v8: Fix doctype iconpicker (#4053)

This commit is contained in:
Bjarne Fyrstenborg
2019-01-20 20:56:49 +01:00
committed by Sebastiaan Janssen
parent da58673b44
commit 07329103b1
4 changed files with 22 additions and 8 deletions

View File

@@ -33,10 +33,11 @@ Use this directive to generate color swatches to pick from.
scope.useColorClass = false;
}
scope.setColor = function (color) {
scope.setColor = function (color, $index, $event) {
scope.selectedColor = color;
if (scope.onSelect) {
scope.onSelect(color);
scope.onSelect(color, $index, $event);
$event.stopPropagation();
}
};
}
@@ -50,7 +51,7 @@ Use this directive to generate color swatches to pick from.
colors: '=?',
size: '@',
selectedColor: '=',
onSelect: '&',
onSelect: '=',
useLabel: '=',
useColorClass: '=?'
},

View File

@@ -11,6 +11,8 @@ function IconPickerController($scope, iconHelper, localizationService) {
var vm = this;
vm.selectIcon = selectIcon;
vm.selectColor = selectColor;
vm.submit = submit;
vm.close = close;
vm.colors = [
@@ -47,11 +49,10 @@ function IconPickerController($scope, iconHelper, localizationService) {
});
// set a default color if nothing is passed in
vm.color = $scope.model.color ? $scope.model.color : vm.colors[0].value;
vm.color = $scope.model.color ? $scope.model.color : vm.colors[0].value;
// if an icon is passed in - preselect it
vm.icon = $scope.model.icon ? $scope.model.icon : undefined;
}
function setTitle() {
@@ -69,6 +70,10 @@ function IconPickerController($scope, iconHelper, localizationService) {
submit();
}
function selectColor(color, $index, $event) {
$scope.model.color = color;
}
function close() {
if($scope.model && $scope.model.close) {
$scope.model.close();
@@ -76,7 +81,7 @@ function IconPickerController($scope, iconHelper, localizationService) {
}
function submit() {
if($scope.model && $scope.model.submit) {
if ($scope.model && $scope.model.submit) {
$scope.model.submit($scope.model);
}
}

View File

@@ -36,7 +36,8 @@
use-color-class="true"
colors="vm.colors"
selected-color="vm.color"
size="s">
size="s"
on-select="vm.selectColor">
</umb-color-swatches>
</div>
@@ -71,6 +72,13 @@
shortcut="esc"
action="vm.close()">
</umb-button>
<umb-button
type="button"
button-style="success"
label-key="general_submit"
state="vm.saveButtonState"
action="vm.submit(model)">
</umb-button>
</umb-editor-footer-content-right>
</umb-editor-footer>

View File

@@ -1,6 +1,6 @@
<div class="umb-color-swatches" ng-class="{ 'with-labels': useLabel }">
<button type="button" class="umb-color-box umb-color-box--{{size}} btn-{{color.value}}" ng-repeat="color in colors" title="{{useLabel || useColorClass ? (color.label || color.value) : ('#' + color.value)}}" hex-bg-inline="{{useColorClass === false}}" hex-bg-color="{{color.value}}" ng-class="{ 'active': color.value === selectedColor }" ng-click="setColor(color.value)">
<button type="button" class="umb-color-box umb-color-box--{{size}} btn-{{color.value}}" ng-repeat="color in colors" title="{{useLabel || useColorClass ? (color.label || color.value) : ('#' + color.value)}}" hex-bg-inline="{{useColorClass === false}}" hex-bg-color="{{color.value}}" ng-class="{ 'active': color.value === selectedColor }" ng-click="setColor(color.value, $index, $event)">
<div class="umb-color-box-inner">
<div class="check_circle" ng-if="color.value === selectedColor">
<i class="icon icon-check small"></i>