nifty-dialog 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8b17c5e6343a7f028a5e4a119869c582c9e80ffe
4
+ data.tar.gz: 121b62a9505fffb0b83bac28b151716289c2ed64
5
+ SHA512:
6
+ metadata.gz: 9d1d108df5b7ee2b92351f8745e2217b3f070fb9addbf33b8260ec0dd14ce5a15634740dc5b3faab4a8f768731a9414226949c13829b81378911fc11790f8831
7
+ data.tar.gz: dcaae9b4c1ffaceced401219c899fb78af4d84d328e8b6c72425ecc6f6fd3f66e98d609fc8c0a0aed3b5467a6af0f6e2d2976d848968579faa42fdb2765e68c0
@@ -1,5 +1,5 @@
1
1
  module Nifty
2
2
  module Dialog
3
- VERSION = '1.0.6'
3
+ VERSION = '1.0.7'
4
4
  end
5
5
  end
@@ -1,15 +1,15 @@
1
1
  window.Nifty ||= {}
2
2
  window.Nifty.Dialog =
3
-
3
+
4
4
  # The numerical ID to start showing dialogs from
5
5
  startingID: 1
6
-
6
+
7
7
  # A callback reference which is run on content set if set.
8
8
  onSetContent: null
9
-
9
+
10
10
  # Stores all behaviors
11
11
  behaviors: {}
12
-
12
+
13
13
  # Open a new dialog which will accept a number of possible options.
14
14
  #
15
15
  # id => the ID to assign to this dialog (prefixed with 'niftyDialog-' )
@@ -39,30 +39,30 @@ window.Nifty.Dialog =
39
39
  # set a dialog ID for this dialog
40
40
  dialogsOpen = $('div.niftyDialog').length
41
41
  dialogID = if dialogsOpen == 0 then this.startingID else (dialogsOpen * 10) + this.startingID
42
-
42
+
43
43
  options.id = dialogID unless options.id?
44
44
 
45
45
  # create a template and assign the ID
46
- dialogTemplate = $("<div class='niftyDialog #{options.class}' id='niftyDialog-#{options.id}'></div>")
46
+ dialogTemplate = $("<div class='niftyDialog #{options.class || ''}' id='niftyDialog-#{options.id}'></div>")
47
47
  dialogTemplate.data('dialogID', dialogID)
48
-
48
+
49
49
  # insert the dialog into the page
50
50
  insertedDialog = dialogTemplate.appendTo($('body'))
51
51
  insertedDialog.css('z-index', 2000 + dialogID)
52
-
52
+
53
53
  # set the content on the dialog
54
54
  insertedDialog.data('options', options)
55
-
55
+
56
56
  overlayClass = ''
57
57
  overlayClass = 'invisible' if dialogID > 1
58
58
  theOverlay = $("<div class='niftyOverlay #{overlayClass}'></div>").insertBefore(insertedDialog).css('z-index', 2000 + dialogID - 1)
59
59
  theOverlay.fadeIn('fast')
60
-
60
+
61
61
  # if we have a width, set the width for the dialog
62
62
  if options.width?
63
63
  insertedDialog.css('width', "#{options.width}px")
64
64
  insertedDialog.css('margin-left', "-#{options.width / 2}px")
65
-
65
+
66
66
  if options.offset?
67
67
  insertedDialog.css('margin-top', "#{options.offset}px")
68
68
 
@@ -72,9 +72,9 @@ window.Nifty.Dialog =
72
72
  insertedDialog.css
73
73
  'margin-left': "#{x}px"
74
74
  'margin-top': "#{y}px"
75
-
76
75
 
77
- # Set the closing action for the inserted dialog to close dialog
76
+
77
+ # Set the closing action for the inserted dialog to close dialog
78
78
  # and fade out the appropriate overlay
79
79
  insertedDialog.data 'closeAction', =>
80
80
  options.onClose.call(null, insertedDialog, options) if options.onClose?
@@ -85,7 +85,7 @@ window.Nifty.Dialog =
85
85
 
86
86
  # Set that clicking on the dialog's overlay will close the dialog
87
87
  theOverlay.on 'click', -> insertedDialog.data('closeAction').call()
88
-
88
+
89
89
  # load in the content
