mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 14:34:09 +00:00
30 lines
No EOL
796 B
CoffeeScript
30 lines
No EOL
796 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.directive "changeEntry", ($timeout) ->
|
|
restrict: "E"
|
|
templateUrl: "changeEntryTemplate"
|
|
scope:
|
|
entry: "="
|
|
user: "="
|
|
permissions: "="
|
|
onAccept: "&"
|
|
onReject: "&"
|
|
onIndicatorClick: "&"
|
|
onBodyClick: "&"
|
|
link: (scope, element, attrs) ->
|
|
scope.contentLimit = 40
|
|
scope.isCollapsed = true
|
|
scope.needsCollapsing = false
|
|
|
|
element.on "click", (e) ->
|
|
if $(e.target).is('.rp-entry, .rp-entry-description, .rp-entry-body, .rp-entry-action-icon i')
|
|
scope.onBodyClick()
|
|
|
|
scope.toggleCollapse = () ->
|
|
scope.isCollapsed = !scope.isCollapsed
|
|
$timeout () ->
|
|
scope.$emit "review-panel:layout"
|
|
|
|
scope.$watch "entry.content.length", (contentLength) ->
|
|
scope.needsCollapsing = contentLength > scope.contentLimit |