thin_man 0.0.1 → 0.0.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: 9330e34fea5d4a337e32a6873f0745455de96981
4
- data.tar.gz: b0ce857997952fbfc05049d0454e9f1ec197f7ab
3
+ metadata.gz: 5d00329ddfe51a637f6088d3b89b079785f96712
4
+ data.tar.gz: 086eabbc3e3e40ac4f47c66283a437d8fa34b346
5
5
  SHA512:
6
- metadata.gz: 35fc8023dcb75972e3cd363a6275d4b0a0c4867419a9b95799d3f01a3ff16c276752f902d4953f3309f6d5eb264a69daf8c4103b84860e353741e461e63fccaf
7
- data.tar.gz: d36eeced14cc004864cef85c36b983b16749f3b6e416c4ca139e25403544aa072d79252d3a63b7b7aeea01aa1eecf1a46b85be0f30e153ec477c9e0b7a4532cb
6
+ metadata.gz: d326aab5823d229956a95ed9b25f3ccce815882b4bc9beffe49cce10bbcceaf7fe3a389c1e7a11b8026f3193d5ee247baad6e28520f6e02cf19e040d9ddfb9ab
7
+ data.tar.gz: f514f44a1af282a4f440d7ecc10563f23b76745ead1e26fbf9d14f52a853e577b062e7a163f41b048bba7275a0cdaae2ab8e6a1816fcd6c3972ecfb063163ce5
@@ -112,11 +112,18 @@ var AjaxSubmission = Class.extend({
112
112
  $(form_map[step]).ScrollTo();
113
113
  }
114
114
  },
115
- ajaxComplete: function(jqXHr) {
115
+ ajaxComplete: function(jqXHR) {
116
+ response_data = JSON.parse(jqXHR.responseText)
116
117
  this.showTrigger();
117
118
  if(this.progress_indicator){
118
119
  this.progress_indicator.stop();
119
120
  }
121
+ if(typeof response_data.flash_message != 'undefined'){
122
+ console.log('got a flash')
123
+ flash_style = this.httpResponseToFlashStyle(jqXHR.status)
124
+ console.log(flash_style)
125
+ new AjaxFlash(flash_style, response_data.flash_message,this.target);
126
+ }
120
127
  },
121
128
  ajaxBefore: function(jqXHr) {
122
129
  this.toggleLoading();
@@ -125,7 +132,7 @@ var AjaxSubmission = Class.extend({
125
132
  ajaxError: function(jqXHR) {
126
133
  if(jqXHR.status == 409){
127
134
  this.error_target.html(jqXHR.responseText);
128
- }else{
135
+ }else if(jqXHR.status == 500){
129
136
  alert('There was an error communicating with the server.')
130
137
  }
131
138
  },
@@ -141,6 +148,15 @@ var AjaxSubmission = Class.extend({
141
148
  this.target.find('[data-loading-visible="true"]').removeClass('hidden');
142
149
  }
143
150
  }
151
+ },
152
+ httpResponseToFlashStyle: function(response_code){
153
+ if([403,409,500].indexOf(response_code) > -1){
154
+ return 'error'
155
+ }
156
+ if([200].indexOf(response_code) > -1){
157
+ return 'success'
158
+ }
159
+ return 'error'
144
160
  }
145
161
  });
146
162
 
@@ -195,6 +211,10 @@ var AjaxProgress = Class.extend({
195
211
  });
196
212
  var AjaxFlash = Class.extend({
197
213
  init: function(type,message,elem){
214
+ console.log('ajaxflash:')
215
+ console.log(type)
216
+ console.log(message)
217
+ console.log(elem)
198
218
  this.flash_container = $('#ajax_flash_container').clone();
199
219
  $('body').append(this.flash_container);
200
220
  this.flash_container.css({position:'absolute',visibility: 'hidden'});
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
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.0.1
4
+ version: 0.0.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-01-20 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -47,7 +47,6 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - MIT-LICENSE
50
- - README.rdoc
51
50
  - Rakefile
52
51
  - app/assets/javascripts/ajax_bindings.js
53
52
  - lib/tasks/thin_man_tasks.rake
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = ThinMan
2
-
3
- This project rocks and uses MIT-LICENSE.