作业附件显示修改

This commit is contained in:
sw 2014-06-19 19:14:51 +08:00
parent 463edeee71
commit 19530df395
3 changed files with 32 additions and 10 deletions

View File

@ -1,8 +1,24 @@
<% for attachment in attachments %> <table style="width: 200px;table-layout: fixed" >
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> <tr>
<% if attachment.is_text? %> <% count = 0 %>
<%= link_to image_tag('magnifier.png'), <% for attachment in attachments %>
:controller => 'attachments', :action => 'show', <% if attachments.count == 1 %>
:id => attachment, :filename => attachment.filename %> <td title="<%= attachment.filename%>" style="width: 200px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<% end %> <%= render :partial => 'attachment', :locals => {:attachment => attachment} %>
<% end -%> </td>
<% elsif attachments.count == 2 %>
<td title="<%= attachment.filename%>" style="width: 100px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= render :partial => 'attachment', :locals => {:attachment => attachment} %>
</td>
<% else %>
<td title="<%= attachment.filename%>" style="width: 66px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<% if count == 3 %>
<% break %>
<% end %>
<%= render :partial => 'attachment', :locals => {:attachment => attachment} %>
<% count = count +1 %>
</td>
<% end %>
<% end %>
</tr>
</table>

View File

@ -0,0 +1,6 @@
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments', :action => 'show',
:id => attachment, :filename => attachment.filename,:style => "width:50px"%>
<% end %>

View File

@ -132,8 +132,8 @@
</tr> </tr>
<tr> <tr>
<td style="vertical-align: top;width: 200px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"> <td style="vertical-align: top;width: 200px;">
<% if is_evaluation %> <% if is_evaluation || is_teacher%>
<%= render :partial => 'app_link', :locals => {:attachments => homework.attachments} %> <%= render :partial => 'app_link', :locals => {:attachments => homework.attachments} %>
<% end %> <% end %>
</td> </td>