ajaxify_rails 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,7 +5,7 @@ No more full page reloads for your Rails app! Yay!
5
5
  Automatically makes your app loading content in the background via ajax.
6
6
 
7
7
  Works by turning all internal links into ajax links that trigger an update of the page's content area.
8
- Also form submission are automatically turned into ajax requests.
8
+ Also form submissions are automatically turned into ajax requests.
9
9
 
10
10
  Features:
11
11
 
@@ -5,9 +5,9 @@ Gem::Specification.new do |gem|
5
5
  gem.authors = ["Nico Ritsche"]
6
6
  gem.email = ["ncrdevmail@gmail.com"]
7
7
  gem.description = %q{Automatically makes your Rails app loading content in the background via ajax. Works by turning all internal links into
8
- ajax links that trigger an update of the page's content area. Also form submission are automatically turned into ajax requests.
8
+ ajax links that trigger an update of the page's content area. Also form submissions are automatically turned into ajax requests.
9
9
  Uses the html5 history interface for changing the url and making the browser's back and forward buttons working with ajax.
10
- Falls back to a hash based approach for browsers without the history interface (like Internet Explorer).
10
+ Falls back to a hash based approach for browsers without the history interface (like Internet Explorer <10).
11
11
  Transparently handles redirects and supports flash messages and page titles. Requires Ruby 1.9 and the asset pipeline.}
12
12
  gem.summary = %q{Rails gem for automatically turning internal links/forms into ajax links/forms that load content without a full page reload.}
13
13
  gem.homepage = "https://github.com/ncri/ajaxify_rails"
@@ -1,3 +1,3 @@
1
1
  module AjaxifyRails
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -81,7 +81,6 @@
81
81
 
82
82
 
83
83
  window.onhashchange = ->
84
- self.hash_changed = true
85
84
  if window.location.hash.indexOf('#/') == 0 # only react to hash changes if hash starts with '/'
86
85
  unless self.ignore_hash_change
87
86
  self.on_hash_change()
@@ -93,9 +92,9 @@
93
92
  url = window.location.hash.replace(/#/, "")
94
93
  if url == ''
95
94
  url = '/'
95
+ this.hash_changed = true
96
96
  this.load
97
97
  url: url
98
- self.hash_changed = false
99
98
 
100
99
 
101
100
  load: (options, pop_state = false) ->
@@ -165,7 +164,11 @@
165
164
  options.url = current_url.replace(/(&|\?)ajaxify_redirect=true/,'')
166
165
  options.type = 'GET'
167
166
 
168
- this.update_url options, pop_state
167
+ if not this.hash_changed # no need to update url if the ajax call resulted in a hash change
168
+ this.update_url options, pop_state
169
+ else
170
+ this.hash_changed = false
171
+
169
172
 
170
173
  if this.handle_extra_content
171
174
  this.handle_extra_content()
@@ -212,7 +215,7 @@
212
215
  hash = hash.replace(base_path_regexp, '')
213
216
  hash = "/#{hash}" unless hash == '' or hash.indexOf('/') == 0
214
217
  window.location.hash = hash
215
- this.ignore_hash_change = false
218
+ # this.ignore_hash_change = false
216
219
 
217
220
 
218
221
  base_path_regexp: ->
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.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -29,11 +29,11 @@ dependencies:
29
29
  version: 3.1.0
30
30
  description: ! "Automatically makes your Rails app loading content in the background
31
31
  via ajax. Works by turning all internal links into\n ajax
32
- links that trigger an update of the page's content area. Also form submission are
32
+ links that trigger an update of the page's content area. Also form submissions are
33
33
  automatically turned into ajax requests.\n Uses the html5
34
34
  history interface for changing the url and making the browser's back and forward
35
35
  buttons working with ajax.\n Falls back to a hash based
36
- approach for browsers without the history interface (like Internet Explorer).\n
36
+ approach for browsers without the history interface (like Internet Explorer <10).\n
37
37
  \ Transparently handles redirects and supports flash messages
38
38
  and page titles. Requires Ruby 1.9 and the asset pipeline."
39
39
  email:
@@ -67,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
67
  version: '0'
68
68
  segments:
69
69
  - 0
70
- hash: 2597256401823922837
70
+ hash: 1242994439653128660
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  segments:
78
78
  - 0
79
- hash: 2597256401823922837
79
+ hash: 1242994439653128660
80
80
  requirements: []
81
81
  rubyforge_project:
82
82
  rubygems_version: 1.8.24