thin_man 0.11.1 → 0.11.2

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f3af5bc85bb63d68be8f90f57a9b2e337d88090
4
- data.tar.gz: b927870523c85b37ec3759bf353f945b6bd7e8b4
3
+ metadata.gz: 7c3035550e3c17dfa67a9448a702719be0e76acb
4
+ data.tar.gz: 355d0bbf12eade487e4976b4a8cdbf7ec3aa290a
5
5
  SHA512:
6
- metadata.gz: 1679ed8bbc80af773b79014a14d24f1e061092821af7f86ccd8ae51d0a137418de4bb3ec96c032e27919bcedc7cbf60b5ff1b5d3d2528ba1120d428042d69cae
7
- data.tar.gz: acece9e2de6cce2cb7c70ba218c355f20425705e19868a5a779f25da2bca0caec89877306e13072cc4ac33a03df84c7ece02237c3741afb8701c0c1f7c9d11b2
6
+ metadata.gz: 82943692e3248084f9907442cf8c4e5989740a860f8731325cfb67d903fbe37a3f38b7ffab7e1d7031be2260ea08d43fad075f84359ba9ddc6ab743aa67eb035
7
+ data.tar.gz: 9ed3fdf82baa79f4d5116786c56e913408f1deec91d3390599fa80049e32fdc65ad98997f68e55ffbc68493ea4f9dbe30a281e4652fdc913ccd96cf28b9b1e9b
@@ -137,9 +137,9 @@ var initThinMan = function(){
137
137
  this.progress_target.remove();
138
138
  }
139
139
  try{
140
- response_data = JSON.parse(jqXHR.responseText)
140
+ var response_data = JSON.parse(jqXHR.responseText)
141
141
  } catch(err) {
142
- response_data = {}
142
+ var response_data = {}
143
143
  // hmmm, the response is not JSON, so there's no flash.
144
144
  }
145
145
  if(typeof response_data.flash_message != 'undefined'){
@@ -153,9 +153,9 @@ var initThinMan = function(){
153
153
  }
154
154
  }
155
155
  if(this.target){
156
- new thin_man.AjaxFlash(flash_style, response_data.flash_message,this.target, flash_duration);
156
+ this.flash = new thin_man.AjaxFlash(flash_style, response_data.flash_message,this.target, flash_duration);
157
157
  }else{
158
- new thin_man.AjaxFlash(flash_style, response_data.flash_message,this.jq_obj, flash_duration);
158
+ this.flash = new thin_man.AjaxFlash(flash_style, response_data.flash_message,this.jq_obj, flash_duration);
159
159
  }
160
160
  }
161
161
  if('function' == typeof this.params.on_complete){
@@ -251,14 +251,17 @@ var initThinMan = function(){
251
251
  }),
252
252
  AjaxFlash: Class.extend({
253
253
  init: function(type,message,elem,duration){
254
- this.flash_container = $('#thin-man-flash-container').clone();
254
+ this.flash_container = $('[data-thin-man-flash-template]').clone();
255
+ this.flash_container.removeAttr('data-thin-man-flash-template');
256
+ this.flash_container.attr('data-thin-man-flash-container');
255
257
  $('body').append(this.flash_container);
256
258
  this.flash_container.css({position:'absolute',visibility: 'hidden'});
257
259
  this.alert_type = type;
258
260
  this.elem = elem;
259
261
  var alert_class = 'alert-' + type;
260
262
  this.flash_container.addClass(alert_class);
261
- $('#thin-man-flash-content', this.flash_container).html(message);
263
+ this.flash_content = this.flash_container.find('[data-thin-man-flash-content]');
264
+ this.flash_content.html(message);
262
265
  this.flash_container.show();
263
266
  this.setFadeBehavior(duration);
264
267
  this.reposition(elem);
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.11.1"
2
+ VERSION = "0.11.2"
3
3
  end
@@ -39,14 +39,22 @@ describe("thin_man", function(){
39
39
 
40
40
  beforeEach(function(){
41
41
  $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"] #test_dom_id');
42
- affix('#thin-man-flash-container #thin-man-flash-content');
42
+ affix('[data-thin-man-flash-template] [data-thin-man-flash-content]');
43
43
  thin = new thin_man.AjaxLinkSubmission($link);
44
44
  });
45
45
 
46
- it("display flash message", function(){
47
- var thin = new thin_man.AjaxLinkSubmission($link);
48
- thin.ajaxComplete(TestResponses.success);
49
- expect($('body #thin-man-flash-content').text()).toMatch('successfully response')
46
+ describe("Display flash message", function(){
47
+ it("successfully response", function(){
48
+ var thin = new thin_man.AjaxLinkSubmission($link);
49
+ thin.ajaxComplete(TestResponses.success);
50
+ expect(thin.flash.flash_content.text()).toMatch('successfully response');
51
+ });
52
+
53
+ it("error response", function(){
54
+ var thin = new thin_man.AjaxLinkSubmission($link);
55
+ thin.ajaxComplete(TestResponses.error);
56
+ expect(thin.flash.flash_content.text()).toMatch('error response');
57
+ });
50
58
  });
51
59
 
52
60
  it("fade out if flash_persist is false", function(){
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.11.1
4
+ version: 0.11.2
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-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails