hooch 0.13.0 → 0.13.1

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: 37724309fcde2fc0d12013d55d370e9c956a0428
4
- data.tar.gz: 03b50dd276b60bb4d6f3726412f7405d03174bf9
3
+ metadata.gz: f76e60f68ad16df45e9c59fece26a363dc1f01be
4
+ data.tar.gz: c4078fc5c1990d32b6eb4f249a684a8069df80cd
5
5
  SHA512:
6
- metadata.gz: 15dd6af2ee95aa3233dcde52ef0860cc68c23f70346820dc13bc80c97f6e7f2a432a46c45635222917b707c010cffbcc378ff51884981492bf0dcab0e3c19257
7
- data.tar.gz: 1d06de7c07c7e93833e6774f083aaba19efe8178ae6ac580afbebcf475336db685aa46b240f6e95c09377c5f3483372fec67503a1d0691738fe19ba5753746f9
6
+ metadata.gz: f27c044997f7b4ca1c4cf58c9ff699e52545fbc6a05370cf87d22b31ce651538d866b8d2af9fedf793c3c01b88b4974c404812cd55f21217c8702e9fccbd75bb
7
+ data.tar.gz: 980199ded9a0bc8e204de78c78b8129e5d5d12573e56fed8df05e9cbbfb530cf74f225267c8039a7a446e3866993a3f168e3fe64b536b754798e607cf204bdb5
@@ -22,8 +22,17 @@ var initHooch = function(){
22
22
  init: function($trigger){
23
23
  this.$target = $($trigger.data('target'))
24
24
  var trigger = this
25
- $trigger.on('click', function(){
25
+ if($trigger.data('any-click-closes')){
26
+ $(window).on('click',function(){
27
+ if(trigger.$target.is(':visible')){
28
+ trigger.$target.hide()
29
+ }
30
+ })
31
+ }
32
+ $trigger.on('click', function(e){
26
33
  trigger.$target.toggle()
34
+ e.preventDefault()
35
+ return false
27
36
  })
28
37
  }
29
38
  }),
@@ -29,15 +29,17 @@ module Hooch
29
29
  attrs += " data-content-target=\"#{target}\""
30
30
  end
31
31
 
32
- def hide_show(target)
32
+ def hide_show(target, any_click_closes: false)
33
33
  {}.tap do |params|
34
34
  params['data-hide-show'] = true
35
35
  params['data-target'] = target
36
+ params['data-any-click-closes'] = true if any_click_closes
36
37
  end
37
38
  end
38
39
 
39
- def hide_show_attrs(target)
40
+ def hide_show_attrs(target, any_click_closes: false)
40
41
  attrs = "data-hide-show=true data-target=" + target
42
+ attrs += " data-any-click-closes=true" if any_click_closes
41
43
  attrs
42
44
  end
43
45
 
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.13.0"
2
+ VERSION = "0.13.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hooch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-27 00:00:00.000000000 Z
11
+ date: 2016-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails