2016-11-23 09:34:21 -05:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.directive "reviewPanelToggle", () ->
|
|
|
|
restrict: "E"
|
|
|
|
scope:
|
2017-01-10 10:11:12 -05:00
|
|
|
onToggle: '='
|
|
|
|
ngModel: '='
|
|
|
|
link: (scope) ->
|
|
|
|
scope.onChange = (args...) ->
|
|
|
|
scope.onToggle(scope.localModel)
|
|
|
|
scope.localModel = scope.ngModel
|
|
|
|
scope.$watch "ngModel", (value) ->
|
|
|
|
scope.localModel = value
|
|
|
|
|
2016-11-23 09:34:21 -05:00
|
|
|
template: """
|
|
|
|
<div class="rp-toggle">
|
2017-01-10 10:11:12 -05:00
|
|
|
<input id="rp-toggle-{{$id}}" type="checkbox" class="rp-toggle-hidden-input" ng-model="localModel" ng-change="onChange()" />
|
2016-11-23 09:34:21 -05:00
|
|
|
<label for="rp-toggle-{{$id}}" class="rp-toggle-btn"></label>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
|