Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
refactor(macUpload): Updated directive to be more Angular
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlee44 committed Sep 13, 2013
1 parent 7571bdc commit fd9a927
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/directives/file_upload.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ directive("macUpload", ["$rootScope", "$parse", "$timeout", "util", ($rootScope,
applyCallback "progress", $event, $data

if opts.dropZone?
$(document).on "drop dragover", (event) -> event.preventDefault()
angular.element(document).bind "drop dragover", (event) -> event.preventDefault()

# Add and remove droppable class
dragoverTimeout = null
dropZone = element.parents opts.dropZone

$(document).bind "dragover", (event) ->
angular.element(document).bind "dragover", (event) ->
$timeout.cancel dragoverTimeout if dragoverTimeout?

node = $(event.target).parents opts.dropZone
node = angular.element(event.target).parents opts.dropZone
method = if node.length then "addClass" else "removeClass"
dropZone[method] "droppable"

Expand All @@ -96,7 +96,7 @@ directive("macUpload", ["$rootScope", "$parse", "$timeout", "util", ($rootScope,
dropZone.removeClass "droppable"
, 250, false

options.dropZone = dropZone or $()
options.dropZone = dropZone or angular.element()
options.pasteZone = null

if opts.options
Expand Down

0 comments on commit fd9a927

Please sign in to comment.