mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-02 19:44:18 +00:00
Support disabling the review-panel toggle, like a standard checkbox.
This commit is contained in:
parent
fe33fa1f65
commit
f50967295d
2 changed files with 10 additions and 3 deletions
|
@ -6,16 +6,23 @@ define [
|
|||
scope:
|
||||
onToggle: '='
|
||||
ngModel: '='
|
||||
disabled: '=?'
|
||||
onDisabledClick: '=?'
|
||||
link: (scope) ->
|
||||
if !scope.disabled?
|
||||
scope.disabled = false
|
||||
scope.onChange = (args...) ->
|
||||
scope.onToggle(scope.localModel)
|
||||
scope.handleClick = () ->
|
||||
if scope.disabled
|
||||
scope.onDisabledClick()
|
||||
scope.localModel = scope.ngModel
|
||||
scope.$watch "ngModel", (value) ->
|
||||
scope.localModel = value
|
||||
|
||||
template: """
|
||||
<div class="rp-toggle">
|
||||
<input id="rp-toggle-{{$id}}" type="checkbox" class="rp-toggle-hidden-input" ng-model="localModel" ng-change="onChange()" />
|
||||
<div class="rp-toggle" ng-click="handleClick();">
|
||||
<input id="rp-toggle-{{$id}}" ng-disabled="disabled" type="checkbox" class="rp-toggle-hidden-input" ng-model="localModel" ng-change="onChange()" />
|
||||
<label for="rp-toggle-{{$id}}" class="rp-toggle-btn"></label>
|
||||
</div>
|
||||
"""
|
||||
|
|
|
@ -643,7 +643,7 @@
|
|||
.rp-toggle {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-left: 5px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.rp-toggle-hidden-input {
|
||||
display: none;
|
||||
|
|
Loading…
Reference in a new issue