Fix tgTagLineCommon directive if colors are disabled
parent
4f51bd953f
commit
17bbdfa1ba
|
@ -28,6 +28,7 @@ class TagLineCommonController
|
|||
]
|
||||
|
||||
constructor: (@tagLineService) ->
|
||||
@.disableColorSelection = false
|
||||
@.newTag = {name: "", color: null}
|
||||
@.colorArray = []
|
||||
@.addTag = false
|
||||
|
@ -45,10 +46,14 @@ class TagLineCommonController
|
|||
@.newTag.name = ""
|
||||
@.newTag.color = null
|
||||
|
||||
return if not name.length
|
||||
|
||||
if @.disableColorSelection
|
||||
@.onAddTag({name: name, color: color}) if name.length
|
||||
else
|
||||
if @.project.tags_colors[name]
|
||||
color = @.project.tags_colors[name]
|
||||
|
||||
@.onAddTag({name: name, color: color}) if name.length
|
||||
@.onAddTag({name: name, color: color})
|
||||
|
||||
selectColor: (color) ->
|
||||
@.newTag.color = color
|
||||
|
|
|
@ -28,6 +28,8 @@ TagLineCommonDirective = () ->
|
|||
return if !project || !Object.keys(project).length
|
||||
|
||||
unwatch()
|
||||
|
||||
if not ctrl.disableColorSelection
|
||||
ctrl.colorArray = ctrl._createColorsArray(ctrl.project.tags_colors)
|
||||
|
||||
el.on "keydown", ".tag-input", (event) ->
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.tags-container
|
||||
.tag(
|
||||
ng-if="tag[1]"
|
||||
ng-if="tag[1] && !vm.disableColorSelection"
|
||||
ng-repeat="tag in vm.tags"
|
||||
ng-style="{'border-left': '.3rem solid' + tag[1]}"
|
||||
)
|
||||
|
@ -12,7 +12,7 @@
|
|||
has-permissions="{{vm.checkPermissions()}}"
|
||||
)
|
||||
.tag(
|
||||
ng-if="!tag[1]"
|
||||
ng-if="!tag[1] || vm.disableColorSelection"
|
||||
ng-repeat="tag in vm.tags"
|
||||
)
|
||||
tg-tag(
|
||||
|
|
|
@ -75,11 +75,10 @@ div.wrapper(
|
|||
|
||||
tg-tag-line-common.tags-block(
|
||||
disable-color-selection
|
||||
ng-if="project"
|
||||
project="project"
|
||||
tags="projectTags"
|
||||
permissions="modify_project"
|
||||
on-add-tag="ctrl.addTag(name, color)"
|
||||
on-add-tag="ctrl.addTag(name)"
|
||||
on-delete-tag="ctrl.deleteTag(tag)"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue