 ## Issue status Directive (popover for change status)
 #############################################################################
 
-IssueStatusInlineEditionDirective = ($repo, $template) ->
+IssueStatusInlineEditionDirective = ($repo, $template, $rootscope) ->
     ###
     Print the status of an Issue and a popover to change it.
     - tg-issue-status-inline-edition: The issue

        $scope.$on "filters:loaded", (ctx, filters) ->
            initializeSelectedFilters(filters)

        selectQFilter = debounceLeading 100, (value) ->
            return if value is undefined


            event.preventDefault()
            event.stopPropagation()
            target = angular.element(event.currentTarget)

            for filter in $scope.filters.statuses
                if filter.id == issue.status
                    filter.count--

            issue.status = target.data("status-id")
            $el.find(".pop-status").popover().close()
            updateIssueStatus($el, issue, $scope.issueStatusById)

            $scope.$apply () ->
                $repo.save(issue).then

                for filter in $scope.filters.statuses
                    if filter.id == issue.status
                        filter.count++
                $rootscope.$broadcast("filters:issueupdate", $scope.filters)

        taiga.bindOnce $scope, "project", (project) ->
            $el.append(selectionTemplate({ 'statuses':  project.issue_statuses }))
