mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 11:34:15 -05:00
18 lines
No EOL
508 B
CoffeeScript
18 lines
No EOL
508 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.directive "reviewPanelCollapseHeight", ($parse) ->
|
|
return {
|
|
restrict: "A",
|
|
link: (scope, element, attrs) ->
|
|
scope.$watch (() -> $parse(attrs.reviewPanelCollapseHeight)(scope)), (shouldCollapse) ->
|
|
neededHeight = element.prop("scrollHeight")
|
|
if neededHeight > 0
|
|
if shouldCollapse
|
|
element.animate { height: 0 }, 150
|
|
else
|
|
element.animate { height: neededHeight }, 150
|
|
else
|
|
if shouldCollapse
|
|
element.height 0
|
|
} |