Sha256: 88ce9f17b81baed42ad1ea24263c90d78b94fa37982fef815ca407ad597c8b1c

Contents?: true

Size: 1.01 KB

Versions: 33

Compression:

Stored size: 1.01 KB

Contents

class Modules.MrDropFileEvents
  constructor: (@element,@fileUpload) ->
    dragHovered = 0
    el = angular.element("<div class='hovered-cover'>Drop Files Here</div>")
    @element.bind 'dragenter', (event) =>
      dragHovered += 1
      @element.addClass('hovered') if dragHovered == 1
      @element.append el if dragHovered == 1
      height = window.getComputedStyle(@element[0]).height
      el.css('height', height)
      el.css('line-height',height)
      el.css('margin-top', '-' + height)
    @element.bind 'dragleave', (event) =>
      dragHovered -= 1
      @element.removeClass('hovered') if dragHovered == 0
      el.remove() if dragHovered == 0
    @element.bind 'dragover', (event) =>
      event.preventDefault()
      event.stopPropagation()
    @element.bind 'drop', (event) =>
      event.preventDefault()
      event.stopPropagation()
      @element.removeClass('hovered')
      el.remove()
      dragHovered = 0
      file   = (event.originalEvent || event).dataTransfer.files[0]
      @fileUpload.uploadFile(file)

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
material_raingular-0.6.16 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.15 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.14 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.13 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.12 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.11 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.10 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.9 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.8 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.7 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.6 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.5 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.4 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.3 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.2.3 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.2.2 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.2.1 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.2 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.1.1 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee
material_raingular-0.6.1 lib/assets/javascripts/material_raingular/directives/drop_file/drop_events.coffee