simple_form_fileinput 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3ecb1963ec1856c09aac1d36963f27654eeab5b
4
- data.tar.gz: 5b152a87c0fa0ec6775446a4867e8c5e2cb9e3f3
3
+ metadata.gz: c10a766801b75e03fa91317d3f128c43a79d6c4c
4
+ data.tar.gz: b6cdcc296ba7bdbda64218f819635ea56f726bb3
5
5
  SHA512:
6
- metadata.gz: 9fc95738fa40fcdd5686516a16497c52d181b3bddd43badec5b6f3502c6fe4ff81c87a90584f91d85701776f8609d6ace4f6c2cc53e856744aff3e09ea8bca06
7
- data.tar.gz: 28b651196be3a0931f5223dd84e211e60fe04404539e94aa23adfe75dc017dedaf0c8c9f71b8381cea4e9f9ef93d094623c634f9796ceaf0788e0cf30602f5d8
6
+ metadata.gz: d5288a9be02ac3b0c9eb5f8a8c3b25604f4f718900837b07e93f2e89aa3336cd2a49b9251e3d355e1298f64b1d8f37009eb4edb0449836ef3672bb5c82c6b657
7
+ data.tar.gz: 4594d3e631a45f255ca39c20b8e09e35472d8a83e88747fd872846ad52f2031ed3b77b5e2d6b2973e4280363b3586f96cb96a6a558c8495e5800dfae72e632dc
@@ -1,3 +1,3 @@
1
1
  module SimpleFormFileinput
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,18 +1,29 @@
1
1
  $ ->
2
2
  # The plugin code
3
- $.fn.draghover = (options)->
3
+ $.fn.draghover = (options={})->
4
+ defaults =
5
+ fireDragLeaveOnChild: true
6
+ settings = $.extend true, defaults, options
4
7
  @each ->
5
8
  collection = $()
6
9
  self = $(@)
7
- self.on "dragenter", (e)->
8
- self.trigger "draghoverstart" if collection.length is 0
10
+ self.on 'dragenter', (e)->
11
+ self.trigger 'draghoverstart' if collection.length is 0
9
12
  collection = collection.add(e.target)
10
- self.on "dragleave drop", (e)->
13
+ self.on 'dragleave', (e)->
14
+ console.log e
15
+ console.log "#{e.originalEvent.pageX}, #{e.originalEvent.pageY}"
16
+ if !settings.fireDragLeaveOnChild && e.originalEvent.pageX != 0
17
+ e.preventDefault()
18
+ return false
19
+ collection = collection.not(e.target)
20
+ self.trigger "draghoverend" if collection.length is 0
21
+ self.on 'drop', (e)->
11
22
  collection = collection.not(e.target)
12
23
  self.trigger "draghoverend" if collection.length is 0
13
24
 
14
25
  $(document).ready ->
15
- $(window).draghover().on
26
+ $(window).draghover({fireDragLeaveOnChild: false}).on
16
27
  draghoverstart: ->
17
28
  $('.file-input-wrapper').addClass('file-in-window')
18
29
  draghoverend: ->
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_fileinput
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - smit1625
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-23 00:00:00.000000000 Z
11
+ date: 2014-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler