jquery-rails 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-rails might be problematic. Click here for more details.
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/jquery-rails/railtie.rb +2 -2
- data/lib/jquery-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery_ujs.js +31 -5
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -15,6 +15,8 @@ If you wish to use jQuery UI as well, you can add this line to `application.js`:
|
|
15
15
|
|
16
16
|
//= require jquery-ui
|
17
17
|
|
18
|
+
In order to use the themed parts of jQuery UI, you will also need to supply your own theme CSS. See [jqueryui.com](http://jqueryui.com) for more information.
|
19
|
+
|
18
20
|
### Installation
|
19
21
|
|
20
22
|
When you generate a new Rails 3.1 app, pass the `-j jquery` option, like this:
|
data/lib/jquery-rails/railtie.rb
CHANGED
@@ -17,9 +17,9 @@ module Jquery
|
|
17
17
|
# at the end, because load order is important
|
18
18
|
config.action_view.javascript_expansions[:defaults] -= PROTOTYPE_JS + ['rails']
|
19
19
|
config.action_view.javascript_expansions[:defaults] |= jq_defaults
|
20
|
-
config.action_view.javascript_expansions[:defaults] << '
|
20
|
+
config.action_view.javascript_expansions[:defaults] << 'jquery_ujs'
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
data/lib/jquery-rails/version.rb
CHANGED
@@ -82,6 +82,16 @@
|
|
82
82
|
return event.result !== false;
|
83
83
|
},
|
84
84
|
|
85
|
+
// Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
|
86
|
+
confirm: function(message) {
|
87
|
+
return confirm(message);
|
88
|
+
},
|
89
|
+
|
90
|
+
// Default ajax function, may be overridden with custom function in $.rails.ajax
|
91
|
+
ajax: function(options) {
|
92
|
+
return $.ajax(options);
|
93
|
+
},
|
94
|
+
|
85
95
|
// Submits "remote" forms and links with ajax
|
86
96
|
handleRemote: function(element) {
|
87
97
|
var method, url, data,
|
@@ -105,7 +115,7 @@
|
|
105
115
|
data = null;
|
106
116
|
}
|
107
117
|
|
108
|
-
|
118
|
+
rails.ajax({
|
109
119
|
url: url, type: method || 'GET', data: data, dataType: dataType,
|
110
120
|
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
111
121
|
beforeSend: function(xhr, settings) {
|
@@ -171,11 +181,27 @@
|
|
171
181
|
});
|
172
182
|
},
|
173
183
|
|
174
|
-
|
175
|
-
|
184
|
+
/*
|
185
|
+
For 'data-confirm' attribute:
|
186
|
+
- fires `confirm` event
|
187
|
+
- shows the confirmation dialog
|
188
|
+
- fires the `confirm:complete` event
|
189
|
+
|
190
|
+
Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
|
191
|
+
Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
|
192
|
+
Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
|
193
|
+
return false.
|
194
|
+
*/
|
176
195
|
allowAction: function(element) {
|
177
|
-
var message = element.data('confirm')
|
178
|
-
|
196
|
+
var message = element.data('confirm'),
|
197
|
+
answer = false, callback;
|
198
|
+
if (!message) { return true; }
|
199
|
+
|
200
|
+
if (rails.fire(element, 'confirm')) {
|
201
|
+
answer = rails.confirm(message);
|
202
|
+
callback = rails.fire(element, 'confirm:complete', [answer]);
|
203
|
+
}
|
204
|
+
return answer && callback;
|
179
205
|
},
|
180
206
|
|
181
207
|
// Helper function which checks for blank inputs in a form that match the specified CSS selector
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Andr\xC3\xA9 Arko"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-12 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|