wiselinks 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.5.3
@@ -14,6 +14,7 @@ class Wiselinks
14
14
  self = this
15
15
 
16
16
  @options = jQuery.extend(self._defaults(), @options);
17
+ @template_id = new Date().getTime()
17
18
 
18
19
  if self.enabled()
19
20
  @assets_digest = $("meta[name='assets-digest']").attr("content")
@@ -28,9 +29,12 @@ class Wiselinks
28
29
  History.Adapter.bind(
29
30
  window,
30
31
  "statechange"
31
- (event, data) ->
32
- state = History.getState()
33
- self._call(state.url, state.data.target, state.data.render)
32
+ (event, data) ->
33
+ state = History.getState()
34
+ if self._template_id_changed(state)
35
+ self._call(state.url, null, 'template')
36
+ else
37
+ self._call(state.url, state.data.target, state.data.render)
34
38
  )
35
39
 
36
40
  $(document).on(
@@ -57,10 +61,11 @@ class Wiselinks
57
61
  !History.emulated.pushState || @options.html4 == true
58
62
 
59
63
  load: (url, target, render = 'template') ->
60
- History.pushState({ timestamp: (new Date().getTime()), render: render, target: target }, document.title, url )
64
+ @template_id = new Date().getTime() if render != 'partial'
65
+ History.pushState({ template_id: @template_id, render: render, target: target }, document.title, url )
61
66
 
62
- reload: () ->
63
- History.replaceState({ timestamp: (new Date().getTime()), render: 'template' }, document.title, History.getState().url )
67
+ reload: () ->
68
+ History.replaceState({ template_id: @template_id, render: 'template' }, document.title, History.getState().url )
64
69
 
65
70
  _defaults: ->
66
71
  html4: true
@@ -157,6 +162,9 @@ class Wiselinks
157
162
  _assets_changed: (digest) ->
158
163
  @assets_digest? && @assets_digest != digest
159
164
 
165
+ _template_id_changed: (state) ->
166
+ !state.data.template_id? || state.data.template_id != @template_id
167
+
160
168
  _set_title: (xhr) ->
161
169
  value = xhr.getResponseHeader('X-Wiselinks-Title')
162
170
  document.title = decodeURI(value) if value?
data/wiselinks.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "wiselinks"
8
- s.version = "0.5.2"
8
+ s.version = "0.5.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Igor Alexandrov", "Alexey Solilin", "Julia Egorova"]
12
- s.date = "2013-02-22"
12
+ s.date = "2013-02-24"
13
13
  s.email = "igor.alexandrov@gmail.com"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
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.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-02-22 00:00:00.000000000 Z
14
+ date: 2013-02-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: shoulda
@@ -187,7 +187,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  segments:
189
189
  - 0
190
- hash: 4413024695425373985
190
+ hash: 933560943679734063
191
191
  required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  none: false
193
193
  requirements: