Actually remove project from tag, inline.

This commit is contained in:
Paulo Reis 2017-05-01 16:00:25 +01:00
parent 2708fdf159
commit 208f021bd0
2 changed files with 18 additions and 0 deletions

View file

@ -161,6 +161,7 @@
) {{tag.name}} ) {{tag.name}}
a.label.label-default.tag-label-remove( a.label.label-default.tag-label-remove(
href href
ng-click="removeProjectFromTag(project, tag)"
) × ) ×
.col-xs-2 .col-xs-2

View file

@ -201,6 +201,23 @@ define [
# the projects from view # the projects from view
$scope.updateVisibleProjects() $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) -> $scope.addSelectedProjectsToTag = (tag) ->
selected_projects = $scope.getSelectedProjects() selected_projects = $scope.getSelectedProjects()
event_tracking.send 'project-list-page-interaction', 'project action', 'addSelectedProjectsToTag' event_tracking.send 'project-list-page-interaction', 'project action', 'addSelectedProjectsToTag'