thin_man 0.5.0 → 0.5.1

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
  SHA1:
3
- metadata.gz: 3df271cf5579e78ca64f45ad02137ff51dfd0d52
4
- data.tar.gz: 03837270de0433fb89ad6d1c2f843a78b6a5429a
3
+ metadata.gz: 21880e46cee518e36db9a42e3c6046921b6fa447
4
+ data.tar.gz: da2ca97fd8682becbf27a89e3a901553ef57039d
5
5
  SHA512:
6
- metadata.gz: 3e25535df17c5a19fc50e139dc06b377367d498103fa16b23227eb7ae085a59d118647fd5676144c6b60ae01ccb73e28921984be641670bfac4e84a51691fa5e
7
- data.tar.gz: 651af586b67e8a8bbcbc20cdc8be1e3d1bcf31c5df1b878fd3bdd9f5d64daa287e9652d98d2b00d2ef3b16071c183ea600b65ec3040c7fa7a20c403928c43635
6
+ metadata.gz: 2409a26ed5b90189bbb9c443f7bec8ce15a5ce0f7fed0401dc4b7237999f319981168c3b6188af9ccbb88e4120deb3d5a951d37bd94c34febc4b2d84d4763ab1
7
+ data.tar.gz: 586b18983d446b3642bbb92a13cd34282647ed35ad513bc388b433c0c4866c8e765b1f850d67c0ef74a83c7a32492d99b3f97967437a240ac12ca397b6b1326b
@@ -27,8 +27,10 @@ function addUrlParams(url,params){
27
27
  };
28
28
 
29
29
  var AjaxSubmission = Class.extend({
30
- init: function(jq_obj){
30
+ init: function(jq_obj,params){
31
31
  this.jq_obj = jq_obj;
32
+ this.params = params;
33
+ if(!this.params){ this.params = {}}
32
34
  this.getTrigger();
33
35
  this.getTarget();
34
36
  this.getErrorTarget();
@@ -142,6 +144,9 @@ var AjaxSubmission = Class.extend({
142
144
  new AjaxFlash(flash_style, response_data.flash_message,this.jq_obj);
143
145
  }
144
146
  }
147
+ if('function' == typeof this.params.on_complete){
148
+ this.params.on_complete()
149
+ }
145
150
  },
146
151
  ajaxBefore: function(jqXHr) {
147
152
  this.toggleLoading();
@@ -303,7 +308,7 @@ var AjaxLinkSubmission = AjaxSubmission.extend({
303
308
  return this_data
304
309
  },
305
310
  getAjaxType: function(){
306
- return this.jq_obj.data('method') || 'GET'
311
+ return this.jq_obj.data('ajax-method') || 'GET'
307
312
  },
308
313
  getTrigger: function(){
309
314
  this.trigger = this.jq_obj;
@@ -424,7 +429,7 @@ var AjaxSorter = Class.extend({
424
429
 
425
430
  var AjaxPushState = Class.extend({
426
431
  init: function(obj) {
427
- if (obj.data('push-state') != null && obj.data('push-state') != "") {
432
+ if (obj.data('push-state') != null && obj.data('push-state') != "" && !obj.data('tab-trigger')) {
428
433
  history.pushState(null, null, obj.data('push-state'));
429
434
  }
430
435
  }
@@ -451,6 +456,11 @@ $(document).ready(function(){
451
456
  var deletion = new this_class($(this));
452
457
  });
453
458
 
459
+ $(document).on('click', '[data-change-url]',function(e){
460
+ e.preventDefault();
461
+ new AjaxPushState($(this))
462
+ })
463
+
454
464
  $('[data-sortable]').each(function(){
455
465
  new AjaxSorter($(this));
456
466
  });
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
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.5.0
4
+ version: 0.5.1
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: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails