nifty-dialog 1.0.4 → 1.0.5
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.
data/lib/nifty/dialog/version.rb
CHANGED
@@ -33,6 +33,7 @@ window.Nifty.Dialog =
|
|
33
33
|
#
|
34
34
|
# behavior => the name of a behavior set to be invoked on dialog open/close.
|
35
35
|
# Behaviors can be setup using the Nifty.Dialog.addBehavior method.
|
36
|
+
# Valid behaviors: beforeLoad, onLoad, onSetContent, onClose
|
36
37
|
#
|
37
38
|
open: (options={})->
|
38
39
|
# set a dialog ID for this dialog
|
@@ -90,6 +91,9 @@ window.Nifty.Dialog =
|
|
90
91
|
# if loading from a URL, do this
|
91
92
|
insertedDialog.addClass 'ajax'
|
92
93
|
insertedDialog.addClass 'loading'
|
94
|
+
if options.behavior? && behavior = this.behaviors[options.behavior]
|
95
|
+
behavior.beforeLoad.call(null, insertedDialog, options) if behavior.beforeLoad?
|
96
|
+
|
93
97
|
$.ajax
|
94
98
|
url: options.url
|
95
99
|
success: (data)=> this.displayDialog(insertedDialog, data)
|
@@ -102,13 +106,6 @@ window.Nifty.Dialog =
|
|
102
106
|
console.log "Dialog could not be displayed. Invalid options passed."
|
103
107
|
console.log options
|
104
108
|
return false
|
105
|
-
|
106
|
-
ajaxLoad: (url, insertedDialog)->
|
107
|
-
insertedDialog.addClass 'ajax'
|
108
|
-
insertedDialog.addClass 'loading'
|
109
|
-
$.ajax
|
110
|
-
url: options.url
|
111
|
-
success: (data)=> this.displayDialog(insertedDialog, data)
|
112
109
|
|
113
110
|
# Add a behaviour callback which will be executed
|
114
111
|
addBehavior: (options)->
|
@@ -147,6 +144,8 @@ window.Nifty.Dialog =
|
|
147
144
|
dialog = if id == null then $('div.niftyDialog:last') else $("div.niftyDialog#niftyDialog-#{id}")
|
148
145
|
options = dialog.data('options')
|
149
146
|
if options.url?
|
147
|
+
if options.behavior? && behavior = this.behaviors[options.behavior]
|
148
|
+
behavior.beforeLoad.call(null, insertedDialog, options) if behavior.beforeLoad?
|
150
149
|
$.ajax
|
151
150
|
url: options.url
|
152
151
|
success: (data)=> this.setContent(data, id)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nifty-dialog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A javascript library for working with dialogs
|
15
15
|
email:
|