tb_photos 1.0.5 → 1.0.6

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: 6d47ffc3cd873ef1d97dfcda9161d04650858b91
4
- data.tar.gz: 641b8a9871f8c31df76a498cc89409249bb5e86c
3
+ metadata.gz: 4f54935850231974c5b0c0bf66f1c036fe53e08d
4
+ data.tar.gz: e7dbb18f7638dbb07664ec9dbb3319fb8356a29b
5
5
  SHA512:
6
- metadata.gz: ee88ed93472d5864cfeb9a0e0f1a1f5cd93c68132ec92675d5be4c86cba46477de15c2ce66efe98164b3d382a6469e0d8a689953e0b71cb4a679859be526d0fb
7
- data.tar.gz: f6325f8fbbc1008bd0be1b9b4f2333f35dc602b7b878b51e4382158bda12173718cf3912c9e021988281c06d71338190cbdd5800d95d534571de1a4d7735c42f
6
+ metadata.gz: a9b50be0e281fe08d91ce66603a07763e484aaf1cad85625fde342509fd2607f62a73597e5395655cf4a23f706345759d7059bb5e75c6d032ad7e0988045cb48
7
+ data.tar.gz: 2b633ae4f7895c0c371cbde4c36d9ddb87e7a9fe5844245b211186c9348c3e0f2d4712896e790e6149a28e6f0d254754caba0a05c97b5d2553aec1626a2cb2c9
@@ -67,7 +67,9 @@
67
67
  }
68
68
  }
69
69
  else {
70
- errors.push("No file found");
70
+ if($('.admin-photo-form-current-photo').length === 0){
71
+ errors.push("No file found");
72
+ }
71
73
  }
72
74
  return errors;
73
75
  };
@@ -161,10 +163,6 @@
161
163
  };
162
164
 
163
165
  self.submittedPhotoForm = function(e){
164
- // disable submit button
165
- // not working in updated bootstrap!
166
- // var submit = $(this).find('input[type=submit]');
167
- // submit.attr('disabled', 'disabled').val(submit.attr('data-loading-text'));
168
166
 
169
167
  if(self.html5upload){
170
168
  // create a FormData object and attach form values
@@ -182,10 +180,15 @@
182
180
  if(photoValidationErrors.length) {
183
181
  return self.generateFileUploadErrors(photoValidationErrors);
184
182
  }
185
-
186
- progressBar = self.progressBarForUpload(file.name);
187
- fd.append('spud_photo[photo]', file);
188
- form.append(progressBar);
183
+
184
+ if(file){
185
+ progressBar = self.progressBarForUpload(file.name);
186
+ fd.append('spud_photo[photo]', file);
187
+ form.append(progressBar);
188
+ }
189
+ else{
190
+ progressBar = self.progressBarForUpload('');
191
+ }
189
192
 
190
193
  // send FormData object as ajax request
191
194
  var xhr = new XMLHttpRequest();
@@ -255,6 +258,12 @@
255
258
  progressBar.find('.progress').addClass('progress-danger');
256
259
  };
257
260
 
261
+ self.onPhotoUploadFailure = function(e, progressBar){
262
+ if(typeof(console) == 'object'){
263
+ console.error('An unexpected error occurred during upload', e);
264
+ }
265
+ };
266
+
258
267
  /*
259
268
  * Photo Upload/Edit Form
260
269
  ------------------------------- */
@@ -30,7 +30,7 @@
30
30
  <div class="control-group">
31
31
  <label class="control-label">Current Photo</label>
32
32
  <div class="controls">
33
- <%= image_tag @photo.photo.url(:spud_admin_medium) %>
33
+ <%= image_tag @photo.photo.url(:spud_admin_medium), :class => 'admin-photo-form-current-photo' %>
34
34
  </div>
35
35
  </div>
36
36
  <% end %>
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Photos
3
- VERSION = "1.0.5"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tb_photos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Woods
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-05 00:00:00.000000000 Z
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails