This commit is contained in:
z9hang 2015-03-20 11:37:22 +08:00
commit 5278d4dd2b
5 changed files with 17 additions and 13 deletions

View File

@ -26,10 +26,12 @@ class DiscussDemosController < ApplicationController
def destroy
asset = Kindeditor::Asset.find_by_owner_id(params[:id])
filepath = File.join(Rails.root,"public","files","uploads",
asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s,
asset[:asset].to_s)
File.delete(filepath) if File.exist?filepath
if !asset.nil?
filepath = File.join(Rails.root,"public","files","uploads",
asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s,
asset[:asset].to_s)
File.delete(filepath) if File.exist?filepath
end
DiscussDemo.destroy(params[:id])
redirect_to :controller=> 'discuss_demos',:action => 'index'
end

View File

@ -60,7 +60,9 @@
: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,
: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">
<%= l(:label_no_file_uploaded)%>

View File

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

View File

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

View File

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