nifty-dialog 1.0.7 → 1.1.0

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
  SHA1:
3
- metadata.gz: 8b17c5e6343a7f028a5e4a119869c582c9e80ffe
4
- data.tar.gz: 121b62a9505fffb0b83bac28b151716289c2ed64
3
+ metadata.gz: 94f066df26a586231cbedd7d4986e6ea9d0b6178
4
+ data.tar.gz: 4d6857df30c08175a381e96dc5efcfc80b429663
5
5
  SHA512:
6
- metadata.gz: 9d1d108df5b7ee2b92351f8745e2217b3f070fb9addbf33b8260ec0dd14ce5a15634740dc5b3faab4a8f768731a9414226949c13829b81378911fc11790f8831
7
- data.tar.gz: dcaae9b4c1ffaceced401219c899fb78af4d84d328e8b6c72425ecc6f6fd3f66e98d609fc8c0a0aed3b5467a6af0f6e2d2976d848968579faa42fdb2765e68c0
6
+ metadata.gz: a127632d0ab5a6293c6f84839eae771bb3b49bf3f32cdad3f6865f18f28a23ae5548ab2b839868d17378811f5bf5ae126158dccb6362055d62a7562eb90f1b3d
7
+ data.tar.gz: 7fc98d090a9bb77c28a5864ec6aef18f193753dbe0075aea41cc2c6fc0ae5f9ff5a52665fcd0f190ac9c25378123974515df25c89f0aa2c895e2248cf925ad90
@@ -1,5 +1,5 @@
1
1
  module Nifty
2
2
  module Dialog
3
- VERSION = '1.0.7'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
@@ -42,20 +42,24 @@ window.Nifty.Dialog =
42
42
 
43
43
  options.id = dialogID unless options.id?
44
44
 
45
+ # Add the overlay
46
+ overlayClass = ''
47
+ overlayClass = 'invisible' if dialogID > 1
48
+ theOverlay = $("<div class='niftyOverlay #{overlayClass}'></div>").appendTo($('body')).css('z-index', 2000 + dialogID - 1)
49
+
45
50
  # create a template and assign the ID
46
51
  dialogTemplate = $("<div class='niftyDialog #{options.class || ''}' id='niftyDialog-#{options.id}'></div>")
47
52
  dialogTemplate.data('dialogID', dialogID)
48
53
 
49
54
  # insert the dialog into the page
50
- insertedDialog = dialogTemplate.appendTo($('body'))
55
+ insertedDialog = dialogTemplate.appendTo(theOverlay)
51
56
  insertedDialog.css('z-index', 2000 + dialogID)
52
57
 
53
58
  # set the content on the dialog
54
59
  insertedDialog.data('options', options)
55
60
 
56
- overlayClass = ''
57
- overlayClass = 'invisible' if dialogID > 1
58
- theOverlay = $("<div class='niftyOverlay #{overlayClass}'></div>").insertBefore(insertedDialog).css('z-index', 2000 + dialogID - 1)
61
+ # fade the overlay
62
+ $('body').addClass('niftyDialog-open')
59
63
  theOverlay.fadeIn('fast')
60
64
 
61
65
  # if we have a width, set the width for the dialog
@@ -81,10 +85,16 @@ window.Nifty.Dialog =
81
85
  if options.behavior? && behavior = this.behaviors[options.behavior]
82
86
  behavior.onClose.call(null, insertedDialog, options) if behavior.onClose?
83
87
  insertedDialog.fadeOut 'fast', -> insertedDialog.remove()
84
- theOverlay.fadeOut 'fast', -> theOverlay.remove()
88
+ theOverlay.fadeOut 'fast', ->
89
+ theOverlay.remove()
90
+ if $('.niftyOverlay').length == 0
91
+ $('body').removeClass('niftyDialog-open')
92
+
85
93
 
86
94
  # Set that clicking on the dialog's overlay will close the dialog
87
- theOverlay.on 'click', -> insertedDialog.data('closeAction').call()
95
+ theOverlay.on 'click', (e)->
96
+ if $(e.target).is('.niftyOverlay')
97
+ insertedDialog.data('closeAction').call()
88
98
 
89
99
  # load in the content
90
100
  if options.url?
@@ -6,10 +6,12 @@ div.niftyOverlay {
6
6
  background:rgba(0,0,0,0.5);
7
7
  top:0;
8
8
  left:0;
9
- width:100%;
10
- height:4000px;
9
+ right:0;
10
+ bottom:0;
11
11
  display:none;
12
12
  z-index:50;
13
+ overflow-y: scroll;
14
+
13
15
  }
14
16
 
15
17
  //
@@ -19,17 +21,19 @@ div.niftyOverlay.invisible {
19
21
  background:transparent;
20
22
  }
21
23
 
24
+ body.niftyDialog-open {
25
+ overflow-y: hidden;
26
+ }
27
+
22
28
  //
23
29
  // Dialog
24
30
  //
25
31
  div.niftyDialog {
26
32
  display:none;
27
- position:fixed;
28
- top:50%;
29
- top:100px;
30
- left:50%;
31
- margin-left:-250px;
33
+ position:relative;
32
34
  width:500px;
35
+ margin:100px auto;
36
+ margin-bottom: 100px !important;
33
37
  background:#fff;
34
38
  box-shadow:0 0 70px rgb(0,0,0);
35
39
  h2 {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nifty-dialog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-30 00:00:00.000000000 Z
11
+ date: 2014-12-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A javascript library for working with dialogs
14
14
  email: