From a4567396e457519ec9727f8e19799558349b18d3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 20 Mar 2015 11:08:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=E5=B0=B1=E4=BC=9A=E6=8A=A5?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/discuss_demos_controller.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/discuss_demos_controller.rb b/app/controllers/discuss_demos_controller.rb index a0955efe2..b0c9791cb 100644 --- a/app/controllers/discuss_demos_controller.rb +++ b/app/controllers/discuss_demos_controller.rb @@ -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 From 3837e1fcf52768a1466fade10fd58a808e8e3ebd Mon Sep 17 00:00:00 2001 From: whimlex Date: Fri, 20 Mar 2015 11:34:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=EF=BC=9A=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_form.html.erb | 4 +++- config/locales/projects/en.yml | 2 +- config/locales/projects/zh.yml | 7 +++---- public/javascripts/attachments.js | 7 ++++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 872797d5c..496a3394e 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -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_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) } %> <%= l(:label_no_file_uploaded)%> diff --git a/config/locales/projects/en.yml b/config/locales/projects/en.yml index 5aca81426..ce9f8bf28 100644 --- a/config/locales/projects/en.yml +++ b/config/locales/projects/en.yml @@ -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 diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index bd547c37e..974dbb7ef 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -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: 取消申请 diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 8fbaa5981..190f226da 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -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('label_public')); + alert($(inputEl).data('are_you_sure')); var attachmentId = addFile.nextAttachmentId++; var fileSpan = $('', { 'id': 'attachments_' + attachmentId, 'class':'attachment' }); @@ -23,7 +25,7 @@ function addFile(inputEl, file, eagerUpload) { fileSpan.append( $('', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name), $('', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload), - $('公开:').attr({ 'class': 'ispublic-label' }) , + $(''+$(inputEl).data('label_public')+'').attr({ 'class': 'ispublic-label' }) , $('', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload), $(' ').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload), $('
', { '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("已上传"+""+count+""+"个文件"); - if(count>=1){ var add_attachs=$('.add_attachment'); var delete_all=$('.remove_all'); From 5924cd6432d27d0ea83edaabee31e020b3678cab Mon Sep 17 00:00:00 2001 From: whimlex Date: Fri, 20 Mar 2015 11:37:57 +0800 Subject: [PATCH 3/3] commit --- public/javascripts/attachments.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 190f226da..4ae3278b1 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -16,7 +16,7 @@ function addFile(inputEl, file, eagerUpload) { if ($('#attachments_fields').children().length < 10) { alert($(inputEl).data('description_placeholder')); - alert($(inputEl).data('label_public')); + alert($(inputEl).data('field_is_public')); alert($(inputEl).data('are_you_sure')); var attachmentId = addFile.nextAttachmentId++; @@ -25,7 +25,7 @@ function addFile(inputEl, file, eagerUpload) { fileSpan.append( $('', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name), $('', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload), - $(''+$(inputEl).data('label_public')+'').attr({ 'class': 'ispublic-label' }) , + $(''+$(inputEl).data('field_is_public')+'').attr({ 'class': 'ispublic-label' }) , $('', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload), $(' ').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload), $('
', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )