2017-05-31 09:47:25 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.directive "aggregateChangeEntry", ($timeout) ->
|
|
|
|
restrict: "E"
|
|
|
|
templateUrl: "aggregateChangeEntryTemplate"
|
|
|
|
scope:
|
|
|
|
entry: "="
|
|
|
|
user: "="
|
|
|
|
permissions: "="
|
|
|
|
onAccept: "&"
|
|
|
|
onReject: "&"
|
|
|
|
onIndicatorClick: "&"
|
|
|
|
onBodyClick: "&"
|
|
|
|
link: (scope, element, attrs) ->
|
2017-05-31 11:23:24 -04:00
|
|
|
scope.contentLimit = 35
|
2017-05-31 09:47:25 -04:00
|
|
|
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"
|
|
|
|
|
2017-05-31 11:23:24 -04:00
|
|
|
scope.$watch "entry.content.length + entry.metadata.agg_op.content.length", (contentLength) ->
|
|
|
|
scope.needsCollapsing = contentLength > scope.contentLimit
|