Guest User

Untitled

a guest
May 20th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. _domready : function() {
  2. ioUpload.method = 'POST';
  3. ioUpload.url = BASE_URL + 'properties/property-images/upload';
  4. ioRefresh.url = BASE_URL + 'properties/property-images/list-refresh';
  5.  
  6. ioUpload.form = {
  7. id:'uploadImage-form',
  8. upload:true
  9. };
  10. },
  11.  
  12. _uploadInitialize : function(e) {
  13. if(!ul) {
  14. Y.one(this.FORM_CONTAINER).append('<ul>');
  15. ul = Y.one(this.FORM_CONTAINER + ' ul');
  16. }
  17.  
  18. e.preventDefault();
  19. var io = Y.clone(ioUpload);
  20. io.on.start = Y.bind(this._uploadStart,this);
  21. io.on.complete = Y.bind(this._uploadComplete,this);
  22. io.arguments = {'name' : Y.one(this.FORM_CONTAINER + ' input[type=file]').get('value') };
  23. Y.io(io.url,io);
  24. },
  25.  
  26. _uploadStart : function(id,args) {
  27. if(Y.all(this.FORM_CONTAINER + ' li.upload-complete').size() > 2) {
  28. Y.one(this.FORM_CONTAINER + ' li.upload-complete').remove(true);
  29. }
  30.  
  31. var name = args.name;
  32. name = name.substring(name.lastIndexOf('\\') + 1);
  33. name = name.substring(name.lastIndexOf('/') + 1);
  34.  
  35. var li = Y.Node.create('<li>');
  36. li.addClass('upload-loading');
  37. li.set('id','image-upload-' + id);
  38. li.set('text',name);
  39. ul.append(li);
  40. //ul.append('<li class="upload-loading" id="image-upload-' + id + '">' + name + '</li>');
  41. },
  42.  
  43. _uploadComplete : function(id,o,args) {
  44. ul.one('#image-upload-' + id).replaceClass('upload-loading','upload-complete');
  45. var io = Y.clone(ioRefresh);
  46. io.url += '/c/' + Y.one('#listImageTable form select').get('value');
  47. io.on.success = Y.bind(this._listRefresh,this);
  48. Y.io(io.url,io);
  49. },
Add Comment
Please, Sign In to add comment