     # Requirements:
     #   - Task object (ng-model)
     #   - scope.statusById object
+    #   - $scope.project.my_permissions
 
     template = _.template("""
-    <div class="status-data clickable">
+    <div class="status-data <% if(editable){ %>clickable<% }%>">
         <span class="level" style="background-color:<%= status.color %>"></span>
         <span class="status-status"><%= status.name %></span>
-        <span class="icon icon-arrow-bottom"></span>
+        <% if(editable){ %><span class="icon icon-arrow-bottom"></span><% }%>
         <span class="level-name">status</span>
 
         <ul class="popover pop-status">

    """) #TODO: i18n

    link = ($scope, $el, $attrs, $model) ->
        render = (task) =>
            status = $scope.statusById[task.status]

            html = template({
                status: status
                statuses: $scope.statusList
            })
            $el.html(html)

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

            $el.find(".pop-status").popover().open()

        $el.on "click", ".status", (event) ->
            event.preventDefault()
            event.stopPropagation()
            target = angular.element(event.currentTarget)

            $.fn.popover().closeAll()

            task = $model.$modelValue.clone()
            task.status = target.data("status-id")

            $model.$setViewValue(task)
            $repo.save($model.$modelValue).then ->
                $rootScope.$broadcast("history:reload")

        $scope.$watch $attrs.ngModel, (task) ->
            render(task) if task

## Task status button directive
#############################################################################

TaskStatusButtonDirective = ($rootScope, $repo, $confirm) ->
    # Display the status of Task and you can edit it.
    #
    # Example:
