diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 879759c89..c83a7bf2a 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -367,8 +367,9 @@ class Attachment < ActiveRecord::Base end end - #有了历史记录的数据记录是不能被删除的。 - #true 能被删除 false 不能被删除 + # 有了历史记录的数据记录是不能被删除的。 + # true 能被删除 false 不能被删除 + # 2016.10.14 修改成可以删除,删除时候添加提示全部删除 def destroyable self.attachment_histories.count == 0 end diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb index 572db0606..aaad31704 100644 --- a/app/views/files/_tool_settings.html.erb +++ b/app/views/files/_tool_settings.html.erb @@ -27,7 +27,7 @@ <% end %>
  • - <%= link_to( '删除资源', attachment_path(file),:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" && file.destroyable %> + <%= link_to( '删除资源', attachment_path(file),:data => {:confirm => file.destroyable ? l(:text_are_you_sure) : l(:text_history_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" %>
  • <% end %> diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index cfe52e11a..985fd9bc3 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -188,6 +188,7 @@ zh: text_are_you_sure: 您确定要删除吗? #js 提示 + text_history_are_you_sure: 本资源有多个版本,你确定要全部删除吗? text_are_you_sure_out: 你确定要退出该班级吗? text_are_you_sure_out_group: 你确定要退出该分班吗? text_are_you_sure_all: 您确定要删除所有文件吗