Changeset 1638


Ignore:
Timestamp:
2010-08-02 15:21:58 (3 years ago)
Author:
freya
Message:

add 'showRemove' to prevent adding the remove link
example:

"upload" : {

"base" : "file",

"control": {

"base" : "upload-control",
"showRemove" : false

}

}


see #242

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/upload.js

    r1556 r1638  
    5454    UploadControl.prototype.initElements = function(){ 
    5555        var me = this; 
     56         
     57        // by default show the remove link 
     58        if (this.showRemove == undefined) 
     59            this.showRemove = true; 
     60         
    5661        var $container = this.getElement("input"); 
    5762         
     
    221226             
    222227            this.uploadView.html("<a target='_blank' href='" + ref + "'>" + name + "</a><span class='upload-info'> (type: " + mimetype + ", size: " + size + " ) </span> "); 
    223             var rmBtn = $("<a href='javascript:void(0)'>remove</a>").appendTo(this.uploadView); 
    224             rmBtn.click(function(evt){ 
    225                 if (isTemporary) { 
    226                     me.clearUploadedFile(value.id); 
    227                 } 
    228                 me.setValue(undefined);                 
    229             }); 
    230              
     228             
     229            if(this.showRemove){ 
     230                var rmBtn = $("<a href='javascript:void(0)'>remove</a>").appendTo(this.uploadView); 
     231                rmBtn.click(function(evt){ 
     232                    if (isTemporary) { 
     233                        me.clearUploadedFile(value.id); 
     234                    } 
     235                    me.setValue(undefined);                 
     236                }); 
     237            } 
    231238            if (isTemporary) 
    232239                this.startHeartBeat(value.id); 
Note: See TracChangeset for help on using the changeset viewer.