Fixing initial color in color selector
parent
14e53ec76b
commit
8b5830a33f
|
@ -24,12 +24,11 @@ getDefaulColorList = taiga.getDefaulColorList
|
||||||
class ColorSelectorController
|
class ColorSelectorController
|
||||||
constructor: () ->
|
constructor: () ->
|
||||||
@.colorList = getDefaulColorList()
|
@.colorList = getDefaulColorList()
|
||||||
|
|
||||||
if @.initColor
|
|
||||||
@.color = @.initColor
|
|
||||||
|
|
||||||
@.displayColorList = false
|
@.displayColorList = false
|
||||||
|
|
||||||
|
setColor: (color) ->
|
||||||
|
@.color = @.initColor
|
||||||
|
|
||||||
resetColor: () ->
|
resetColor: () ->
|
||||||
if @.isRequired and not @.color
|
if @.isRequired and not @.color
|
||||||
@.color = @.initColor
|
@.color = @.initColor
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
# File: color-selector.directive.coffee
|
# File: color-selector.directive.coffee
|
||||||
###
|
###
|
||||||
|
|
||||||
|
bindOnce = @.taiga.bindOnce
|
||||||
|
|
||||||
ColorSelectorDirective = ($timeout) ->
|
ColorSelectorDirective = ($timeout) ->
|
||||||
link = (scope, el, attrs, ctrl) ->
|
link = (scope, el, attrs, ctrl) ->
|
||||||
# Animation
|
# Animation
|
||||||
|
@ -42,6 +44,9 @@ ColorSelectorDirective = ($timeout) ->
|
||||||
.mouseenter(cancel)
|
.mouseenter(cancel)
|
||||||
.mouseleave(close)
|
.mouseleave(close)
|
||||||
|
|
||||||
|
bindOnce scope, 'vm.initColor', (color) ->
|
||||||
|
ctrl.setColor(color)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
link: link,
|
link: link,
|
||||||
templateUrl:"components/color-selector/color-selector.html",
|
templateUrl:"components/color-selector/color-selector.html",
|
||||||
|
|
Loading…
Reference in New Issue