diff --git a/frontend/app/index.html b/frontend/app/index.html index 3dba14c63f..d3d1b3c24b 100644 --- a/frontend/app/index.html +++ b/frontend/app/index.html @@ -266,6 +266,7 @@ + diff --git a/frontend/app/scripts/components/organisation/OrgCustomTagsListCmp.js b/frontend/app/scripts/components/organisation/OrgCustomTagsListCmp.js index 30ac39a66f..3cd8116668 100644 --- a/frontend/app/scripts/components/organisation/OrgCustomTagsListCmp.js +++ b/frontend/app/scripts/components/organisation/OrgCustomTagsListCmp.js @@ -87,6 +87,16 @@ }) } + self.updateTag = function(id, value) { + TagSrv.updateTag(id, {predicate: value}) + .then(function(/*response*/) { + NotificationSrv.success('Tag value updated successfully'); + }) + .catch(function(err) { + NotificationSrv.error('Tag list', err.data, err.status); + }) + } + // Filtering this.toggleFilters = function () { this.filtering.toggleFilters(); diff --git a/frontend/app/scripts/directives/tag-item.js b/frontend/app/scripts/directives/tag-item.js index c868207b61..0d060ec5c0 100644 --- a/frontend/app/scripts/directives/tag-item.js +++ b/frontend/app/scripts/directives/tag-item.js @@ -18,7 +18,7 @@ scope.bgColor = scope.colour || TaxonomyCacheSrv.getColour(scope.value) || TaxonomyCacheSrv.getColour('_freetags_:' + scope.value) || - '#3c8dbc'; + '#000000'; } else { scope.tag = _.without([ scope.value.namespace, @@ -26,7 +26,7 @@ scope.value.predicate, scope.value.value ? ("=\"" + scope.value.value + "\"") : null ], null).join(''); - scope.bgColor = scope.value.colour || scope.colour || '#3c8dbc'; + scope.bgColor = scope.value.colour || scope.colour || '#000000'; } scope.$watch('colour', function(value) { @@ -35,6 +35,23 @@ } scope.bgColor = value; }); + + scope.$watch('value', function(value) { + if(!value) { + return; + } + + if(_.isString(value)) { + scope.tag = value; + } else { + scope.tag = _.without([ + value.namespace, + ':', + value.predicate, + value.value ? ("=\"" + value.value + "\"") : null + ], null).join(''); + } + }); } }; }); diff --git a/frontend/app/scripts/directives/updatableTag.js b/frontend/app/scripts/directives/updatableTag.js new file mode 100644 index 0000000000..419462dd92 --- /dev/null +++ b/frontend/app/scripts/directives/updatableTag.js @@ -0,0 +1,16 @@ +(function() { + 'use strict'; + angular.module('theHiveDirectives') + .directive('updatableTag', function(UtilsSrv) { + return { + 'restrict': 'E', + 'link': UtilsSrv.updatableLink, + 'templateUrl': 'views/directives/updatable-tag.html', + 'scope': { + 'value': '=?', + 'colour': '', + 'onUpdate': '&' + } + }; + }); +})(); diff --git a/frontend/app/views/components/org/custom-tags/tag-list.html b/frontend/app/views/components/org/custom-tags/tag-list.html index d7f12704e7..dbcfe72974 100644 --- a/frontend/app/views/components/org/custom-tags/tag-list.html +++ b/frontend/app/views/components/org/custom-tags/tag-list.html @@ -26,7 +26,7 @@
@@ -43,6 +43,7 @@
- |
|
|
---|