-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1670 Update tag fields and display to include colour
- Loading branch information
Showing
18 changed files
with
130 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(function() { | ||
'use strict'; | ||
angular.module('theHiveDirectives').directive('tagColour', function($timeout, TaxonomyCacheSrv) { | ||
return { | ||
restrict: 'A', | ||
scope: { | ||
tag: '=' | ||
}, | ||
link: function(scope, element/*, attrs*/) { | ||
if(!scope.tag) { | ||
return; | ||
} | ||
|
||
scope.bgColour = TaxonomyCacheSrv.getColour(scope.tag) || '#3c8dbc'; | ||
|
||
$timeout(function() { | ||
angular.element(element[0]).attr('style', 'background-color:' + scope.bgColour); | ||
}); | ||
} | ||
}; | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(function() { | ||
'use strict'; | ||
angular.module('theHiveDirectives').directive('tagItem', function(TaxonomyCacheSrv) { | ||
return { | ||
restrict: 'E', | ||
replace: true, | ||
scope: { | ||
value: '=' | ||
}, | ||
templateUrl: 'views/directives/tag-item.html', | ||
link: function(scope/*, element, attrs*/) { | ||
if(!scope.value) { | ||
return; | ||
} | ||
if(_.isString(scope.value)) { | ||
scope.tag = scope.value; | ||
scope.bgColor = TaxonomyCacheSrv.getColour(scope.value) || '#3c8dbc'; | ||
} else { | ||
scope.tag = _.without([ | ||
scope.value.namespace, | ||
':', | ||
scope.value.predicate, | ||
scope.value.value ? ("=\"" + scope.value.value + "\"") : null | ||
], null).join(''); | ||
scope.bgColor = scope.value.colour || '#3c8dbc'; | ||
} | ||
} | ||
}; | ||
}); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<span class="label label-tag label-default label-lg" style="">{{$ctrl.tag}}</span> | ||
<span class="label label-tag label-default label-lg" style="border-left-color:{{$ctrl.bgColor}};">{{$ctrl.tag}}</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span class="tag-item-border" tag-colour tag="$getDisplayText()"> </span> | ||
<span ng-bind="$getDisplayText()"></span> | ||
<a class="remove-button" ng-click="$removeTag()" ng-bind="::$$removeTagSymbol"></a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span class="label label-default label-tag mb-xxxs mr-xxxs" | ||
style="border-left-color:{{bgColor}};">{{tag}} | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div class="tags-list flexwrap"> | ||
<span ng-repeat="tag in data track by $index" class="label label-primary mb-xxxs mr-xxxs">{{tag}}</span> | ||
<tag-item ng-repeat="tag in data track by $index" value="tag"></tag-item> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters