From 6a41ccbc7ccb0bff4755b3d105cf54b0a664774c Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 8 Oct 2014 12:00:38 +0800 Subject: [PATCH] =?UTF-8?q?#1325=20=E5=8F=91=E5=B8=83=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=BC=96=E8=BE=91=E6=97=B6=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=98=AF=E5=90=A6=E5=85=AC=E5=BC=80=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E2=80=9C=E5=85=AC=E5=BC=80=E2=80=9D2=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 ++ app/views/attachments/_form.html.erb | 11 +++++++---- app/views/bids/show.html.erb | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 215df8e10..c511b5ace 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -195,6 +195,8 @@ class AttachmentsController < ApplicationController end elsif !@attachment.container.nil? && @attachment.container.is_a?(Softapplication) format.html { redirect_to_referer_or softapplications_path(@attachment.container) } + elsif !@attachment.container.nil? && @attachment.container.is_a?(Bid) + format.html { redirect_to_referer_or respond_path(@attachment.container) } else if @project.nil? format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) } diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 5c22ff44c..d6cbb72fe 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -3,14 +3,17 @@ <% container.attachments.each_with_index do |attachment, i| %> <%= 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;") + - if attachment.id.nil? - else + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, :class => 'is_public')%> + <%= 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}" %> <% end %> diff --git a/app/views/bids/show.html.erb b/app/views/bids/show.html.erb index 3107d8bd6..b431ef97a 100644 --- a/app/views/bids/show.html.erb +++ b/app/views/bids/show.html.erb @@ -16,7 +16,7 @@
<%= textilizable(@bid, :description) %> <% if @bid.attachments.any?%> - <% options = {:author => true} %> + <% options = {:author => true,:deletable => (@bid.author.id == User.current.id || User.current.admin? ? true : false)} %> <%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %> <% end %>