@ -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,14 +23,15 @@ 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 ;
if ( eagerUpload ) {
ajaxUpload ( file , attachmentId , fileSpan , inputEl ) ;
}
return attachmentId ;
}
return null ;
}
@ -66,7 +78,7 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
//gcm files count and add delete_all link
var count = $ ( '#attachments_fields>span' ) . length ;
var count = $ ( '#attachments_fields>span' ) . length ;
$ ( '#upload_file_count' ) . html ( "已上传" + "<span id=\"count\">" + count + "</span>" + "个文件" ) ;
if ( count >= 1 ) {