wiselinks 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wiselinks (0.6.1)
4
+ wiselinks (0.6.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -6,9 +6,9 @@ class RequestManager
6
6
 
7
7
  # If been redirected, just trigger event and exit
8
8
  #
9
- if @redirected
10
- self._handle_redirect($target, state)
11
- return
9
+ if @redirected?
10
+ @redirected = null
11
+ return
12
12
 
13
13
  # Trigger loading event
14
14
  #
@@ -24,14 +24,15 @@ class RequestManager
24
24
 
25
25
  dataType: "html"
26
26
  ).done(
27
- (data, status, xhr) ->
27
+ (data, status, xhr) ->
28
28
  url = xhr.getResponseHeader('X-Wiselinks-Url')
29
29
 
30
30
  if self._assets_changed(xhr.getResponseHeader('X-Wiselinks-Assets-Digest'))
31
31
  window.location.reload(true)
32
32
  else
33
- if url? && url != window.location.href
34
- self._redirect_to(url, xhr)
33
+ state = History.getState()
34
+ if url? && url != state.url
35
+ self._redirect_to(url, $target, state, xhr)
35
36
 
36
37
  $target.html(data)
37
38
 
@@ -48,20 +49,14 @@ class RequestManager
48
49
  _assets_changed: (digest) ->
49
50
  @options.assets_digest? && @options.assets_digest != digest
50
51
 
51
- _handle_redirect: ($target, state) ->
52
- $(document).trigger('page:redirected', [$target, state.data.render, state.url])
53
- @redirected = null
54
-
55
- _redirect_to: (url, xhr) ->
52
+ _redirect_to: (url, $target, state, xhr) ->
56
53
  if ( xhr && xhr.readyState < 4)
57
54
  xhr.onreadystatechange = $.noop
58
55
  xhr.abort()
59
-
60
- @redirected = true
61
56
 
62
- this._title('Redirecting…')
63
- History.replaceState(History.getState().data, document.title, url )
64
-
57
+ @redirected = true
58
+ $(document).trigger('page:redirected', [$target, state.data.render, url])
59
+ History.replaceState(state.data, document.title, url)
65
60
 
66
61
  _loading: ($target, state) ->
67
62
  $(document).trigger('page:loading', [$target, state.data.render, state.url])
@@ -78,7 +73,7 @@ class RequestManager
78
73
  _title: (value) ->
79
74
  if value?
80
75
  $(document).trigger('page:title', decodeURI(value))
81
- document.title = decodeURI(value) if value?
76
+ document.title = decodeURI(value)
82
77
 
83
78
 
84
79
  window._Wiselinks = {} if window._Wiselinks == undefined
@@ -5,12 +5,12 @@
5
5
  #= require _form
6
6
 
7
7
  class Wiselinks
8
- constructor: ($target = $('body'), options = {}) ->
8
+ constructor: ($target = $('body'), @options = {}) ->
9
9
  this._try_jquery()
10
10
 
11
- if this.enabled()
12
- options = $.extend(this._defaults(), options)
13
- @page = new _Wiselinks.Page($target, options)
11
+ @options = $.extend(this._defaults(), @options)
12
+ if this.enabled()
13
+ @page = new _Wiselinks.Page($target, @options)
14
14
 
15
15
  enabled: ->
16
16
  !History.emulated.pushState || @options.html4 == true
@@ -4,7 +4,7 @@ module Wiselinks
4
4
  module Version
5
5
  MAJOR = 0
6
6
  MINOR = 6
7
- PATCH = 1
7
+ PATCH = 2
8
8
  BUILD = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiselinks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-06-01 00:00:00.000000000 Z
15
+ date: 2013-06-02 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -368,7 +368,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
368
368
  version: '0'
369
369
  segments:
370
370
  - 0
371
- hash: -2703865657821195857
371
+ hash: 515463621627356025
372
372
  required_rubygems_version: !ruby/object:Gem::Requirement
373
373
  none: false
374
374
  requirements:
@@ -377,7 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
377
377
  version: '0'
378
378
  segments:
379
379
  - 0
380
- hash: -2703865657821195857
380
+ hash: 515463621627356025
381
381
  requirements: []
382
382
  rubyforge_project:
383
383
  rubygems_version: 1.8.24