diff --git a/services/web/app/views/project/list/project-list.pug b/services/web/app/views/project/list/project-list.pug index 38159bfc48..eae31a4316 100644 --- a/services/web/app/views/project/list/project-list.pug +++ b/services/web/app/views/project/list/project-list.pug @@ -161,6 +161,7 @@ ) {{tag.name}} a.label.label-default.tag-label-remove( href + ng-click="removeProjectFromTag(project, tag)" ) × .col-xs-2 diff --git a/services/web/public/coffee/main/project-list/project-list.coffee b/services/web/public/coffee/main/project-list/project-list.coffee index 81659983fb..ad9d0f3582 100644 --- a/services/web/public/coffee/main/project-list/project-list.coffee +++ b/services/web/public/coffee/main/project-list/project-list.coffee @@ -201,6 +201,23 @@ define [ # the projects from view $scope.updateVisibleProjects() + $scope.removeProjectFromTag = (project, tag) -> + tag.showWhenEmpty = true + + project.tags ||= [] + index = project.tags.indexOf tag + + if index > -1 + $scope._removeProjectIdsFromTagArray(tag, [ project.id ]) + project.tags.splice(index, 1) + queuedHttp({ + method: "DELETE" + url: "/tag/#{tag._id}/project/#{project.id}" + headers: + "X-CSRF-Token": window.csrfToken + }) + $scope.updateVisibleProjects() + $scope.addSelectedProjectsToTag = (tag) -> selected_projects = $scope.getSelectedProjects() event_tracking.send 'project-list-page-interaction', 'project action', 'addSelectedProjectsToTag'