 
 
 module = angular.module("greenmine.controllers.wiki", [])
-module.controller("WikiController", ['$scope', '$rootScope', '$location', '$routeParams', '$data', 'resource', "$confirm", WikiController])
+module.controller("WikiController", ['$scope', '$rootScope', '$location', '$routeParams',
+                                     '$data', 'resource', "$confirm", "$q", WikiController])


    promise.then null, (data) ->
        $scope.formOpened = true

    loadAttachments = (page) ->
        rs.getWikiPageAttachments(projectId, page.id).then (attachments) ->
            $scope.attachments = attachments
        $scope.newAttachments = []

    $scope.openEditForm = ->
        $scope.formOpened = true

            $scope.page.content = $scope.content
            $scope.page.save().then (page) ->
                $scope.page = page
                $scope.formOpened = false
                $scope.content = $scope.page.content
                saveNewAttachments()

    $scope.deletePage = ->
        $scope.page.remove().then ->
