Fix label style issue when list of labels is updated

fixes #373

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-01-08 14:37:44 +01:00
parent c517dbdb77
commit f55fb90cfa
4 changed files with 18 additions and 4 deletions

View File

@@ -320,4 +320,11 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
} }
}; };
$scope.labelStyle = function (color) {
return {
'background-color': '#' + color,
'color': $filter('textColorFilter')(color)
};
};
}); });

View File

@@ -22,7 +22,7 @@
/* global app moment */ /* global app moment */
app.controller('CardController', function ($scope, $rootScope, $routeParams, $location, $stateParams, $interval, $timeout, BoardService, CardService, StackService, StatusService) { app.controller('CardController', function ($scope, $rootScope, $routeParams, $location, $stateParams, $interval, $timeout, $filter, BoardService, CardService, StackService, StatusService) {
$scope.sidebar = $rootScope.sidebar; $scope.sidebar = $rootScope.sidebar;
$scope.status = { $scope.status = {
lastEdit: 0, lastEdit: 0,
@@ -176,4 +176,11 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
}); });
}; };
$scope.labelStyle = function (color) {
return {
'background-color': '#' + color,
'color': $filter('textColorFilter')(color)
};
};
}); });

View File

@@ -67,7 +67,7 @@
<h4>{{ c.title }}</h4> <h4>{{ c.title }}</h4>
<ul class="labels"> <ul class="labels">
<li ng-repeat="label in c.labels" <li ng-repeat="label in c.labels"
ng-style="{'background-color':'#{{ label.color }}'}" title="{{ label.title }}"> ng-style="labelStyle(label.color)" title="{{ label.title }}">
<span>{{ label.title }}</span> <span>{{ label.title }}</span>
</li> </li>
</ul> </ul>

View File

@@ -41,11 +41,11 @@
on-select="labelAssign($item, $model)" on-select="labelAssign($item, $model)"
on-remove="labelRemove($item, $model)" ng-disabled="!boardservice.canEdit() || archived"> on-remove="labelRemove($item, $model)" ng-disabled="!boardservice.canEdit() || archived">
<ui-select-match placeholder="<?php p($l->t('Select tags')); ?>"> <ui-select-match placeholder="<?php p($l->t('Select tags')); ?>">
<span class="select-label" ng-style="{'background-color':'#{{$item.color}}','color':'{{ $item.color|textColorFilter }}'}">{{$item.title}}&nbsp;</span> <span class="select-label" ng-style="labelStyle($item.color)">{{$item.title}}&nbsp;</span>
</ui-select-match> </ui-select-match>
<ui-select-choices <ui-select-choices
repeat="label in boardservice.getCurrent().labels | filter:$select.search"> repeat="label in boardservice.getCurrent().labels | filter:$select.search">
<span class="choose-label" ng-style="{'background-color':'#{{label.color}}','color':'{{ label.color|textColorFilter }}'}">{{label.title}}</span> <span class="choose-label" ng-style="labelStyle(label.color)">{{label.title}}</span>
</ui-select-choices> </ui-select-choices>
</ui-select> </ui-select>
</div> </div>