@ -1,6 +1,17 @@
/ * R e d m i n e - p r o j e c t m a n a g e m e n t s o f t w a r e
Copyright ( C ) 2006 - 2013 Jean - Philippe Lang * /
function postUpMsg ( attachmentId )
{
$ . ajax ( {
url : '/attachments/renderTag' ,
type : "GET" ,
data : {
attachmentId : attachmentId
}
} )
}
function addFile ( inputEl , file , eagerUpload ) {
if ( $ ( '#attachments_fields' ) . children ( ) . length < 10 ) {
@ -12,13 +23,14 @@ function addFile(inputEl, file, eagerUpload) {
fileSpan . append (
$ ( '<input>' , { 'type' : 'text' , 'class' : 'filename readonly' , 'name' : 'attachments[' + attachmentId + '][filename]' , 'readonly' : 'readonly' } ) . val ( file . name ) ,
$ ( '<input>' , { 'type' : 'text' , 'class' : 'description' , 'name' : 'attachments[' + attachmentId + '][description]' , 'maxlength' : 255 , 'placeholder' : $ ( inputEl ) . data ( 'description-placeholder' ) } ) . toggle ( ! eagerUpload ) ,
$ ( '<a> </a>' ) . attr ( { 'href' : "#" , 'class' : 'remove-upload' , 'data-confirm' : "您确定要删除吗?" } ) . click ( removeFile ) . toggle ( ! eagerUpload )
$ ( '<a> </a>' ) . attr ( { 'href' : "#" , 'class' : 'remove-upload' , 'data-confirm' : "您确定要删除吗?" } ) . click ( removeFile ) . toggle ( ! eagerUpload ) ,
$ ( '<div>' , { 'class' : 'div_attachments' , 'name' : 'div_' + 'attachments_' + attachmentId } )
) . appendTo ( '#attachments_fields' ) ;
if ( eagerUpload ) {
ajaxUpload ( file , attachmentId , fileSpan , inputEl ) ;
}
}
return attachmentId ;
}
return null ;