Fixing color selection
parent
ef364a43ac
commit
1608c42678
|
@ -252,6 +252,9 @@ ColorSelectionDirective = () ->
|
||||||
link = ($scope, $el, $attrs, $model) ->
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
$ctrl = $el.controller()
|
$ctrl = $el.controller()
|
||||||
|
|
||||||
|
$scope.$watch $attrs.ngModel, (element) ->
|
||||||
|
$scope.color = element.color
|
||||||
|
|
||||||
$el.on "click", ".current-color", (event) ->
|
$el.on "click", ".current-color", (event) ->
|
||||||
# Showing the color selector
|
# Showing the color selector
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -276,6 +279,8 @@ ColorSelectionDirective = () ->
|
||||||
|
|
||||||
$el.on "click", ".select-color .selected-color", (event) ->
|
$el.on "click", ".select-color .selected-color", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
$scope.$apply ->
|
||||||
|
$model.$modelValue.color = $scope.color
|
||||||
$el.find(".select-color").hide()
|
$el.find(".select-color").hide()
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
|
|
|
@ -22,5 +22,5 @@ div.popover.select-color
|
||||||
li.color(style="background: #a40000", data-color="#a40000")
|
li.color(style="background: #a40000", data-color="#a40000")
|
||||||
li.color(style="background: #2e3436", data-color="#2e3436")
|
li.color(style="background: #2e3436", data-color="#2e3436")
|
||||||
|
|
||||||
input(type="text", placeholder="personalized colors", ng-model="status.color")
|
input(type="text", placeholder="personalized colors", ng-model="color")
|
||||||
div.selected-color(style="background-color: {{ status.color }}")
|
div.selected-color(style="background-color: {{ color }}")
|
||||||
|
|
Loading…
Reference in New Issue