hooch 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 168d4128131eb0aaefe037ae38a2b7a4cbf8274f73d294bb2b891e9f879425ab
4
- data.tar.gz: bdd68a50fedff639930c316bbbd7dc1fd1d024dd034416b7007fbfef6310c745
3
+ metadata.gz: 78480ee426a832313d8a0a6e84d4c2b9f6ed0ce0216720028ca15bd192846de4
4
+ data.tar.gz: 9e3cdd66fad8bd4a296b05fbb0d29490ff685664c3e7c75b5f77e0636d6e25a7
5
5
  SHA512:
6
- metadata.gz: f2b36a4cb2e43b8058f08189464e5d76ab2ff53597744438091e8b683bdbb2411b5c6c374fd87db7bf48ae7666bcf14dc73904d0b114d2eb86813c2fc8adce43
7
- data.tar.gz: 2ddd5eefa06924f24d86439e16e7fc5a9af6a20bdaa4b683abab8867d132bf4e7c76d564a88bfbe5080b1749f88c9243be56299df3f0374941ec1fae62cf3aa2
6
+ metadata.gz: cbbebdaf8ca8a714e818382d32db61a66172c5427c2c1a37086779df11cbfe955f7459ba83085bee7509ef2a787a6a71ad4f10235759346a7ffa830c41723ddb
7
+ data.tar.gz: 777045c9603eaeace7bb9c26e241cc2d9cc47954d66d25f00060f1b7061a18d96fa5367795208c3a0c1d3e14f2c1cb6ac861213c153f64a5e28963840a3d5052
@@ -234,6 +234,7 @@ var initHooch = function(){
234
234
  this.disableScroll()
235
235
  this.$modal_content.trigger('modalInitialized')
236
236
  this.$modal_mask.show()
237
+ hooch.current_modal = this
237
238
  this.$modal_content.trigger('modalVisible')
238
239
  },
239
240
  getMask: function(){
@@ -245,14 +246,12 @@ var initHooch = function(){
245
246
  this.$modal_content.show()
246
247
  },
247
248
  getDismisser: function(){
248
- if(this.dismissable){
249
- this.$dismisser = this.$modal_mask.find('#hooch-dismiss')
250
- }
249
+ this.$dismisser = this.$modal_mask.find('#hooch-dismiss')
250
+ this.dismisser = new hooch.ModalDismisser(this.$dismisser,this)
251
251
  },
252
252
  attachDismisser: function(){
253
253
  if(this.dismissable){
254
254
  this.$modal_wrapper.append(this.$dismisser)
255
- this.dismisser = new hooch.ModalDismisser(this.$dismisser,this)
256
255
  }
257
256
  },
258
257
  close: function(){
@@ -276,11 +275,33 @@ var initHooch = function(){
276
275
  hooch.dismisser.dismissModal()
277
276
  }
278
277
  },
278
+ attachModalDismisser: function(){
279
+ if(hooch.current_modal){
280
+ hooch.current_modal.dismissable = true
281
+ hooch.current_modal.attachDismisser()
282
+ }
283
+ },
279
284
  ModalNow: Class.extend({
280
285
  init: function($modal_trigger){
281
286
  this.$modal_content = $($modal_trigger.data('content-target'))
287
+ this.delay = $modal_trigger.data('delay')
282
288
  this.dismissable = $modal_trigger.data('dismissable')
283
- new hooch.Modal(this.$modal_content, this.dismissable)
289
+ var modal_now = this
290
+ if(this.delay > 0){
291
+ setTimeout(function(){new hooch.Modal(modal_now.$modal_content, modal_now.dismissable)}, delay)
292
+ } else {
293
+ new hooch.Modal(this.$modal_content, this.dismissable)
294
+ }
295
+ }
296
+ }),
297
+ ModalCloser: Class.extend({
298
+ init: function($modal_closer){
299
+ var milliseconds = $modal_closer.data('milliseconds')
300
+ if(milliseconds > 0){
301
+ setTimeout(function(){hooch.closeModal()},milliseconds)
302
+ } else {
303
+ hooch.closeModal()
304
+ }
284
305
  }
285
306
  }),
286
307
  Expandable: Class.extend({
@@ -2286,7 +2307,7 @@ var initHooch = function(){
2286
2307
  ['hover_overflow','hidey_button','hide-show','submit-proxy','click-proxy','field-filler','revealer',
2287
2308
  'checkbox-hidden-proxy','prevent-double-submit','prevent-double-link-click', 'tab-group',
2288
2309
  'hover-reveal', 'emptier', 'remover', 'checkbox-proxy', 'fake-checkbox', 'fake-select', 'select-action-changer',
2289
- 'sorter', 'sort-element', 'bind-key','modal-trigger','modal-now','history-pusher', 'history-replacer', 'link', 'atarget',
2310
+ 'sorter', 'sort-element', 'bind-key','modal-trigger','modal-now','modal-closer','history-pusher', 'history-replacer', 'link', 'atarget',
2290
2311
  'page-reloader'],'hooch');
2291
2312
  window.any_time_manager.load();
2292
2313
  };
@@ -40,13 +40,20 @@ module Hooch
40
40
  attrs
41
41
  end
42
42
 
43
- def modal_now(target, dismissable: true)
43
+ def modal_now(target, dismissable: true, delay: 0)
44
44
  attrs = 'data-modal-now=true'
45
45
  attrs += " data-content-target=#{target}"
46
+ attrs += " data-delay=#{delay}"
46
47
  attrs += " data-dismissable=true" if dismissable
47
48
  attrs
48
49
  end
49
50
 
51
+ def modal_closer(milliseconds: 0)
52
+ attrs = 'data-modal-closer=true'
53
+ attrs += " data-milliseconds=#{milliseconds}"
54
+ attrs
55
+ end
56
+
50
57
  def hide_show(target, any_click_closes: false)
51
58
  {}.tap do |params|
52
59
  params['data-hide-show'] = true
data/lib/hooch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.16.0"
2
+ VERSION = "0.16.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.16.0
4
+ version: 0.16.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: 2018-10-21 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails