编辑作业时显示已添加的附件

This commit is contained in:
z9hang 2014-05-16 17:45:20 +08:00
parent 0385013905
commit 5d15349482
2 changed files with 6 additions and 6 deletions

View File

@ -1,10 +1,10 @@
<span id="attachments_fields"> <span id="attachments_fields">
<% if defined?(container) && container && container.saved_attachments %> <% if defined?(container) && container && container.saved_attachments %>
<% container.saved_attachments.each_with_index do |attachment, i| %> <% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>"> <span id="attachments_p<%= i %>" class="attachment">
<span style="width:100px;"><%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename', :maxlength => 10)%> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
</span>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 155, :placeholder => l(:label_optional_description), :class => 'description') + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span> </span>

View File

@ -37,5 +37,5 @@
<p><%= hidden_field_tag 'course_id', @project_id %> <p><%= hidden_field_tag 'course_id', @project_id %>
</p> </p>
<fieldset><legend><%= l(:label_attachment_plural) %></legend> <fieldset><legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @homework} %></p> <p><%= render :partial => 'attachments/form', :locals => {:container => @bid} %></p>
</fieldset> </fieldset>