             $scope.page.content = $scope.content
             $scope.page.save().then (page) ->
                 $scope.page = page
+                $scope.formOpened = false
+                $scope.content = $scope.page.content
                 saveNewAttachments()
-                $scope.formOpened = false
-
-    saveNewAttachments = ->
-        _.forEach $scope.newAttachments, (newAttach) ->
-            rs.uploadWikiPageAttachment(projectId, $scope.page.id, newAttach).then (attach) ->
-                $scope.deleteNewAttachment(newAttach)
-                $scope.attachments.push(attach)
-                $scope.$apply()
 
     $scope.deletePage = ->
         $scope.page.remove().then ->

# See the License for the specific language governing permissions and
# limitations under the License.

WikiController = ($scope, $rootScope, $location, $routeParams, $data, rs, $confirm) ->
    $rootScope.pageSection = 'wiki'
    $rootScope.projectId = parseInt($routeParams.pid, 10)
    $rootScope.pageBreadcrumb = [


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

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