Use atom.confirm when for confirmation when deleting a file in the TreeView

This commit is contained in:
Nathan Sobo 2012-08-29 20:46:08 -05:00
parent 95b1ebdd8c
commit d8ea46ee5b

View File

@ -209,15 +209,13 @@ class TreeView extends View
return unless entry
entryType = if entry instanceof DirectoryView then "directory" else "file"
message = "Are you sure you would like to delete the selected #{entryType}?"
detailedMessage = "You are deleting #{entry.getPath()}"
buttons = [
["Move to Trash", => Native.moveToTrash(entry.getPath())]
["Cancel", => ] # Do Nothing
["Delete", => fs.remove(entry.getPath())]
]
Native.alert message, detailedMessage, buttons
atom.confirm(
"Are you sure you would like to delete the selected #{entryType}?",
"You are deleting #{entry.getPath()}",
"Move to Trash", (=> Native.moveToTrash(entry.getPath())),
"Cancel", null
"Delete", (=> fs.remove(entry.getPath()))
)
add: ->
selectedPath = @selectedEntry().getPath()