 
 UsPointsDirective = ($repo) ->
     selectionTemplate = _.template("""
-      <ul class="popover pop-role">
-          <% _.forEach(roles, function(role) { %>
-          <li><a href="" class="role" title="<%- role.name %>" data-role-id="<%- role.id %>"><%- role.name %></a></li>
-          <% }); %>
-      </ul>
+    <ul class="popover pop-role">
+        <% _.each(roles, function(role) { %>
+        <li><a href="" class="role" title="<%- role.name %>"
+               data-role-id="<%- role.id %>"><%- role.name %></a>
+        </li>
+        <% }); %>
+    </ul>
     """)
+
     pointsTemplate = _.template("""
-      <ul class="popover pop-points-open">
-          <% _.forEach(points, function(point) { %>
-          <li><a href="" class="point" title="<%- point.name %>" data-point-id="<%- point.id %>"><%- point.name %></a></li>
-          <% }); %>
-      </ul>
+    <ul class="popover pop-points-open">
+        <% _.each(points, function(point) { %>
+        <li><a href="" class="point" title="<%- point.name %>"
+               data-point-id="<%- point.id %>"><%- point.name %></a>
+        </li>
+        <% }); %>
+    </ul>
     """)
 
     updatePointsValue = (usPoints, usTotalPoints, pointsById, pointsDomNode, selectedRoleId) ->

            pointsDomNode.text("#{selectedPointsValue}/#{usTotalPoints}")

    calculateTotalPoints = (us, pointsById) ->
        return _.reduce(_.map(us.points, (value, key) -> pointsById[value].value), (memo, num) -> memo + num)

    link = ($scope, $el, $attrs) ->
        $ctrl = $el.controller()
        us = $scope.$eval($attrs.tgUsPoints)
        usPoints = us.points
        usTotalPoints = us.total_points
        pointsDom = $el.find("a")
        selectedRoleId = null
        updatingSelectedRoleId = null
        pointsById = $scope.pointsById
        updatePointsValue(usPoints, usTotalPoints, pointsById, pointsDom, selectedRoleId)

        bindOnce $scope, "project", (project) ->

        $el.on "click", ".role", (event) ->
            event.preventDefault()
            event.stopPropagation()

            target = angular.element(event.currentTarget)
            rolScope = target.scope()
            $rootscope.$broadcast("uspoints:select", target.data("role-id"), target.text())
