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.

@@ -1,3 +1,7 @@
1
+ ## 1.0.2 (12 May 2011)
2
+
3
+ - Fix Rails 3.0 now that rails.js is named jquery_ujs.js
4
+
1
5
  ## 1.0.1 (10 May 2011)
2
6
 
3
7
  - Stop downloading rails.js from GitHub
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:
@@ -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] << 'rails'
20
+ config.action_view.javascript_expansions[:defaults] << 'jquery_ujs'
21
21
  end
22
22
  end
23
23
 
24
24
  end
25
- end
25
+ end
@@ -1,5 +1,5 @@
1
1
  module Jquery
2
2
  module Rails
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -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
- $.ajax({
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
- // If message provided in 'data-confirm' attribute, fires `confirm` event and returns result of confirm dialog.
175
- // Attaching a handler to the element's `confirm` event that returns false cancels the confirm dialog.
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
- return !message || (rails.fire(element, 'confirm') && confirm(message));
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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
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-10 00:00:00 -07:00
18
+ date: 2011-05-12 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency