Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _domready : function() {
- ioUpload.method = 'POST';
- ioUpload.url = BASE_URL + 'properties/property-images/upload';
- ioRefresh.url = BASE_URL + 'properties/property-images/list-refresh';
- ioUpload.form = {
- id:'uploadImage-form',
- upload:true
- };
- },
- _uploadInitialize : function(e) {
- if(!ul) {
- Y.one(this.FORM_CONTAINER).append('<ul>');
- ul = Y.one(this.FORM_CONTAINER + ' ul');
- }
- e.preventDefault();
- var io = Y.clone(ioUpload);
- io.on.start = Y.bind(this._uploadStart,this);
- io.on.complete = Y.bind(this._uploadComplete,this);
- io.arguments = {'name' : Y.one(this.FORM_CONTAINER + ' input[type=file]').get('value') };
- Y.io(io.url,io);
- },
- _uploadStart : function(id,args) {
- if(Y.all(this.FORM_CONTAINER + ' li.upload-complete').size() > 2) {
- Y.one(this.FORM_CONTAINER + ' li.upload-complete').remove(true);
- }
- var name = args.name;
- name = name.substring(name.lastIndexOf('\\') + 1);
- name = name.substring(name.lastIndexOf('/') + 1);
- var li = Y.Node.create('<li>');
- li.addClass('upload-loading');
- li.set('id','image-upload-' + id);
- li.set('text',name);
- ul.append(li);
- //ul.append('<li class="upload-loading" id="image-upload-' + id + '">' + name + '</li>');
- },
- _uploadComplete : function(id,o,args) {
- ul.one('#image-upload-' + id).replaceClass('upload-loading','upload-complete');
- var io = Y.clone(ioRefresh);
- io.url += '/c/' + Y.one('#listImageTable form select').get('value');
- io.on.success = Y.bind(this._listRefresh,this);
- Y.io(io.url,io);
- },
Add Comment
Please, Sign In to add comment