90
90
  if options.url?
91
91
  # if loading from a URL, do this
@@ -93,14 +93,14 @@ window.Nifty.Dialog =
93
93
  insertedDialog.addClass 'loading'
94
94
  if options.behavior? && behavior = this.behaviors[options.behavior]
95
95
  behavior.beforeLoad.call(null, insertedDialog, options) if behavior.beforeLoad?
96
-
96
+
97
97
  $.ajax
98
98
  url: options.url
99
99
  success: (data)=> this.displayDialog(insertedDialog, data)
100
-
100
+
101
101
  else if options.html?
102
102
  this.displayDialog(insertedDialog, options.html)
103
-
103
+
104
104
  else
105
105
  # anything else won't work
106
106
  console.log "Dialog could not be displayed. Invalid options passed."
@@ -115,7 +115,7 @@ window.Nifty.Dialog =
115
115
  else
116
116
  console.log "Must pass a 'name' option to the addBehavior method."
117
117
  false
118
-
118
+
119
119
  # Complete the opening of a dialog with the given HTML
120
120
  displayDialog: (dialog, content)->
121
121
  dialog.html(content)
@@ -124,6 +124,7 @@ window.Nifty.Dialog =
124
124
  options = dialog.data('options')
125
125
  if options.behavior? && behavior = this.behaviors[options.behavior]
126
126
  behavior.onLoad.call(null, dialog, options) if behavior.onLoad?
127
+ behavior.onSetContent.call(null, dialog, options) if behavior.onSetContent?
127
128
  options.afterLoad.call(null, dialog) if options.afterLoad?
128
129
  this.onSetContent(null, dialog) if this.onSetContent?
129
130
 
@@ -149,7 +150,7 @@ window.Nifty.Dialog =
149
150
  $.ajax
150
151
  url: options.url
151
152
  success: (data)=> this.setContent(data, id)
152
-
153
+
153
154
  # Create a new overlay
154
155
  createOverlay: (options)->
155
156
  overlay = $("<div class='niftyOverlay invisible'></div>")
@@ -160,10 +161,10 @@ window.Nifty.Dialog =
160
161
  overlay.fadeOut 'fast', ->
161
162
  overlay.remove()
162
163
  overlay.fadeIn('fast')
163
-
164
+
164
165
  # Closes the top dialgo in the dialog stack
165
166
  closeTopDialog: ->
166
167
  if $('div.niftyDialog').length
167
168
  $('div.niftyDialog:last').data('closeAction').call()
168
-
169
-
169
+
170
+
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nifty-dialog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
5
- prerelease:
4
+ version: 1.0.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Adam Cooke
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-07 00:00:00.000000000 Z
11
+ date: 2014-11-30 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A javascript library for working with dialogs
15
14
  email:
@@ -18,33 +17,32 @@ executables: []
18
17
  extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
21
- - lib/nifty/dialog/version.rb
22
20
  - lib/nifty/dialog.rb
21
+ - lib/nifty/dialog/version.rb
23
22
  - vendor/assets/javascripts/nifty/dialog.coffee
24
23
  - vendor/assets/stylesheets/nifty/dialog.scss
25
24
  homepage: https://github.com/niftyware/dialog
26
25
  licenses: []
26
+ metadata: {}
27
27
  post_install_message:
28
28
  rdoc_options: []
29
29
  require_paths:
30
30
  - lib
31
31
  required_ruby_version: !ruby/object:Gem::Requirement
32
- none: false
33
32
  requirements:
34
- - - ! '>='
33
+ - - ">="
35
34
  - !ruby/object:Gem::Version
36
35
  version: '0'
37
36
  required_rubygems_version: !ruby/object:Gem::Requirement
38
- none: false
39
37
  requirements:
40
- - - ! '>='
38
+ - - ">="
41
39
  - !ruby/object:Gem::Version
42
40
  version: '0'
43
41
  requirements: []
44
42
  rubyforge_project:
45
- rubygems_version: 1.8.23.2
43
+ rubygems_version: 2.2.2
46
44
  signing_key:
47
- specification_version: 3
45
+ specification_version: 4
48
46
  summary: A javascript library for working with dialogs
49
47
  test_files: []
50
48
  has_rdoc: