2017-01-06 06:59:49 -05:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.directive "resolvedCommentEntry", () ->
|
|
|
|
restrict: "E"
|
|
|
|
templateUrl: "resolvedCommentEntryTemplate"
|
2017-01-10 05:33:54 -05:00
|
|
|
scope:
|
2017-01-06 06:59:49 -05:00
|
|
|
thread: "="
|
2017-01-12 05:52:39 -05:00
|
|
|
permissions: "="
|
2017-01-10 05:33:54 -05:00
|
|
|
onUnresolve: "&"
|
2017-01-13 10:37:24 -05:00
|
|
|
onDelete: "&"
|
|
|
|
link: (scope, element, attrs) ->
|
|
|
|
scope.contentLimit = 40
|
2017-01-18 05:53:59 -05:00
|
|
|
scope.needsCollapsing = false
|
2017-01-13 10:37:24 -05:00
|
|
|
scope.isCollapsed = true
|
|
|
|
|
|
|
|
scope.toggleCollapse = () ->
|
|
|
|
scope.isCollapsed = !scope.isCollapsed
|
2017-01-18 05:53:59 -05:00
|
|
|
|
|
|
|
scope.$watch "thread.content.length", (contentLength) ->
|
|
|
|
scope.needsCollapsing = contentLength > scope.contentLimit
|