jquery_rails3 1.4.2.b1 → 1.4.2.b2
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -12,13 +12,13 @@ require 'rake/testtask'
|
|
12
12
|
|
13
13
|
spec = Gem::Specification.new do |s|
|
14
14
|
s.name = 'jquery_rails3'
|
15
|
-
s.version = '1.4.2.
|
15
|
+
s.version = '1.4.2.b2'
|
16
16
|
s.has_rdoc = true
|
17
17
|
s.extra_rdoc_files = ['README', 'LICENSE']
|
18
18
|
s.summary = 'Jquery generator for rails 3'
|
19
19
|
s.description = s.summary
|
20
|
-
s.author = ''
|
21
|
-
s.email = ''
|
20
|
+
s.author = 'Allan Davis'
|
21
|
+
s.email = 'javaalley@gmail.com'
|
22
22
|
# s.executables = ['your_executable_here']
|
23
23
|
s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
|
24
24
|
s.require_path = "lib"
|
@@ -1,22 +1,102 @@
|
|
1
|
-
class JqueryInstallGenerator < Rails::Generators::Base
|
2
|
-
source_root File.expand_path('../templates', __FILE__)
|
3
|
-
# Options
|
4
|
-
class_option :ui, :type => :boolean, :defalut =>
|
5
|
-
class_option :
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
1
|
+
class JqueryInstallGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
# Options
|
4
|
+
class_option :ui, :type => :boolean, :defalut => false, :desc => "Add jquery-ui components to application."
|
5
|
+
class_option :effect, :type => :boolean, :default =>false, :desc =>"Add jquery-ui effect commponents to application"
|
6
|
+
class_option :min, :type => :boolean, :default => false, :desc => "Use min versions of jquery and ui components."
|
7
|
+
class_option :components, :type => :array, :default => [], :desc => "List the Jquery-ui Components to include. Leaving blank will include all components."
|
8
|
+
class_option :effects, :type => :array, :default =>[], :desc => "List of the Jquery-ui Effects to include. Leaving blank will include all effects."
|
9
|
+
class_option :theme, :type=>:string, :default => "base", :desc => "Name of the theme to apply to the components. Options are \"base\" or \"smoothness\"."
|
10
|
+
|
11
|
+
JQUERY_VERSION = "1.4.2"
|
12
|
+
JS_DEST = "public/javascripts"
|
13
|
+
CSS_DEST = "public/stylesheets"
|
14
|
+
EFFECTS =%w(blind bounce clip core drop explode fold highlight pulsate scale shake slide transfer)
|
15
|
+
COMPONENTS=%w(core accordion autocomplete button datepicker dialog draggable droppable mouse position progressbar resizable selectable slider sortable tabs widget custom)
|
16
|
+
|
17
|
+
|
18
|
+
def install_jquery
|
19
|
+
@javascripts = []
|
20
|
+
@stylesheets = []
|
21
|
+
|
22
|
+
copy_file "jquery-#{jquery_version}.js", "#{JS_DEST}/jquery-#{jquery_version}.js"
|
23
|
+
@javascripts << "\"jquery-#{jquery_version}\""
|
24
|
+
copy_file "rails.js", "#{JS_DEST}/rails.js"
|
25
|
+
@javascripts << "\"rails\""
|
26
|
+
if options.ui?
|
27
|
+
copy_components
|
28
|
+
stylesheet
|
29
|
+
end
|
30
|
+
if options.effect?
|
31
|
+
copy_effects
|
32
|
+
end
|
33
|
+
#insted of rewriteing layout
|
34
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
35
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
36
|
+
template "layout.html.erb", "app/views/layouts/application.html.erb"
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def jquery_version
|
42
|
+
version = JQUERY_VERSION
|
43
|
+
version = version + ".min" if options.min?
|
44
|
+
return version
|
45
|
+
end
|
46
|
+
|
47
|
+
def javascripts
|
48
|
+
@javascripts.join(", ")
|
49
|
+
end
|
50
|
+
|
51
|
+
def stylesheets
|
52
|
+
@stylesheets.join(", ")
|
53
|
+
end
|
54
|
+
|
55
|
+
def copy_effects
|
56
|
+
effects = []
|
57
|
+
if options.effects.empty?
|
58
|
+
effects = EFFECTS
|
59
|
+
else
|
60
|
+
effects = options.effects
|
61
|
+
end
|
62
|
+
unless effects.include? "core"
|
63
|
+
effects << "core"
|
64
|
+
end
|
65
|
+
effects.each { |effect| copy_component("effect",effect)if EFFECTS.include?(effect) }
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def copy_components
|
70
|
+
components = []
|
71
|
+
if options.components.empty?
|
72
|
+
components = COMPONENTS
|
73
|
+
else
|
74
|
+
components = options.components
|
75
|
+
end
|
76
|
+
unless components.include? "core"
|
77
|
+
components << "core"
|
78
|
+
end
|
79
|
+
components.each { |component| copy_component("ui",component) if COMPONENTS.include?(component)}
|
80
|
+
|
81
|
+
end
|
82
|
+
# Copy one of the components to
|
83
|
+
def copy_component(state, name)
|
84
|
+
name = "jquery.#{state}.#{name.downcase}"
|
85
|
+
name = name + ".min" if options.min?
|
86
|
+
@javascripts << "\"#{name}\""
|
87
|
+
folder=""
|
88
|
+
if options.min?
|
89
|
+
folder = "ui-min"
|
90
|
+
else
|
91
|
+
folder = "ui"
|
92
|
+
end
|
93
|
+
copy_file "#{folder}/#{name}.js", "#{JS_DEST}/#{name}.js"
|
94
|
+
end
|
95
|
+
|
96
|
+
def stylesheet
|
97
|
+
name = "jquery.ui.all"
|
98
|
+
@stylesheets << name
|
99
|
+
copy_file "themes/#{options.theme}/#{name}.css", "#{CSS_DEST}/#{name}.css"
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
@@ -1,812 +1,132 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
<
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<input type="hidden" name="repo" value="" />
|
134
|
-
<input type="hidden" name="langOverride" value="" />
|
135
|
-
<input type="hidden" name="start_value" value="1" />
|
136
|
-
</form>
|
137
|
-
|
138
|
-
|
139
|
-
<ul class="nav">
|
140
|
-
<li><a href="/explore">Explore GitHub</a></li>
|
141
|
-
<li><a href="http://gist.github.com">Gist</a></li>
|
142
|
-
<li><a href="/blog">Blog</a></li>
|
143
|
-
<li><a href="http://help.github.com">Help</a></li>
|
144
|
-
</ul>
|
145
|
-
|
146
|
-
</div>
|
147
|
-
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
<div class="site">
|
155
|
-
<div class="pagehead repohead vis-public ">
|
156
|
-
<h1>
|
157
|
-
<a href="/rails">rails</a> / <strong><a href="http://github.com/rails/jquery-ujs">jquery-ujs</a></strong>
|
158
|
-
|
159
|
-
|
160
|
-
</h1>
|
161
|
-
|
162
|
-
|
163
|
-
<ul class="actions">
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
<li class="for-owner" style="display:none"><a href="https://github.com/rails/jquery-ujs/edit" class="minibutton btn-admin "><span><span class="icon"></span>Admin</span></a></li>
|
168
|
-
<li>
|
169
|
-
<a href="/rails/jquery-ujs/toggle_watch" class="minibutton btn-watch " id="watch_button" style="display:none"><span><span class="icon"></span>Watch</span></a>
|
170
|
-
<a href="/rails/jquery-ujs/toggle_watch" class="minibutton btn-watch " id="unwatch_button" style="display:none"><span><span class="icon"></span>Unwatch</span></a>
|
171
|
-
</li>
|
172
|
-
|
173
|
-
|
174
|
-
<li class="for-notforked" style="display:none"><a href="/rails/jquery-ujs/fork" class="minibutton btn-fork " id="fork_button" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', 'authenticity_token'); s.setAttribute('value', '6ab3c45cc14437552e32f8a00c3f92831638ffae'); f.appendChild(s);f.submit();return false;"><span><span class="icon"></span>Fork</span></a></li>
|
175
|
-
<li class="for-hasfork" style="display:none"><a href="#" class="minibutton btn-fork " id="your_fork_button"><span><span class="icon"></span>Your Fork</span></a></li>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
<li id="pull_request_item" class='ospr' style="display:none"><a href="/rails/jquery-ujs/pull_request/" class="minibutton btn-pull-request "><span><span class="icon"></span>Pull Request</span></a></li>
|
180
|
-
|
181
|
-
|
182
|
-
<li><a href="#" class="minibutton btn-download " id="download_button"><span><span class="icon"></span>Download Source</span></a></li>
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
<li class="repostats">
|
187
|
-
<ul class="repo-stats">
|
188
|
-
<li class="watchers"><a href="/rails/jquery-ujs/watchers" title="Watchers" class="tooltipped downwards">484</a></li>
|
189
|
-
<li class="forks"><a href="/rails/jquery-ujs/network" title="Forks" class="tooltipped downwards">41</a></li>
|
190
|
-
</ul>
|
191
|
-
</li>
|
192
|
-
</ul>
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
<ul class="tabs">
|
197
|
-
<li><a href="http://github.com/rails/jquery-ujs/tree/master" class="selected" highlight="repo_source">Source</a></li>
|
198
|
-
<li><a href="http://github.com/rails/jquery-ujs/commits/master" highlight="repo_commits">Commits</a></li>
|
199
|
-
|
200
|
-
|
201
|
-
<li><a href="/rails/jquery-ujs/network" highlight="repo_network">Network (41)</a></li>
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
<li><a href="/rails/jquery-ujs/issues" highlight="issues">Issues (4)</a></li>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
<li><a href="/rails/jquery-ujs/downloads">Downloads (0)</a></li>
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
<li><a href="http://wiki.github.com/rails/jquery-ujs/">Wiki (1)</a></li>
|
217
|
-
|
218
|
-
<li><a href="/rails/jquery-ujs/graphs" highlight="repo_graphs">Graphs</a></li>
|
219
|
-
|
220
|
-
<li class="contextswitch nochoices">
|
221
|
-
<span class="toggle leftwards" >
|
222
|
-
<em>Branch:</em>
|
223
|
-
<code>master</code>
|
224
|
-
</span>
|
225
|
-
</li>
|
226
|
-
</ul>
|
227
|
-
|
228
|
-
<div style="display:none" id="pl-description"><p><em class="placeholder">click here to add a description</em></p></div>
|
229
|
-
<div style="display:none" id="pl-homepage"><p><em class="placeholder">click here to add a homepage</em></p></div>
|
230
|
-
|
231
|
-
<div class="subnav-bar">
|
232
|
-
|
233
|
-
<ul>
|
234
|
-
<li>
|
235
|
-
<a href="#" class="dropdown">Switch Branches (1)</a>
|
236
|
-
<ul>
|
237
|
-
|
238
|
-
|
239
|
-
<li><strong>master ✓</strong></li>
|
240
|
-
|
241
|
-
</ul>
|
242
|
-
</li>
|
243
|
-
<li>
|
244
|
-
<a href="#" class="dropdown defunct">Switch Tags (0)</a>
|
245
|
-
|
246
|
-
</li>
|
247
|
-
<li>
|
248
|
-
|
249
|
-
<a href="/rails/jquery-ujs/branches" class="manage">Branch List</a>
|
250
|
-
|
251
|
-
</li>
|
252
|
-
</ul>
|
253
|
-
</div>
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
<div id="repo_details" class="metabox clearfix">
|
266
|
-
<div id="repo_details_loader" class="metabox-loader" style="display:none">Sending Request…</div>
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
<div id="repository_description" rel="repository_description_edit">
|
271
|
-
|
272
|
-
</div>
|
273
|
-
<div id="repository_description_edit" style="display:none;" class="inline-edit">
|
274
|
-
<form action="/rails/jquery-ujs/edit/update" method="post"><div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="6ab3c45cc14437552e32f8a00c3f92831638ffae" /></div>
|
275
|
-
<input type="hidden" name="field" value="repository_description">
|
276
|
-
<input type="text" class="textfield" name="value" value="">
|
277
|
-
<div class="form-actions">
|
278
|
-
<button class="minibutton"><span>Save</span></button> <a href="#" class="cancel">Cancel</a>
|
279
|
-
</div>
|
280
|
-
</form>
|
281
|
-
</div>
|
282
|
-
|
283
|
-
|
284
|
-
<div class="repository-homepage" id="repository_homepage" rel="repository_homepage_edit">
|
285
|
-
<p><a href="http://" rel="nofollow"></a></p>
|
286
|
-
</div>
|
287
|
-
<div id="repository_homepage_edit" style="display:none;" class="inline-edit">
|
288
|
-
<form action="/rails/jquery-ujs/edit/update" method="post"><div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="6ab3c45cc14437552e32f8a00c3f92831638ffae" /></div>
|
289
|
-
<input type="hidden" name="field" value="repository_homepage">
|
290
|
-
<input type="text" class="textfield" name="value" value="">
|
291
|
-
<div class="form-actions">
|
292
|
-
<button class="minibutton"><span>Save</span></button> <a href="#" class="cancel">Cancel</a>
|
293
|
-
</div>
|
294
|
-
</form>
|
295
|
-
</div>
|
296
|
-
|
297
|
-
<div class="rule editable-only"></div>
|
298
|
-
|
299
|
-
<div id="url_box" class="url-box">
|
300
|
-
<ul class="clone-urls">
|
301
|
-
|
302
|
-
|
303
|
-
<li id="http_clone_url"><a href="http://github.com/rails/jquery-ujs.git" data-permissions="Read-Only">HTTP</a></li>
|
304
|
-
<li id="public_clone_url"><a href="git://github.com/rails/jquery-ujs.git" data-permissions="Read-Only">Git Read-Only</a></li>
|
305
|
-
|
306
|
-
</ul>
|
307
|
-
<input type="text" spellcheck="false" id="url_field" class="url-field" />
|
308
|
-
<span style="display:none" id="url_box_clippy"></span>
|
309
|
-
<span id="clippy_tooltip_url_box_clippy" class="clippy-tooltip tooltipped" title="copy to clipboard">
|
310
|
-
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
|
311
|
-
width="14"
|
312
|
-
height="14"
|
313
|
-
class="clippy"
|
314
|
-
id="clippy" >
|
315
|
-
<param name="movie" value="http://assets0.github.com/flash/clippy.swf?v5"/>
|
316
|
-
<param name="allowScriptAccess" value="always" />
|
317
|
-
<param name="quality" value="high" />
|
318
|
-
<param name="scale" value="noscale" />
|
319
|
-
<param NAME="FlashVars" value="id=url_box_clippy&copied=&copyto=">
|
320
|
-
<param name="bgcolor" value="#FFFFFF">
|
321
|
-
<param name="wmode" value="opaque">
|
322
|
-
<embed src="http://assets0.github.com/flash/clippy.swf?v5"
|
323
|
-
width="14"
|
324
|
-
height="14"
|
325
|
-
name="clippy"
|
326
|
-
quality="high"
|
327
|
-
allowScriptAccess="always"
|
328
|
-
type="application/x-shockwave-flash"
|
329
|
-
pluginspage="http://www.macromedia.com/go/getflashplayer"
|
330
|
-
FlashVars="id=url_box_clippy&copied=&copyto="
|
331
|
-
bgcolor="#FFFFFF"
|
332
|
-
wmode="opaque"
|
333
|
-
/>
|
334
|
-
</object>
|
335
|
-
</span>
|
336
|
-
|
337
|
-
<p id="url_description">This URL has <strong>Read+Write</strong> access</p>
|
338
|
-
</div>
|
339
|
-
</div>
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
</div><!-- /.pagehead -->
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
<script type="text/javascript">
|
357
|
-
GitHub.currentCommitRef = 'master'
|
358
|
-
GitHub.currentRepoOwner = 'rails'
|
359
|
-
GitHub.currentRepo = "jquery-ujs"
|
360
|
-
GitHub.downloadRepo = '/rails/jquery-ujs/archives/master'
|
361
|
-
|
362
|
-
|
363
|
-
GitHub.hasWriteAccess = false
|
364
|
-
GitHub.hasAdminAccess = false
|
365
|
-
GitHub.watchingRepo = true
|
366
|
-
GitHub.ignoredRepo = false
|
367
|
-
GitHub.hasForkOfRepo = ""
|
368
|
-
GitHub.hasForked = false
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
</script>
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
<div id="commit">
|
384
|
-
<div class="group">
|
385
|
-
|
386
|
-
<div class="envelope commit">
|
387
|
-
<div class="human">
|
388
|
-
|
389
|
-
<div class="message"><pre><a href="/rails/jquery-ujs/commit/abe2f8c2f4fa53391ed954c38a596c2754a78509">data-disable-with should work for non remote forms too</a> </pre></div>
|
390
|
-
|
391
|
-
|
392
|
-
<div class="actor">
|
393
|
-
<div class="gravatar">
|
394
|
-
|
395
|
-
<img src="http://www.gravatar.com/avatar/864ae2178a21699972a64f5262b62b00?s=140&d=http%3A%2F%2Fgithub.com%2Fimages%2Fgravatars%2Fgravatar-140.png" alt="" width="30" height="30" />
|
396
|
-
</div>
|
397
|
-
<div class="name"><a href="/lucasuyezu">lucasuyezu</a> <span>(author)</span></div>
|
398
|
-
<div class="date">
|
399
|
-
<abbr class="relatize" title="2010-07-30 19:59:00">Fri Jul 30 19:59:00 -0700 2010</abbr>
|
400
|
-
</div>
|
401
|
-
</div>
|
402
|
-
|
403
|
-
|
404
|
-
<div class="actor">
|
405
|
-
<div class="gravatar">
|
406
|
-
<img src="http://www.gravatar.com/avatar/e837f6b7fd146ab16ed3d663476c063e?s=140&d=http%3A%2F%2Fgithub.com%2Fimages%2Fgravatars%2Fgravatar-140.png" alt="" width="30" height="30" />
|
407
|
-
</div>
|
408
|
-
<div class="name"><a href="/josevalim">josevalim</a> <span>(committer)</span></div>
|
409
|
-
<div class="date"><abbr class="relatize" title="2010-07-31 00:33:28">Sat Jul 31 00:33:28 -0700 2010</abbr></div>
|
410
|
-
</div>
|
411
|
-
|
412
|
-
|
413
|
-
</div>
|
414
|
-
<div class="machine">
|
415
|
-
<span>c</span>ommit <a href="/rails/jquery-ujs/commit/abe2f8c2f4fa53391ed954c38a596c2754a78509" hotkey="c">abe2f8c2f4fa53391ed9</a><br />
|
416
|
-
<span>t</span>ree <a href="/rails/jquery-ujs/tree/abe2f8c2f4fa53391ed954c38a596c2754a78509" hotkey="t">8e6254bd8a0087e7c39e</a><br />
|
417
|
-
|
418
|
-
<span>p</span>arent
|
419
|
-
|
420
|
-
<a href="/rails/jquery-ujs/tree/bcaad3775656622acf12a1fecb7aa577ddc5a932" hotkey="p">bcaad3775656622acf12</a>
|
421
|
-
|
422
|
-
|
423
|
-
</div>
|
424
|
-
</div>
|
425
|
-
|
426
|
-
</div>
|
427
|
-
</div>
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
<div id="path">
|
433
|
-
<b><a href="/rails/jquery-ujs/tree/master">jquery-ujs</a></b> / <a href="/rails/jquery-ujs/tree/master/src">src</a> / rails.js <span style="display:none" id="clippy_604">src/rails.js</span>
|
434
|
-
|
435
|
-
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
|
436
|
-
width="110"
|
437
|
-
height="14"
|
438
|
-
class="clippy"
|
439
|
-
id="clippy" >
|
440
|
-
<param name="movie" value="http://assets0.github.com/flash/clippy.swf?v5"/>
|
441
|
-
<param name="allowScriptAccess" value="always" />
|
442
|
-
<param name="quality" value="high" />
|
443
|
-
<param name="scale" value="noscale" />
|
444
|
-
<param NAME="FlashVars" value="id=clippy_604&copied=copied!&copyto=copy to clipboard">
|
445
|
-
<param name="bgcolor" value="#FFFFFF">
|
446
|
-
<param name="wmode" value="opaque">
|
447
|
-
<embed src="http://assets0.github.com/flash/clippy.swf?v5"
|
448
|
-
width="110"
|
449
|
-
height="14"
|
450
|
-
name="clippy"
|
451
|
-
quality="high"
|
452
|
-
allowScriptAccess="always"
|
453
|
-
type="application/x-shockwave-flash"
|
454
|
-
pluginspage="http://www.macromedia.com/go/getflashplayer"
|
455
|
-
FlashVars="id=clippy_604&copied=copied!&copyto=copy to clipboard"
|
456
|
-
bgcolor="#FFFFFF"
|
457
|
-
wmode="opaque"
|
458
|
-
/>
|
459
|
-
</object>
|
460
|
-
|
461
|
-
|
462
|
-
</div>
|
463
|
-
|
464
|
-
<div id="files">
|
465
|
-
<div class="file">
|
466
|
-
<div class="meta">
|
467
|
-
<div class="info">
|
468
|
-
<span class="icon"><img alt="Txt" height="16" src="http://assets2.github.com/images/icons/txt.png?d18b030b96c73150958b7d50c8f1c0f76c602814" width="16" /></span>
|
469
|
-
<span class="mode" title="File Mode">100644</span>
|
470
|
-
|
471
|
-
<span>133 lines (114 sloc)</span>
|
472
|
-
|
473
|
-
<span>4.912 kb</span>
|
474
|
-
</div>
|
475
|
-
<ul class="actions">
|
476
|
-
|
477
|
-
<li><a id="file-edit-link" href="#" rel="/rails/jquery-ujs/file-edit/__ref__/src/rails.js">edit</a></li>
|
478
|
-
|
479
|
-
<li><a href="/rails/jquery-ujs/raw/master/src/rails.js" id="raw-url">raw</a></li>
|
480
|
-
|
481
|
-
<li><a href="/rails/jquery-ujs/blame/master/src/rails.js">blame</a></li>
|
482
|
-
|
483
|
-
<li><a href="/rails/jquery-ujs/commits/master/src/rails.js">history</a></li>
|
484
|
-
</ul>
|
485
|
-
</div>
|
486
|
-
|
487
|
-
<div class="data syntax type-javascript">
|
488
|
-
|
489
|
-
<table cellpadding="0" cellspacing="0">
|
490
|
-
<tr>
|
491
|
-
<td>
|
492
|
-
<pre class="line_numbers"><span id="LID1" rel="#L1">1</span>
|
493
|
-
<span id="LID2" rel="#L2">2</span>
|
494
|
-
<span id="LID3" rel="#L3">3</span>
|
495
|
-
<span id="LID4" rel="#L4">4</span>
|
496
|
-
<span id="LID5" rel="#L5">5</span>
|
497
|
-
<span id="LID6" rel="#L6">6</span>
|
498
|
-
<span id="LID7" rel="#L7">7</span>
|
499
|
-
<span id="LID8" rel="#L8">8</span>
|
500
|
-
<span id="LID9" rel="#L9">9</span>
|
501
|
-
<span id="LID10" rel="#L10">10</span>
|
502
|
-
<span id="LID11" rel="#L11">11</span>
|
503
|
-
<span id="LID12" rel="#L12">12</span>
|
504
|
-
<span id="LID13" rel="#L13">13</span>
|
505
|
-
<span id="LID14" rel="#L14">14</span>
|
506
|
-
<span id="LID15" rel="#L15">15</span>
|
507
|
-
<span id="LID16" rel="#L16">16</span>
|
508
|
-
<span id="LID17" rel="#L17">17</span>
|
509
|
-
<span id="LID18" rel="#L18">18</span>
|
510
|
-
<span id="LID19" rel="#L19">19</span>
|
511
|
-
<span id="LID20" rel="#L20">20</span>
|
512
|
-
<span id="LID21" rel="#L21">21</span>
|
513
|
-
<span id="LID22" rel="#L22">22</span>
|
514
|
-
<span id="LID23" rel="#L23">23</span>
|
515
|
-
<span id="LID24" rel="#L24">24</span>
|
516
|
-
<span id="LID25" rel="#L25">25</span>
|
517
|
-
<span id="LID26" rel="#L26">26</span>
|
518
|
-
<span id="LID27" rel="#L27">27</span>
|
519
|
-
<span id="LID28" rel="#L28">28</span>
|
520
|
-
<span id="LID29" rel="#L29">29</span>
|
521
|
-
<span id="LID30" rel="#L30">30</span>
|
522
|
-
<span id="LID31" rel="#L31">31</span>
|
523
|
-
<span id="LID32" rel="#L32">32</span>
|
524
|
-
<span id="LID33" rel="#L33">33</span>
|
525
|
-
<span id="LID34" rel="#L34">34</span>
|
526
|
-
<span id="LID35" rel="#L35">35</span>
|
527
|
-
<span id="LID36" rel="#L36">36</span>
|
528
|
-
<span id="LID37" rel="#L37">37</span>
|
529
|
-
<span id="LID38" rel="#L38">38</span>
|
530
|
-
<span id="LID39" rel="#L39">39</span>
|
531
|
-
<span id="LID40" rel="#L40">40</span>
|
532
|
-
<span id="LID41" rel="#L41">41</span>
|
533
|
-
<span id="LID42" rel="#L42">42</span>
|
534
|
-
<span id="LID43" rel="#L43">43</span>
|
535
|
-
<span id="LID44" rel="#L44">44</span>
|
536
|
-
<span id="LID45" rel="#L45">45</span>
|
537
|
-
<span id="LID46" rel="#L46">46</span>
|
538
|
-
<span id="LID47" rel="#L47">47</span>
|
539
|
-
<span id="LID48" rel="#L48">48</span>
|
540
|
-
<span id="LID49" rel="#L49">49</span>
|
541
|
-
<span id="LID50" rel="#L50">50</span>
|
542
|
-
<span id="LID51" rel="#L51">51</span>
|
543
|
-
<span id="LID52" rel="#L52">52</span>
|
544
|
-
<span id="LID53" rel="#L53">53</span>
|
545
|
-
<span id="LID54" rel="#L54">54</span>
|
546
|
-
<span id="LID55" rel="#L55">55</span>
|
547
|
-
<span id="LID56" rel="#L56">56</span>
|
548
|
-
<span id="LID57" rel="#L57">57</span>
|
549
|
-
<span id="LID58" rel="#L58">58</span>
|
550
|
-
<span id="LID59" rel="#L59">59</span>
|
551
|
-
<span id="LID60" rel="#L60">60</span>
|
552
|
-
<span id="LID61" rel="#L61">61</span>
|
553
|
-
<span id="LID62" rel="#L62">62</span>
|
554
|
-
<span id="LID63" rel="#L63">63</span>
|
555
|
-
<span id="LID64" rel="#L64">64</span>
|
556
|
-
<span id="LID65" rel="#L65">65</span>
|
557
|
-
<span id="LID66" rel="#L66">66</span>
|
558
|
-
<span id="LID67" rel="#L67">67</span>
|
559
|
-
<span id="LID68" rel="#L68">68</span>
|
560
|
-
<span id="LID69" rel="#L69">69</span>
|
561
|
-
<span id="LID70" rel="#L70">70</span>
|
562
|
-
<span id="LID71" rel="#L71">71</span>
|
563
|
-
<span id="LID72" rel="#L72">72</span>
|
564
|
-
<span id="LID73" rel="#L73">73</span>
|
565
|
-
<span id="LID74" rel="#L74">74</span>
|
566
|
-
<span id="LID75" rel="#L75">75</span>
|
567
|
-
<span id="LID76" rel="#L76">76</span>
|
568
|
-
<span id="LID77" rel="#L77">77</span>
|
569
|
-
<span id="LID78" rel="#L78">78</span>
|
570
|
-
<span id="LID79" rel="#L79">79</span>
|
571
|
-
<span id="LID80" rel="#L80">80</span>
|
572
|
-
<span id="LID81" rel="#L81">81</span>
|
573
|
-
<span id="LID82" rel="#L82">82</span>
|
574
|
-
<span id="LID83" rel="#L83">83</span>
|
575
|
-
<span id="LID84" rel="#L84">84</span>
|
576
|
-
<span id="LID85" rel="#L85">85</span>
|
577
|
-
<span id="LID86" rel="#L86">86</span>
|
578
|
-
<span id="LID87" rel="#L87">87</span>
|
579
|
-
<span id="LID88" rel="#L88">88</span>
|
580
|
-
<span id="LID89" rel="#L89">89</span>
|
581
|
-
<span id="LID90" rel="#L90">90</span>
|
582
|
-
<span id="LID91" rel="#L91">91</span>
|
583
|
-
<span id="LID92" rel="#L92">92</span>
|
584
|
-
<span id="LID93" rel="#L93">93</span>
|
585
|
-
<span id="LID94" rel="#L94">94</span>
|
586
|
-
<span id="LID95" rel="#L95">95</span>
|
587
|
-
<span id="LID96" rel="#L96">96</span>
|
588
|
-
<span id="LID97" rel="#L97">97</span>
|
589
|
-
<span id="LID98" rel="#L98">98</span>
|
590
|
-
<span id="LID99" rel="#L99">99</span>
|
591
|
-
<span id="LID100" rel="#L100">100</span>
|
592
|
-
<span id="LID101" rel="#L101">101</span>
|
593
|
-
<span id="LID102" rel="#L102">102</span>
|
594
|
-
<span id="LID103" rel="#L103">103</span>
|
595
|
-
<span id="LID104" rel="#L104">104</span>
|
596
|
-
<span id="LID105" rel="#L105">105</span>
|
597
|
-
<span id="LID106" rel="#L106">106</span>
|
598
|
-
<span id="LID107" rel="#L107">107</span>
|
599
|
-
<span id="LID108" rel="#L108">108</span>
|
600
|
-
<span id="LID109" rel="#L109">109</span>
|
601
|
-
<span id="LID110" rel="#L110">110</span>
|
602
|
-
<span id="LID111" rel="#L111">111</span>
|
603
|
-
<span id="LID112" rel="#L112">112</span>
|
604
|
-
<span id="LID113" rel="#L113">113</span>
|
605
|
-
<span id="LID114" rel="#L114">114</span>
|
606
|
-
<span id="LID115" rel="#L115">115</span>
|
607
|
-
<span id="LID116" rel="#L116">116</span>
|
608
|
-
<span id="LID117" rel="#L117">117</span>
|
609
|
-
<span id="LID118" rel="#L118">118</span>
|
610
|
-
<span id="LID119" rel="#L119">119</span>
|
611
|
-
<span id="LID120" rel="#L120">120</span>
|
612
|
-
<span id="LID121" rel="#L121">121</span>
|
613
|
-
<span id="LID122" rel="#L122">122</span>
|
614
|
-
<span id="LID123" rel="#L123">123</span>
|
615
|
-
<span id="LID124" rel="#L124">124</span>
|
616
|
-
<span id="LID125" rel="#L125">125</span>
|
617
|
-
<span id="LID126" rel="#L126">126</span>
|
618
|
-
<span id="LID127" rel="#L127">127</span>
|
619
|
-
<span id="LID128" rel="#L128">128</span>
|
620
|
-
<span id="LID129" rel="#L129">129</span>
|
621
|
-
<span id="LID130" rel="#L130">130</span>
|
622
|
-
<span id="LID131" rel="#L131">131</span>
|
623
|
-
<span id="LID132" rel="#L132">132</span>
|
624
|
-
<span id="LID133" rel="#L133">133</span>
|
625
|
-
</pre>
|
626
|
-
</td>
|
627
|
-
<td width="100%">
|
628
|
-
|
629
|
-
<div class="highlight"><pre><div class='line' id='LC1'><span class="nx">jQuery</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">$</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC2'> <span class="kd">var</span> <span class="nx">csrf_token</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="s1">'meta[name=csrf-token]'</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'content'</span><span class="p">),</span></div><div class='line' id='LC3'> <span class="nx">csrf_param</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="s1">'meta[name=csrf-param]'</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'content'</span><span class="p">);</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'> <span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">extend</span><span class="p">({</span></div><div class='line' id='LC6'> <span class="cm">/**</span></div><div class='line' id='LC7'><span class="cm"> * Triggers a custom event on an element and returns the event result</span></div><div class='line' id='LC8'><span class="cm"> * this is used to get around not being able to ensure callbacks are placed</span></div><div class='line' id='LC9'><span class="cm"> * at the end of the chain.</span></div><div class='line' id='LC10'><span class="cm"> *</span></div><div class='line' id='LC11'><span class="cm"> * TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our</span></div><div class='line' id='LC12'><span class="cm"> * own events and placing ourselves at the end of the chain.</span></div><div class='line' id='LC13'><span class="cm"> */</span></div><div class='line' id='LC14'> <span class="nx">triggerAndReturn</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">data</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC15'> <span class="kd">var</span> <span class="nx">event</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">$</span><span class="p">.</span><span class="nx">Event</span><span class="p">(</span><span class="nx">name</span><span class="p">);</span></div><div class='line' id='LC16'> <span class="k">this</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="nx">event</span><span class="p">,</span> <span class="nx">data</span><span class="p">);</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'> <span class="k">return</span> <span class="nx">event</span><span class="p">.</span><span class="nx">result</span> <span class="o">!==</span> <span class="kc">false</span><span class="p">;</span></div><div class='line' id='LC19'> <span class="p">},</span></div><div class='line' id='LC20'><br/></div><div class='line' id='LC21'> <span class="cm">/**</span></div><div class='line' id='LC22'><span class="cm"> * Handles execution of remote calls firing overridable events along the way</span></div><div class='line' id='LC23'><span class="cm"> */</span></div><div class='line' id='LC24'> <span class="nx">callRemote</span><span class="o">:</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC25'> <span class="kd">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="p">,</span></div><div class='line' id='LC26'> <span class="nx">method</span> <span class="o">=</span> <span class="nx">el</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'method'</span><span class="p">)</span> <span class="o">||</span> <span class="nx">el</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'data-method'</span><span class="p">)</span> <span class="o">||</span> <span class="s1">'GET'</span><span class="p">,</span></div><div class='line' id='LC27'> <span class="nx">url</span> <span class="o">=</span> <span class="nx">el</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'action'</span><span class="p">)</span> <span class="o">||</span> <span class="nx">el</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'href'</span><span class="p">),</span></div><div class='line' id='LC28'> <span class="nx">dataType</span> <span class="o">=</span> <span class="nx">el</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'data-type'</span><span class="p">)</span> <span class="o">||</span> <span class="s1">'script'</span><span class="p">;</span></div><div class='line' id='LC29'><br/></div><div class='line' id='LC30'> <span class="k">if</span> <span class="p">(</span><span class="nx">url</span> <span class="o">===</span> <span class="kc">undefined</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC31'> <span class="k">throw</span> <span class="s2">"No URL specified for remote call (action or href must be present)."</span><span class="p">;</span></div><div class='line' id='LC32'> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC33'> <span class="k">if</span> <span class="p">(</span><span class="nx">el</span><span class="p">.</span><span class="nx">triggerAndReturn</span><span class="p">(</span><span class="s1">'ajax:before'</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC34'> <span class="kd">var</span> <span class="nx">data</span> <span class="o">=</span> <span class="nx">el</span><span class="p">.</span><span class="nx">is</span><span class="p">(</span><span class="s1">'form'</span><span class="p">)</span> <span class="o">?</span> <span class="nx">el</span><span class="p">.</span><span class="nx">serializeArray</span><span class="p">()</span> <span class="o">:</span> <span class="p">[];</span></div><div class='line' id='LC35'> <span class="nx">$</span><span class="p">.</span><span class="nx">ajax</span><span class="p">({</span></div><div class='line' id='LC36'> <span class="nx">url</span><span class="o">:</span> <span class="nx">url</span><span class="p">,</span></div><div class='line' id='LC37'> <span class="nx">data</span><span class="o">:</span> <span class="nx">data</span><span class="p">,</span></div><div class='line' id='LC38'> <span class="nx">dataType</span><span class="o">:</span> <span class="nx">dataType</span><span class="p">,</span></div><div class='line' id='LC39'> <span class="nx">type</span><span class="o">:</span> <span class="nx">method</span><span class="p">.</span><span class="nx">toUpperCase</span><span class="p">(),</span></div><div class='line' id='LC40'> <span class="nx">beforeSend</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">xhr</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC41'> <span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'ajax:loading'</span><span class="p">,</span> <span class="nx">xhr</span><span class="p">);</span></div><div class='line' id='LC42'> <span class="p">},</span></div><div class='line' id='LC43'> <span class="nx">success</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="nx">status</span><span class="p">,</span> <span class="nx">xhr</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC44'> <span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'ajax:success'</span><span class="p">,</span> <span class="p">[</span><span class="nx">data</span><span class="p">,</span> <span class="nx">status</span><span class="p">,</span> <span class="nx">xhr</span><span class="p">]);</span></div><div class='line' id='LC45'> <span class="p">},</span></div><div class='line' id='LC46'> <span class="nx">complete</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">xhr</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC47'> <span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'ajax:complete'</span><span class="p">,</span> <span class="nx">xhr</span><span class="p">);</span></div><div class='line' id='LC48'> <span class="p">},</span></div><div class='line' id='LC49'> <span class="nx">error</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">xhr</span><span class="p">,</span> <span class="nx">status</span><span class="p">,</span> <span class="nx">error</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC50'> <span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'ajax:failure'</span><span class="p">,</span> <span class="p">[</span><span class="nx">xhr</span><span class="p">,</span> <span class="nx">status</span><span class="p">,</span> <span class="nx">error</span><span class="p">]);</span></div><div class='line' id='LC51'> <span class="p">}</span></div><div class='line' id='LC52'> <span class="p">});</span></div><div class='line' id='LC53'> <span class="p">}</span></div><div class='line' id='LC54'><br/></div><div class='line' id='LC55'> <span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'ajax:after'</span><span class="p">);</span></div><div class='line' id='LC56'> <span class="p">}</span></div><div class='line' id='LC57'> <span class="p">}</span></div><div class='line' id='LC58'> <span class="p">});</span></div><div class='line' id='LC59'><br/></div><div class='line' id='LC60'> <span class="cm">/**</span></div><div class='line' id='LC61'><span class="cm"> * confirmation handler</span></div><div class='line' id='LC62'><span class="cm"> */</span></div><div class='line' id='LC63'> <span class="nx">$</span><span class="p">(</span><span class="s1">'a[data-confirm],input[data-confirm]'</span><span class="p">).</span><span class="nx">live</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC64'> <span class="kd">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">);</span></div><div class='line' id='LC65'> <span class="k">if</span> <span class="p">(</span><span class="nx">el</span><span class="p">.</span><span class="nx">triggerAndReturn</span><span class="p">(</span><span class="s1">'confirm'</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC66'> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">confirm</span><span class="p">(</span><span class="nx">el</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'data-confirm'</span><span class="p">)))</span> <span class="p">{</span></div><div class='line' id='LC67'> <span class="k">return</span> <span class="kc">false</span><span class="p">;</span></div><div class='line' id='LC68'> <span class="p">}</span></div><div class='line' id='LC69'> <span class="p">}</span></div><div class='line' id='LC70'> <span class="p">});</span></div><div class='line' id='LC71'><br/></div><div class='line' id='LC72'><br/></div><div class='line' id='LC73'> <span class="cm">/**</span></div><div class='line' id='LC74'><span class="cm"> * remote handlers</span></div><div class='line' id='LC75'><span class="cm"> */</span></div><div class='line' id='LC76'> <span class="nx">$</span><span class="p">(</span><span class="s1">'form[data-remote]'</span><span class="p">).</span><span class="nx">live</span><span class="p">(</span><span class="s1">'submit'</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC77'> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">callRemote</span><span class="p">();</span></div><div class='line' id='LC78'> <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span></div><div class='line' id='LC79'> <span class="p">});</span></div><div class='line' id='LC80'><br/></div><div class='line' id='LC81'> <span class="nx">$</span><span class="p">(</span><span class="s1">'a[data-remote],input[data-remote]'</span><span class="p">).</span><span class="nx">live</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC82'> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">callRemote</span><span class="p">();</span></div><div class='line' id='LC83'> <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span></div><div class='line' id='LC84'> <span class="p">});</span></div><div class='line' id='LC85'><br/></div><div class='line' id='LC86'> <span class="nx">$</span><span class="p">(</span><span class="s1">'a[data-method]:not([data-remote])'</span><span class="p">).</span><span class="nx">live</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">e</span><span class="p">){</span></div><div class='line' id='LC87'> <span class="kd">var</span> <span class="nx">link</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">),</span></div><div class='line' id='LC88'> <span class="nx">href</span> <span class="o">=</span> <span class="nx">link</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'href'</span><span class="p">),</span></div><div class='line' id='LC89'> <span class="nx">method</span> <span class="o">=</span> <span class="nx">link</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'data-method'</span><span class="p">),</span></div><div class='line' id='LC90'> <span class="nx">form</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="s1">'<form method="post" action="'</span><span class="o">+</span><span class="nx">href</span><span class="o">+</span><span class="s1">'"></form>'</span><span class="p">),</span></div><div class='line' id='LC91'> <span class="nx">metadata_input</span> <span class="o">=</span> <span class="s1">'<input name="_method" value="'</span><span class="o">+</span><span class="nx">method</span><span class="o">+</span><span class="s1">'" type="hidden" />'</span><span class="p">;</span></div><div class='line' id='LC92'><br/></div><div class='line' id='LC93'> <span class="k">if</span> <span class="p">(</span><span class="nx">csrf_param</span> <span class="o">!=</span> <span class="kc">null</span> <span class="o">&&</span> <span class="nx">csrf_token</span> <span class="o">!=</span> <span class="kc">null</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC94'> <span class="nx">metadata_input</span> <span class="o">+=</span> <span class="s1">'<input name="'</span><span class="o">+</span><span class="nx">csrf_param</span><span class="o">+</span><span class="s1">'" value="'</span><span class="o">+</span><span class="nx">csrf_token</span><span class="o">+</span><span class="s1">'" type="hidden" />'</span><span class="p">;</span></div><div class='line' id='LC95'> <span class="p">}</span></div><div class='line' id='LC96'><br/></div><div class='line' id='LC97'> <span class="nx">form</span><span class="p">.</span><span class="nx">hide</span><span class="p">()</span></div><div class='line' id='LC98'> <span class="p">.</span><span class="nx">append</span><span class="p">(</span><span class="nx">metadata_input</span><span class="p">)</span></div><div class='line' id='LC99'> <span class="p">.</span><span class="nx">appendTo</span><span class="p">(</span><span class="s1">'body'</span><span class="p">);</span></div><div class='line' id='LC100'><br/></div><div class='line' id='LC101'> <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span></div><div class='line' id='LC102'> <span class="nx">form</span><span class="p">.</span><span class="nx">submit</span><span class="p">();</span></div><div class='line' id='LC103'> <span class="p">});</span></div><div class='line' id='LC104'><br/></div><div class='line' id='LC105'> <span class="cm">/**</span></div><div class='line' id='LC106'><span class="cm"> * disable-with handlers</span></div><div class='line' id='LC107'><span class="cm"> */</span></div><div class='line' id='LC108'> <span class="kd">var</span> <span class="nx">disable_with_input_selector</span> <span class="o">=</span> <span class="s1">'input[data-disable-with]'</span><span class="p">;</span></div><div class='line' id='LC109'> <span class="kd">var</span> <span class="nx">disable_with_form_remote_selector</span> <span class="o">=</span> <span class="s1">'form[data-remote]:has('</span> <span class="o">+</span> <span class="nx">disable_with_input_selector</span> <span class="o">+</span> <span class="s1">')'</span><span class="p">;</span></div><div class='line' id='LC110'> <span class="kd">var</span> <span class="nx">disable_with_form_not_remote_selector</span> <span class="o">=</span> <span class="s1">'form:not([data-remote]):has('</span> <span class="o">+</span> <span class="nx">disable_with_input_selector</span> <span class="o">+</span> <span class="s1">')'</span><span class="p">;</span></div><div class='line' id='LC111'><br/></div><div class='line' id='LC112'> <span class="kd">var</span> <span class="nx">disable_with_input_function</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC113'> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">find</span><span class="p">(</span><span class="nx">disable_with_input_selector</span><span class="p">).</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC114'> <span class="kd">var</span> <span class="nx">input</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">);</span></div><div class='line' id='LC115'> <span class="nx">input</span><span class="p">.</span><span class="nx">data</span><span class="p">(</span><span class="s1">'enable-with'</span><span class="p">,</span> <span class="nx">input</span><span class="p">.</span><span class="nx">val</span><span class="p">())</span></div><div class='line' id='LC116'> <span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'value'</span><span class="p">,</span> <span class="nx">input</span><span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'data-disable-with'</span><span class="p">))</span></div><div class='line' id='LC117'> <span class="p">.</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'disabled'</span><span class="p">,</span> <span class="s1">'disabled'</span><span class="p">);</span></div><div class='line' id='LC118'> <span class="p">});</span></div><div class='line' id='LC119'> <span class="p">};</span></div><div class='line' id='LC120'><br/></div><div class='line' id='LC121'> <span class="nx">$</span><span class="p">(</span><span class="nx">disable_with_form_remote_selector</span><span class="p">).</span><span class="nx">live</span><span class="p">(</span><span class="s1">'ajax:before'</span><span class="p">,</span> <span class="nx">disable_with_input_function</span><span class="p">);</span></div><div class='line' id='LC122'> <span class="nx">$</span><span class="p">(</span><span class="nx">disable_with_form_not_remote_selector</span><span class="p">).</span><span class="nx">live</span><span class="p">(</span><span class="s1">'submit'</span><span class="p">,</span> <span class="nx">disable_with_input_function</span><span class="p">);</span></div><div class='line' id='LC123'><br/></div><div class='line' id='LC124'> <span class="nx">$</span><span class="p">(</span><span class="nx">disable_with_form_remote_selector</span><span class="p">).</span><span class="nx">live</span><span class="p">(</span><span class="s1">'ajax:complete'</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC125'> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">find</span><span class="p">(</span><span class="nx">disable_with_input_selector</span><span class="p">).</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC126'> <span class="kd">var</span> <span class="nx">input</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">);</span></div><div class='line' id='LC127'> <span class="nx">input</span><span class="p">.</span><span class="nx">removeAttr</span><span class="p">(</span><span class="s1">'disabled'</span><span class="p">)</span></div><div class='line' id='LC128'> <span class="p">.</span><span class="nx">val</span><span class="p">(</span><span class="nx">input</span><span class="p">.</span><span class="nx">data</span><span class="p">(</span><span class="s1">'enable-with'</span><span class="p">));</span></div><div class='line' id='LC129'> <span class="p">});</span></div><div class='line' id='LC130'> <span class="p">});</span></div><div class='line' id='LC131'><br/></div><div class='line' id='LC132'><span class="p">});</span></div><div class='line' id='LC133'><br/></div></pre></div>
|
630
|
-
|
631
|
-
</td>
|
632
|
-
</tr>
|
633
|
-
</table>
|
634
|
-
|
635
|
-
</div>
|
636
|
-
|
637
|
-
|
638
|
-
</div>
|
639
|
-
</div>
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
</div>
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
<div class="push"></div>
|
649
|
-
</div>
|
650
|
-
|
651
|
-
<div id="footer">
|
652
|
-
<div class="site">
|
653
|
-
<div class="info">
|
654
|
-
<div class="links">
|
655
|
-
<a href="http://github.com/blog"><b>Blog</b></a> |
|
656
|
-
<a href="http://support.github.com?sso=TDxTvZRHvZd68KlV2rHmsfEAZ_JRRHbzftEafzxD5zJWDxKJRQf4OEJkLKpbrUjuKY5eOUDLhpTpYp-VG6a-RigfYshu_qhqPpkkAfnSqx41LCk6NQ3upQ4yVW8QOVycqavs7mcBZ9cGqOFmPm7Sjxw9XZ7N4nRCI_AWJBWevonkmmRQs-glPPpzor1hAj0biQR86uJeH1fVOxbmEtPBjUxoEuWs1a7h4XWt1xSMA-A">Support</a> |
|
657
|
-
<a href="http://github.com/training">Training</a> |
|
658
|
-
<a href="http://jobs.github.com">Job Board</a> |
|
659
|
-
<a href="http://github.com/contact">Contact</a> |
|
660
|
-
<a href="http://develop.github.com">API</a> |
|
661
|
-
<a href="http://status.github.com">Status</a> |
|
662
|
-
<a href="http://twitter.com/github">Twitter</a> |
|
663
|
-
<a href="http://help.github.com">Help</a>
|
664
|
-
</div>
|
665
|
-
<div class="company">
|
666
|
-
©
|
667
|
-
2010
|
668
|
-
<span id="_rrt" title="0.09111s from fe4.rs.github.com">GitHub</span> Inc.
|
669
|
-
All rights reserved. |
|
670
|
-
<a href="/site/terms">Terms of Service</a> |
|
671
|
-
<a href="/site/privacy">Privacy Policy</a> |
|
672
|
-
<a href="http://github.com/security">Security</a>
|
673
|
-
</div>
|
674
|
-
</div>
|
675
|
-
<div class="sponsor">
|
676
|
-
<div>
|
677
|
-
Powered by the <a href="http://www.rackspace.com">Dedicated
|
678
|
-
Servers</a> and<br/> <a href="http://www.rackspacecloud.com">Cloud
|
679
|
-
Computing</a> of Rackspace Hosting<span>®</span>
|
680
|
-
</div>
|
681
|
-
<a href="http://www.rackspace.com">
|
682
|
-
<img alt="Dedicated Server" src="http://assets1.github.com/images/modules/footer/rackspace_logo.png?ad7093c760d70644206be97b3c0bc84a650562c3" />
|
683
|
-
</a>
|
684
|
-
</div>
|
685
|
-
</div>
|
686
|
-
</div>
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
<!-- current locale: en -->
|
692
|
-
<div class="locales">
|
693
|
-
<div class="site">
|
694
|
-
<ul class="choices">
|
695
|
-
|
696
|
-
|
697
|
-
<li><span class="current">English</span></li>
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
<li><a rel="nofollow" href="?locale=ca">Català</a></li>
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
<li><a rel="nofollow" href="?locale=cs">Čeština</a></li>
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
<li><a rel="nofollow" href="?locale=de">Deutsch</a></li>
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
<li><a rel="nofollow" href="?locale=es">Español</a></li>
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
<li><a rel="nofollow" href="?locale=fr">Français</a></li>
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
<li><a rel="nofollow" href="?locale=hr">Hrvatski</a></li>
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
<li><a rel="nofollow" href="?locale=id">Indonesia</a></li>
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
<li><a rel="nofollow" href="?locale=it">Italiano</a></li>
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
<li><a rel="nofollow" href="?locale=ja">日本語</a></li>
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
<li><a rel="nofollow" href="?locale=nl">Nederlands</a></li>
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
<li><a rel="nofollow" href="?locale=no">Norsk</a></li>
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
<li><a rel="nofollow" href="?locale=pl">Polski</a></li>
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
<li><a rel="nofollow" href="?locale=pt-BR">Português (BR)</a></li>
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
<li><a rel="nofollow" href="?locale=sr">Српски</a></li>
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
<li><a rel="nofollow" href="?locale=sv">Svenska</a></li>
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
<li><a rel="nofollow" href="?locale=zh">中文</a></li>
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
</ul>
|
797
|
-
</div>
|
798
|
-
</div>
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
<script>window._auth_token = "6ab3c45cc14437552e32f8a00c3f92831638ffae"</script>
|
803
|
-
|
804
|
-
|
805
|
-
<script type="text/javascript">
|
806
|
-
_kmq.push(['trackClick', 'entice_banner_link', 'Entice banner clicked']);
|
807
|
-
|
808
|
-
</script>
|
809
|
-
|
810
|
-
</body>
|
811
|
-
</html>
|
812
|
-
|
1
|
+
jQuery(function ($) {
|
2
|
+
var csrf_token = $('meta[name=csrf-token]').attr('content'),
|
3
|
+
csrf_param = $('meta[name=csrf-param]').attr('content');
|
4
|
+
|
5
|
+
$.fn.extend({
|
6
|
+
/**
|
7
|
+
* Triggers a custom event on an element and returns the event result
|
8
|
+
* this is used to get around not being able to ensure callbacks are placed
|
9
|
+
* at the end of the chain.
|
10
|
+
*
|
11
|
+
* TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our
|
12
|
+
* own events and placing ourselves at the end of the chain.
|
13
|
+
*/
|
14
|
+
triggerAndReturn: function (name, data) {
|
15
|
+
var event = new $.Event(name);
|
16
|
+
this.trigger(event, data);
|
17
|
+
|
18
|
+
return event.result !== false;
|
19
|
+
},
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Handles execution of remote calls firing overridable events along the way
|
23
|
+
*/
|
24
|
+
callRemote: function () {
|
25
|
+
var el = this,
|
26
|
+
method = el.attr('method') || el.attr('data-method') || 'GET',
|
27
|
+
url = el.attr('action') || el.attr('href'),
|
28
|
+
dataType = el.attr('data-type') || 'script';
|
29
|
+
|
30
|
+
if (url === undefined) {
|
31
|
+
throw "No URL specified for remote call (action or href must be present).";
|
32
|
+
} else {
|
33
|
+
if (el.triggerAndReturn('ajax:before')) {
|
34
|
+
var data = el.is('form') ? el.serializeArray() : [];
|
35
|
+
$.ajax({
|
36
|
+
url: url,
|
37
|
+
data: data,
|
38
|
+
dataType: dataType,
|
39
|
+
type: method.toUpperCase(),
|
40
|
+
beforeSend: function (xhr) {
|
41
|
+
el.trigger('ajax:loading', xhr);
|
42
|
+
},
|
43
|
+
success: function (data, status, xhr) {
|
44
|
+
el.trigger('ajax:success', [data, status, xhr]);
|
45
|
+
},
|
46
|
+
complete: function (xhr) {
|
47
|
+
el.trigger('ajax:complete', xhr);
|
48
|
+
},
|
49
|
+
error: function (xhr, status, error) {
|
50
|
+
el.trigger('ajax:failure', [xhr, status, error]);
|
51
|
+
}
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
el.trigger('ajax:after');
|
56
|
+
}
|
57
|
+
}
|
58
|
+
});
|
59
|
+
|
60
|
+
/**
|
61
|
+
* confirmation handler
|
62
|
+
*/
|
63
|
+
$('a[data-confirm],input[data-confirm]').live('click', function () {
|
64
|
+
var el = $(this);
|
65
|
+
if (el.triggerAndReturn('confirm')) {
|
66
|
+
if (!confirm(el.attr('data-confirm'))) {
|
67
|
+
return false;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
|
73
|
+
/**
|
74
|
+
* remote handlers
|
75
|
+
*/
|
76
|
+
$('form[data-remote]').live('submit', function (e) {
|
77
|
+
$(this).callRemote();
|
78
|
+
e.preventDefault();
|
79
|
+
});
|
80
|
+
|
81
|
+
$('a[data-remote],input[data-remote]').live('click', function (e) {
|
82
|
+
$(this).callRemote();
|
83
|
+
e.preventDefault();
|
84
|
+
});
|
85
|
+
|
86
|
+
$('a[data-method]:not([data-remote])').live('click', function (e){
|
87
|
+
var link = $(this),
|
88
|
+
href = link.attr('href'),
|
89
|
+
method = link.attr('data-method'),
|
90
|
+
form = $('<form method="post" action="'+href+'"></form>'),
|
91
|
+
metadata_input = '<input name="_method" value="'+method+'" type="hidden" />';
|
92
|
+
|
93
|
+
if (csrf_param != null && csrf_token != null) {
|
94
|
+
metadata_input += '<input name="'+csrf_param+'" value="'+csrf_token+'" type="hidden" />';
|
95
|
+
}
|
96
|
+
|
97
|
+
form.hide()
|
98
|
+
.append(metadata_input)
|
99
|
+
.appendTo('body');
|
100
|
+
|
101
|
+
e.preventDefault();
|
102
|
+
form.submit();
|
103
|
+
});
|
104
|
+
|
105
|
+
/**
|
106
|
+
* disable-with handlers
|
107
|
+
*/
|
108
|
+
var disable_with_input_selector = 'input[data-disable-with]';
|
109
|
+
var disable_with_form_remote_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')';
|
110
|
+
var disable_with_form_not_remote_selector = 'form:not([data-remote]):has(' + disable_with_input_selector + ')';
|
111
|
+
|
112
|
+
var disable_with_input_function = function () {
|
113
|
+
$(this).find(disable_with_input_selector).each(function () {
|
114
|
+
var input = $(this);
|
115
|
+
input.data('enable-with', input.val())
|
116
|
+
.attr('value', input.attr('data-disable-with'))
|
117
|
+
.attr('disabled', 'disabled');
|
118
|
+
});
|
119
|
+
};
|
120
|
+
|
121
|
+
$(disable_with_form_remote_selector).live('ajax:before', disable_with_input_function);
|
122
|
+
$(disable_with_form_not_remote_selector).live('submit', disable_with_input_function);
|
123
|
+
|
124
|
+
$(disable_with_form_remote_selector).live('ajax:complete', function () {
|
125
|
+
$(this).find(disable_with_input_selector).each(function () {
|
126
|
+
var input = $(this);
|
127
|
+
input.removeAttr('disabled')
|
128
|
+
.val(input.data('enable-with'));
|
129
|
+
});
|
130
|
+
});
|
131
|
+
|
132
|
+
});
|
metadata
CHANGED
@@ -6,11 +6,11 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 1
|
7
7
|
- 4
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.4.2.
|
9
|
+
- b2
|
10
|
+
version: 1.4.2.b2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
-
|
13
|
+
- Allan Davis
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
@@ -20,7 +20,7 @@ default_executable:
|
|
20
20
|
dependencies: []
|
21
21
|
|
22
22
|
description: Jquery generator for rails 3
|
23
|
-
email:
|
23
|
+
email: javaalley@gmail.com
|
24
24
|
executables: []
|
25
25
|
|
26
26
|
extensions: []
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- lib/generators/jquery_install/templates/themes/smoothness/jquery.ui.core.css
|
206
206
|
- lib/generators/jquery_install/templates/themes/smoothness/jquery.ui.datepicker.css
|
207
207
|
- lib/generators/jquery_install/templates/jquery-1.4.2.js
|
208
|
+
- lib/generators/jquery_install/templates/layout.html.erb
|
208
209
|
- lib/generators/jquery_install/templates/rails.js
|
209
210
|
has_rdoc: true
|
210
211
|
homepage:
|