2014-06-21 17:20:37 -04:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
|
|
|
App.directive "fileEntity", ["RecursionHelper", (RecursionHelper) ->
|
|
|
|
return {
|
|
|
|
restrict: "E"
|
|
|
|
scope: {
|
|
|
|
entity: "="
|
2014-07-03 10:05:35 -04:00
|
|
|
permissions: "="
|
2014-06-21 17:20:37 -04:00
|
|
|
}
|
|
|
|
templateUrl: "entityListItemTemplate"
|
|
|
|
compile: (element) ->
|
|
|
|
RecursionHelper.compile element, (scope, element, attrs, ctrl) ->
|
2014-07-03 10:05:35 -04:00
|
|
|
# Don't freak out if we're already in an apply callback
|
|
|
|
scope.$originalApply = scope.$apply
|
|
|
|
scope.$apply = (fn = () ->) ->
|
|
|
|
phase = @$root.$$phase
|
|
|
|
if (phase == '$apply' || phase == '$digest')
|
|
|
|
fn()
|
|
|
|
else
|
|
|
|
@$originalApply(fn);
|
2014-06-21 17:20:37 -04:00
|
|
|
}
|
|
|
|
]
|