From cd2c8e71995ccc63e458ea53af1def8321c6122a Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 17 Feb 2017 11:54:33 +0000 Subject: [PATCH] Add directive based on jQuery animation API. --- .../directives/reviewPanelCollapseHeight.coffee | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 services/web/public/coffee/ide/review-panel/directives/reviewPanelCollapseHeight.coffee diff --git a/services/web/public/coffee/ide/review-panel/directives/reviewPanelCollapseHeight.coffee b/services/web/public/coffee/ide/review-panel/directives/reviewPanelCollapseHeight.coffee new file mode 100644 index 0000000000..859e04aac7 --- /dev/null +++ b/services/web/public/coffee/ide/review-panel/directives/reviewPanelCollapseHeight.coffee @@ -0,0 +1,15 @@ +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 + } \ No newline at end of file