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 +4 -4
- data/app/assets/javascripts/thin_man.js +12 -2
- data/lib/thin_man/version.rb +1 -1
- data/test/javascript/spec/thinManSpec.js +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 770d8ac8603108fd26ebb9283f9e74701bb77b5d
|
4
|
+
data.tar.gz: c65b486c253925376e1ee80cc5cdc422ae73dfe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
}
|
data/lib/thin_man/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|