thin_man 0.20.3 → 0.20.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f3a3149a78c919863fc40928cbed440b12e8adbf944532241fd460c5ff8c77a
4
- data.tar.gz: a328ba03fef1ea832ff05f9e1fefd7338234b6df4818a53bf3f87858605a30c2
3
+ metadata.gz: 40dff39c348f32f4f43c034eb305c87691abcd113a50cb618248a3e28ef0b023
4
+ data.tar.gz: 90ae3bf0fb8632f36988681b4dfeef6adbc0c3d69bca16f4396afebcddb1924b
5
5
  SHA512:
6
- metadata.gz: 297ff75de6284081cd2f5bde87ce29c30435a4f516df7f8c7d92a55d4b7c81a4bd4bb9577b5a8d1fdd0550160442a6f3132bc7b7e8e14c6393790b1dd01937b6
7
- data.tar.gz: 5353f964208f3ad3aaeedf891aab222d4f735c9baf95a59579811252564ab2e52e908c5abdfd97081f779bf44c5676943c7b6c6e31eca762f93f6d88bd028de5
6
+ metadata.gz: 8c92fb9b47e882d1aa7cb4006086367519b8eaec37f12f4cf4a8e8f8657b74028c175f0855ce77379f9927227bdd9777ee201a70dfcb8a2907080a8b9efcaa83
7
+ data.tar.gz: a06040297179ba28373aefd2cc77344866995cd34f629c961875bda0186e65e9c89766c36bce77d3cdee294a85f56b916e578a6d623050d0c366eedddcf50980
@@ -131,12 +131,12 @@ var initThinMan = function() {
131
131
  }
132
132
  },
133
133
  getTarget: function() {
134
- var target_selector = this.jq_obj.data('ajax-target');
135
- if (target_selector) {
136
- if ($(target_selector).length > 0) {
137
- this.target = $(target_selector);
134
+ this.target_selector = this.jq_obj.data('ajax-target');
135
+ if (this.target_selector) {
136
+ if ($(this.target_selector).length > 0) {
137
+ this.target = $(this.target_selector);
138
138
  } else {
139
- console.log('Warning! Thin Man selector ' + target_selector + ' not found')
139
+ console.log('Warning! Thin Man selector ' + this.target_selector + ' not found')
140
140
  }
141
141
  } else {
142
142
  console.log('Warning! Thin Man selector not given')
@@ -283,14 +283,16 @@ var initThinMan = function() {
283
283
  this.replacement_path = this.replacement_path.slice(1)
284
284
  }
285
285
  var new_url = [location.protocol, '//', location.host, '/', this.replacement_path].join('')
286
- history['replaceState']({}, null, new_url);
286
+ var new_path = '/' + this.replacement_path
287
+ history['replaceState']({path: new_path, target: this.target_selector, thin_man: true}, null, new_url);
287
288
  },
288
- handlePushState: function(){
289
+ handlePushState: function(){//TODO must implement onPopState handler which is commented out below
289
290
  if('/' === this.push_path[0]){
290
291
  this.push_path = this.push_path.slice(1)
291
292
  }
292
293
  var new_url = [location.protocol, '//', location.host, '/', this.push_path].join('')
293
- history['pushState']({path: ('/' + this.push_path), target: this.target}, null, new_url);
294
+ var new_path = '/' + this.push_path
295
+ history['pushState']({path: new_path, target: this.target_selector, thin_man: true}, null, new_url);
294
296
 
295
297
  },
296
298
  addWatcher: function(watcher) {
@@ -888,16 +890,23 @@ var initThinMan = function() {
888
890
  new thin_man.AjaxSorter($(this));
889
891
  });
890
892
 
891
- $(window).bind("popstate", function(e){
892
- $('[data-thin-man-back-link]').remove()
893
- var previous_state = e.originalEvent.state
894
- var $back_link = $('<div>').
895
- css({display: 'none'}).
896
- attr('data-ajax-target',previous_state.target).
897
- attr('href',previous_state.path).
898
- attr('data-thin-man-back-link',true)
899
- new AjaxLinkSubmission($back_link)
900
- })
893
+ // TODO, make this work to reload content when history changes to previous content loaded by thin_man
894
+ // and recorded in browser history with pustState
895
+ // $(window).bind("popstate", function(e){
896
+ // $('[data-thin-man-back-link]').remove()
897
+ // var previous_state = e.originalEvent.state
898
+ // if(previous_state.thin_man && previous_state.path && previous_state.target){
899
+ // if($(previous_state.target).length > 0){
900
+ // var $this_target = $(previous_state.target)
901
+ // }
902
+ // var $reload_link = $('<div>').
903
+ // css({display: 'none'}).
904
+ // attr('data-ajax-target',$this_target).
905
+ // attr('href',previous_state.path).
906
+ // attr('data-thin-man-back-link',true)
907
+ // new thin_man.AjaxLinkSubmission($reload_link)
908
+ // }
909
+ // })
901
910
 
902
911
  });
903
912
 
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.20.3"
2
+ VERSION = "0.20.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thin_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.3
4
+ version: 0.20.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut, Adam Bialek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-30 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails