Skip to content

Commit

Permalink
#1670 modify UpdatableTagList component to include tag colour
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jan 28, 2021
1 parent a87cdea commit 2b1af7c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions frontend/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<link rel="stylesheet" href="styles/custom-fields.css"/>
<link rel="stylesheet" href="styles/directives/page-sizer.css"/>
<link rel="stylesheet" href="styles/directives/user.css"/>
<link rel="stylesheet" href="styles/components/tag.css"/>
<!-- endbuild -->

<style>
Expand Down
22 changes: 16 additions & 6 deletions frontend/app/scripts/components/common/tag.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
.component('tag', {
controller: function() {
this.$onInit = function() {
this.tag = _.without([
this.value.namespace,
':',
this.value.predicate,
this.value.value ? ("=\"" + this.value.value + "\"") : null
], null).join('');
if(!this.value) {
return;
}
if(_.isString(this.value)) {
this.tag = this.value;
this.bgColor = '#3c8dbc';
} else {
this.tag = _.without([
this.value.namespace,
':',
this.value.predicate,
this.value.value ? ("=\"" + this.value.value + "\"") : null
], null).join('');
this.bgColor = this.value.colour || '#3c8dbc';
}
};
},
controllerAs: '$ctrl',
replace: true,
templateUrl: 'views/components/common/tag.component.html',
bindings: {
value: '<'
Expand Down
6 changes: 6 additions & 0 deletions frontend/app/styles/components/tag.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.label.label-tag {
border-left-width: 8px;
border-left-style: solid;
/* border-top-left-radius: 0px;
border-bottom-left-radius: 0px; */
}
2 changes: 1 addition & 1 deletion frontend/app/views/components/common/tag.component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<span class="label label-default label-lg">{{$ctrl.tag}}</span>
<span class="label label-tag label-default label-lg" style="">{{$ctrl.tag}}</span>
4 changes: 3 additions & 1 deletion frontend/app/views/directives/updatable-tag-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
ng-class="{'tags-list flexwrap': value.length > 0}">
<span class="updatable-value text-warning" ng-show="!value || value.length === 0"><em>Not Specified</em></span>

<span ng-repeat="tag in value" class="label label-primary mb-xxxs mr-xxxs">{{tag.text}}</span>
<!-- <span ng-repeat="tag in value" class="label label-primary mb-xxxs mr-xxxs">{{tag.text}}</span> -->
<!-- <span ng-repeat="tag in value" class="label label-primary mb-xxxs mr-xxxs">{{tag.text}}</span> -->
<tag class=" mb-xxxs mr-xxxs" ng-repeat="tag in value" value="tag.text"></tag>

<small class="updatable-input-icon" ng-class="{'lg': value.length > 0}">
<i class="glyphicon glyphicon-pencil"></i>
Expand Down

0 comments on commit 2b1af7c

Please sign in to comment.