Skip to content

Commit

Permalink
"Fixed bug in deleting files, and made the delete process smoother"
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Munizaga committed Sep 15, 2013
1 parent 83e8b61 commit d42f2f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/models/user/UserBlob.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ define(["apiEndPoints", "models/File", "models/RSA", "models/user/FS", "tools/Mu
var folder = this.getFile(fs, loc)
, file = folder.value[filename]

userFS.removeFile(fs, loc, filename)
fs = userFS.removeFile(fs, loc, filename)

this.removeFileFromServer(file.value)

Expand Down Expand Up @@ -124,7 +124,7 @@ define(["apiEndPoints", "models/File", "models/RSA", "models/user/FS", "tools/Mu

}

, getParentFsLocation: userFS.getParentFsLocation
, getParentFsLocation: _.bind(userFS.getParentFsLocation, userFS)

// Given a fs and location, return an array of all the files inside
, getFile: userFS.getFile
Expand Down
6 changes: 6 additions & 0 deletions js/routes/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ define(
.then(hideSingleFileAndShowUpload)
})

userView.listenTo(userView.singleFileInfo, "fs:file:delete", function(fsLocation){
//if we want to show an indication that the file was deleted, we do that here
hideSingleFileAndShowUpload()
})


hideSingleFileAndShowUpload = function(){
viewport.placeRightUpOffScreen(userView.singleFileInfo.el, 1)
.placeRightOfCenter(fileView.el, 1)
Expand Down
1 change: 1 addition & 0 deletions js/views/user/SingleFileInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ define(["jade!templates/user/SingleFileInfo", "tools/humanReadableByteLength"],
, parentLocation = userBlob.getParentFsLocation(fsLocation)
this.model.removeFile(this.file.location, this.file.filename)
this.model.set('fsLocation', parentLocation)
this.trigger("fs:file:delete",fsLocation)
},

toggleShareOptions : function(){
Expand Down

0 comments on commit d42f2f6

Please sign in to comment.