thin_man 0.13.0 → 0.14.0

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: 87711557897ed02cc919dca89d0247eafeb8c3fd
4
- data.tar.gz: 275053997334c8b1628635c3ab95494b0de31cc3
3
+ metadata.gz: 770d8ac8603108fd26ebb9283f9e74701bb77b5d
4
+ data.tar.gz: c65b486c253925376e1ee80cc5cdc422ae73dfe9
5
5
  SHA512:
6
- metadata.gz: e82988c3cb2edaafa892b1856b9b327b9cf8eaa8321e80c246d79f67a5d28030aeae79e728255f552269362911a7b9a7055bfafbd1dcbd3cc12f1ffc098e8b60
7
- data.tar.gz: 9637ea2eac2db6f5a3cf74bddc81c32b81eb42cb2af640d5c99cc9e9e7bd2c45b74e4424525d4f2cade9e26a472f19ca6474c2ca6a4b280a3255dffa273a3921
6
+ metadata.gz: 9455fe810419071e80b47e53c00ab588d2c0f56696adc89af09ea2796bb397efe8627939f89fba707af04201487010926e82dfcf1af0d58f8fbe7fe4f85af36d
7
+ data.tar.gz: 85fb29391269e1d5c5d4794096d54bae36ea4a46f2f959adaf16df5419214ddf5d269cfbf8d7b0de3936605a6b22d352b932e77b313a815d990bce078c2aa358
@@ -51,7 +51,13 @@ var initThinMan = function(){
51
51
  getTarget: function(){
52
52
  var target_selector = this.jq_obj.data('ajax-target');
53
53
  if(target_selector){
54
- this.target = $(target_selector);
54
+ if($(target_selector).length > 0){
55
+ this.target = $(target_selector);
56
+ }else{
57
+ console.log('Warning! Thin Man selector ' + target_selector + ' not found')
58
+ }
59
+ }else{
60
+ console.log('Warning! Thin Man selector not given')
55
61
  }
56
62
  },
57
63
  getErrorTarget: function(){
@@ -91,7 +97,11 @@ var initThinMan = function(){
91
97
  this.insertHtml(data);
92
98
  } else if(typeof data === 'object') {
93
99
  if(typeof data.html != 'undefined'){
94
- this.insertHtml(data.html)
100
+ if(typeof data.hooch_modal != 'undefined'){
101
+ new hooch.Modal(data.html)
102
+ }else{
103
+ this.insertHtml(data.html)
104
+ }
95
105
  } else if(this.target && typeof(this.target.empty) == 'function') {
96
106
  this.target.empty()
97
107
  }
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.13.0"
2
+ VERSION = "0.14.0"
3
3
  end
@@ -182,5 +182,30 @@ describe("thin_man", function(){
182
182
  });
183
183
  });
184
184
 
185
+ describe("Log", function(){
186
+ beforeEach(function(){
187
+ spyOn(console, 'log');
188
+ });
189
+
190
+ it("Don't show a warning with a valid target", function(){
191
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
192
+ $target = affix('#test_dom_id');
193
+ thin = new thin_man.AjaxLinkSubmission($link);
194
+ expect(console.log).not.toHaveBeenCalled();
195
+ });
196
+
197
+ it("Show a warning when target not found", function(){
198
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#not_valid_target"]');
199
+ thin = new thin_man.AjaxLinkSubmission($link);
200
+ expect(console.log).toHaveBeenCalledWith('Warning! Thin Man selector #not_valid_target not found');
201
+ });
202
+
203
+ it("Show a warning when target not provided", function(){
204
+ $link = affix('a[data-ajax-link="true"]');
205
+ thin = new thin_man.AjaxLinkSubmission($link);
206
+ expect(console.log).toHaveBeenCalledWith('Warning! Thin Man selector not given');
207
+ });
208
+ });
209
+
185
210
  });
186
211
  });
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.13.0
4
+ version: 0.14.0
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: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails