Commit 43346c0a authored by Ujvari Gergely's avatar Ujvari Gergely

Introducing fuzzytime directive to get rid of tons of needless recalculation.

Instead of calling the fuzzyTime filter for the $viewValue.updated in the annotation.html we're now calling this filter in the directive ctrl.$render.
This way it only recalculates the fuzzyTime filter once / annotation / clicking to the bucket.
parent 6f96210b
......@@ -356,9 +356,22 @@ username = ['$filter', '$window', ($filter, $window) ->
template: '<span class="user" ng-click="uclick($event)">{{uname}}</span>'
]
fuzzytime = ['$filter', '$window', ($filter, $window) ->
link: (scope, elem, attr, ctrl) ->
return unless ctrl?
ctrl.$render = ->
scope.ftime = ($filter 'fuzzyTime') ctrl.$viewValue
require: '?ngModel'
restrict: 'E'
template: '<span class="small">{{ftime}}</span>'
]
angular.module('h.directives', ['ngSanitize'])
.directive('authentication', authentication)
.directive('fuzzytime', fuzzytime)
.directive('markdown', markdown)
.directive('privacy', privacy)
.directive('recursive', recursive)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment