ajaxify_rails 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -34,7 +34,6 @@ module ActionControllerAdditions
|
|
34
34
|
flash[key] = nil
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
37
|
extra_content = ajaxify_extra_content
|
39
38
|
|
40
39
|
super args
|
@@ -49,10 +48,16 @@ module ActionControllerAdditions
|
|
49
48
|
id: 'ajaxify_content', style: 'display:none',
|
50
49
|
data: { page_title: page_title,
|
51
50
|
flashes: flashes.to_json } )
|
52
|
-
response.body =
|
51
|
+
response.body = response_body[0]
|
53
52
|
return
|
54
53
|
end
|
55
54
|
super
|
55
|
+
# Correcting urls for non histori api browsers wont work for post requests so add a meta tag to the response body to communicate this to
|
56
|
+
# the ajaxify javascript
|
57
|
+
if request.post? and not request.xhr?
|
58
|
+
response.body = response_body[0].sub('<head>', "<head>\n <meta name='ajaxify:dont_correct_url' content='true'>")
|
59
|
+
end
|
60
|
+
return
|
56
61
|
end
|
57
62
|
|
58
63
|
|
@@ -241,7 +241,7 @@ correct_url = ->
|
|
241
241
|
else
|
242
242
|
path = match[0].replace(/\?/,'') + '#'
|
243
243
|
else
|
244
|
-
path = "#{match[0].replace(/\/$/,'')}#/#{window.location.pathname.replace(match[0],'')}"
|
244
|
+
path = "#{match[0].replace(/\/$/,'')}#/#{window.location.pathname.replace(match[0],'')}"
|
245
245
|
else if window.location.pathname == '/'
|
246
246
|
if window.location.search != ''
|
247
247
|
window.location.href = "#{protocol_with_host()}/#/#{window.location.search}" # move search behind #
|
@@ -256,7 +256,7 @@ init = (options = {}) ->
|
|
256
256
|
flash_types = options.flash_types if 'flash_types' of options
|
257
257
|
active = options.active if 'active' of options
|
258
258
|
content_container = options.content_container if 'content_container' of options
|
259
|
-
correct_url() unless 'dont_correct_url'
|
259
|
+
correct_url() unless $('meta[name="ajaxify:dont_correct_url"]').length > 0
|
260
260
|
|
261
261
|
#
|
262
262
|
# utility functions
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ajaxify_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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: 2013-
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|