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