申请加入:附件上传

This commit is contained in:
whimlex 2015-03-20 11:34:59 +08:00
parent 45475c3612
commit 3837e1fcf5
4 changed files with 11 additions and 9 deletions

View File

@ -61,7 +61,9 @@
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js',:project =>project), :upload_path => uploads_path(:format => 'js',:project =>project),
:description_placeholder => l(:label_optional_description) :description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure)
} %> } %>
<span id="upload_file_count"> <span id="upload_file_count">
<%= l(:label_no_file_uploaded)%> <%= l(:label_no_file_uploaded)%>

View File

@ -33,7 +33,7 @@ en:
# #
label_project_id: "Projcet ID:" label_project_id: "Projcet ID:"
label_apply_project: Apply to Join label_apply_project: "+Apply to Join"
label_exit_project: Exit label_exit_project: Exit
label_apply_project_waiting: "Application has been processed, please wait for administrator review." label_apply_project_waiting: "Application has been processed, please wait for administrator review."
label_unapply_project: Cancel the application label_unapply_project: Cancel the application

View File

@ -10,9 +10,8 @@ zh:
# #
# 公共类 # 公共类
# #
label_apply_project: 申请加入 label_project_new: "新建项目"
label_project_new: 新建项目 label_join_project: "加入项目"
label_join_project: 加入项目
# #
@ -36,7 +35,7 @@ zh:
# #
label_project_id: "项目ID:" label_project_id: "项目ID:"
label_apply_project: 申请加入 label_apply_project: "+申请加入"
label_exit_project: 退出项目 label_exit_project: 退出项目
label_apply_project_waiting: 已处理申请,请等待管理员审核 label_apply_project_waiting: 已处理申请,请等待管理员审核
label_unapply_project: 取消申请 label_unapply_project: 取消申请

View File

@ -15,7 +15,9 @@ function postUpMsg(attachmentId)
function addFile(inputEl, file, eagerUpload) { function addFile(inputEl, file, eagerUpload) {
if ($('#attachments_fields').children().length < 10) { if ($('#attachments_fields').children().length < 10) {
alert($(inputEl).data('description_placeholder'));
alert($(inputEl).data('label_public'));
alert($(inputEl).data('are_you_sure'));
var attachmentId = addFile.nextAttachmentId++; var attachmentId = addFile.nextAttachmentId++;
var fileSpan = $('<span>', { 'id': 'attachments_' + attachmentId, 'class':'attachment' }); var fileSpan = $('<span>', { 'id': 'attachments_' + attachmentId, 'class':'attachment' });
@ -23,7 +25,7 @@ function addFile(inputEl, file, eagerUpload) {
fileSpan.append( fileSpan.append(
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name), $('<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': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload), $('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
$('<span >公开:</span>').attr({ 'class': 'ispublic-label' }) , $('<span >'+$(inputEl).data('label_public')+'</span>').attr({ 'class': 'ispublic-label' }) ,
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload), $('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload),
$('<a>&nbsp</a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload), $('<a>&nbsp</a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} ) $('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
@ -87,7 +89,6 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
var count=$('#attachments_fields>span').length; var count=$('#attachments_fields>span').length;
$('#upload_file_count').html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件"); $('#upload_file_count').html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件");
if(count>=1){ if(count>=1){
var add_attachs=$('.add_attachment'); var add_attachs=$('.add_attachment');
var delete_all=$('.remove_all'); var delete_all=$('.remove_all');