SrBuj 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGE1ZTk5OTFiZGU2YjM0MDJkYjBjNGQ5ZTBlNjE0ODgwODNhOGNiOA==
4
+ YWNjYjYwMjIxNzIzMDk5Y2I2NWU3ZDBkN2RmYjdkM2IyZmYwYWZiNg==
5
5
  data.tar.gz: !binary |-
6
- Y2UxMWUwNDgwMmM5OTdiYjIxOTg4N2YyNmNiOGQyNmM2ZjRhYzdkNA==
6
+ ZWY2YWYxMTQxN2YyYWNhODY0NWEzMThlN2ZkZmM5NGM5ZWY2YjM1NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YTMwNTMwMDY4ZDhmZDI2YjI1OWFmZTcyYmMxN2M2ZTY2YTI2YzhiYTNiOTZi
10
- YmQ0ZDQ5NWU3MDkzOTNlNjdlMzMwZTNjYzY2ODVkNjhhMGY5YmE5ZjQ5MmRm
11
- MDdiNDIyZGUwNTRiY2NjMjY3ZTRhMTE1NDhiMzkzMzQ5YmI1ZjM=
9
+ NWI2NWRlMTJmNWFmZGRiZTIxMWJmNjNmYWVjY2Y1NzJmNGViYWRhYTYyZTE3
10
+ ZTQxNjhkYjdkZDk4ZDNlNGI3MDQ3ODk3OTg2MDhhZjllOTlmZDUxNzc5MWRm
11
+ MTM1NjljMjRkN2IzNjM1NGNhMTdkZTgzMzhmZTc0OWQxYjQwMjU=
12
12
  data.tar.gz: !binary |-
13
- Y2Q5N2U5OTMwNjkzYzQ4ZDlmYWZlYzUwYjhiZjhlOTYyNjg0MTVkMWFhOTRm
14
- YWYzYWIyNGMzZGMxOTE0NzA1ZDJmYjA5NzliNTdmNTYzZmNlMWQyNTc3YjJk
15
- MzM5MzlkMjgxZWM2Y2RjNzQyMjU0MDc0YWZhYWRkOTY0NGZlNmY=
13
+ NTVlMWY1YWMzODM4YTA4NzllZGU1MWVlNjA1OTM5Njg1M2VmY2FhNmEwMmY2
14
+ MmZlYjFmMzBjN2NiYTQ2ZmQwMjgyOTMyMjQ5MDI0YjM5ZGRlMmQ2ODJmNjBj
15
+ NGMzZWZlYTk3NzM2NzJmMTBkOTUxOTNkNDJkNWMwMGIxOThmNzE=
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  SrBuj
2
2
  =
3
3
 
4
- Better Unobtrusive JavaScript Request (for Rails and jquery_ujs, twitter/bootstrap modal.js)
4
+ Better Unobtrusive JavaScript Respond (for Rails and jquery_ujs, twitter/bootstrap modal.js)
5
5
 
6
6
  SrBuj comes to cure a common illness in a life of every Rails developer (maybe other kind too):
7
7
  - write the same code to rise up a modal
data/lib/SrBuj/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SrBuj
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
@@ -13,7 +13,7 @@
13
13
  };
14
14
  var SrBuj;
15
15
  $.SrBuj = SrBuj = {
16
- version: '0.6.0',
16
+ version: '0.6.1',
17
17
  selector: '[data-remote][data-target]',
18
18
  defaults: {
19
19
  '$el': undefined,
@@ -46,6 +46,13 @@
46
46
  }
47
47
 
48
48
  },
49
+ kindOfCallback: function(callback){
50
+ if(typeof callback == 'function'){
51
+ return callback
52
+ }else{
53
+ return window[callback] || new Function(callback);
54
+ }
55
+ },
49
56
  getVerb: function($el){
50
57
  var respond_as = $el.data('respond-as'),
51
58
  dataVerb = $el.data('method'),
@@ -94,11 +101,13 @@
94
101
  if(options['modal'])
95
102
  options['wrapper'] ? $wrapper.modal('toggle') : $target.modal('toggle');
96
103
  }
97
- if(options['callback'])
98
- callback = (typeof options['callback'] == 'function') ? options['callback'] : window[options['callback']],
99
- callback.apply(this,[e, data, status]);
104
+ if(options['callback']){
105
+ callback = $.SrBuj.kindOfCallback(options['callback']);
106
+ if(callback) callback.apply(this,[e, data, status]);
107
+ }
100
108
  }
101
109
  },
110
+
102
111
  fail: function(e, data, status, user_options){
103
112
  e.stopPropagation();
104
113
  var $el = $(e.target).present(),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SrBuj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - gagoar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-05 00:00:00.000000000 Z
11
+ date: 2013-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: Better Unobtrusive JavaScript Request in asset pipeline
69
+ description: Better Unobtrusive JavaScript Respond
70
70
  email:
71
71
  - xeroice@gmail.com
72
72
  executables: []