From 4711e638eb283439ed7bf8917507c1150cc9c14d Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 28 Aug 2014 15:40:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E6=9C=89=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E9=99=B7=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=88=E5=B1=8F=E8=94=BD=E6=8E=89=E5=A4=8D=E5=88=B6=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/issue.rb | 13 ++++++++----- app/views/attachments/_form.html.erb | 6 +++++- app/views/issues/new.html.erb | 5 +++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 3a14d288d..6bbcd727f 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -240,11 +240,14 @@ class Issue < ActiveRecord::Base self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h} self.status = issue.status self.author = User.current - unless options[:attachments] == false - self.attachments = issue.attachments.map do |attachement| - attachement.copy(:container => self) - end - end + #赞不提供附件复制功能 + #unless options[:attachments] == false + #self.attachments = issue.attachments.map do |attachement| + # a = attachement.copy(:container => self) + # #a.save + # a + #end + #end @copied_from = issue @copy_options = options self diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 097539888..bb043cd70 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -4,7 +4,11 @@ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + - link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + if attachment.id.nil? + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, :class => 'is_public')%> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index 9f0743a18..4b0140b1c 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -11,8 +11,9 @@ <% if @copy_from && @copy_from.attachments.any? %>

- - <%= check_box_tag 'copy_attachments', '1', @copy_attachments %> + +

<% end %> <% if @copy_from && !@copy_from.leaf? %>