修改base_homework界面
This commit is contained in:
parent
22e2ac26bb
commit
f5e9528b12
|
@ -127,7 +127,8 @@ module ApplicationHelper
|
|||
# * :text - Link text (default to attachment filename)
|
||||
# * :download - Force download (default: false)
|
||||
def link_to_short_attachment(attachment, options={})
|
||||
text = h(truncate(options.delete(:text) || attachment.filename, length: 23, omission: '...'))
|
||||
length = options[:length] ? options[:length]:23
|
||||
text = h(truncate(options.delete(:text) || attachment.filename, length: length, omission: '...'))
|
||||
route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
|
||||
html_options = options.slice!(:only_path)
|
||||
url = send(route_method, attachment, attachment.filename, options)
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
<div class="attachments">
|
||||
<% for attachment in attachments %>
|
||||
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<span title="<%= attachment.filename%>">
|
||||
<%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,:id => 'attachment_' -%>
|
||||
<span title="<%= attachment.filename%>" id = "attachment_">
|
||||
<% if options[:length] %>
|
||||
<%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%>
|
||||
<% else %>
|
||||
<%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
||||
<% end %>
|
||||
|
||||
</span>
|
||||
<% if attachment.is_text? %>
|
||||
<%= link_to image_tag('magnifier.png'),
|
||||
|
@ -12,9 +17,10 @@
|
|||
:filename => attachment.filename%>
|
||||
<% end %>
|
||||
<span title="<%= attachment.description%>">
|
||||
<%= h(truncate(" - #{attachment.description}", length: 15, omission: '...')) unless attachment.description.blank? %>
|
||||
<%= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %>
|
||||
</span>
|
||||
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
|
||||
<% if options[:deletable] %>
|
||||
<% if attachment.container_type == 'HomeworkAttach' %>
|
||||
<%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'delete_homework', :id => attachment.id},
|
||||
|
@ -32,6 +38,10 @@
|
|||
:title => l(:button_delete) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if options[:wrap] %>
|
||||
<br/>
|
||||
|
||||
<% end %>
|
||||
<% if options[:author] %>
|
||||
<span class="author" title="<%= attachment.author%>">
|
||||
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>,
|
||||
|
|
|
@ -111,8 +111,8 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;">
|
||||
<%= textilizable @bid.description %>
|
||||
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;" title="<%= @bid.description %>">
|
||||
<%= textilizable truncate(@bid.description, length: 200, omission: '...') %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -133,9 +133,16 @@
|
|||
<div class="inf_user_image">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<td valign="top" colspan="2" style="font-size: 16px;padding-left: 8px;">
|
||||
<strong>
|
||||
<%= l(:label_attachment) %> :
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" colspan="2">
|
||||
<% if @bid.attachments.any?%>
|
||||
<% options = {:author => true,:deletable => (@bid.author.id == User.current.id || User.current.admin? ? true : false)} %>
|
||||
<% options = {:author => true,:deletable => (@bid.author.id == User.current.id || User.current.admin? ? true : false),:wrap => true,:length => 7} %>
|
||||
<%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %>
|
||||
<% end %>
|
||||
</td>
|
||||
|
|
|
@ -1842,4 +1842,5 @@ en:
|
|||
label_select_province: Please select the provinces
|
||||
label_search_conditions_not_null: The search conditions can not be empty
|
||||
lable_school_list: List of schools
|
||||
button_delete_file: delete
|
||||
button_delete_file: delete
|
||||
label_attachment: attachment
|
|
@ -2177,3 +2177,4 @@ zh:
|
|||
label_without_score: 未评分
|
||||
label_homework_list: 作品列表
|
||||
label_time: 时间
|
||||
label_attachment: 附件
|
||||
|
|
|
@ -2520,6 +2520,14 @@ a.close-icon:hover {background-image:url('../images/close_hl.png');}
|
|||
.version-overdue a, .issue-overdue a, .project-overdue a {color: #f00;}
|
||||
|
||||
/***** Icons *****/
|
||||
#sidebar #attachment_ a {
|
||||
background-position: 0% 50%;
|
||||
background-repeat: no-repeat;
|
||||
font-family: '微软雅黑'; /*modify by men*/
|
||||
padding-left: 20px !important;
|
||||
padding-top: 2px !important;
|
||||
padding-bottom: 3px !important;
|
||||
}
|
||||
.icon {
|
||||
background-position: 0% 50%;
|
||||
background-repeat: no-repeat;
|
||||
|
@ -2528,6 +2536,7 @@ a.close-icon:hover {background-image:url('../images/close_hl.png');}
|
|||
padding-top: 2px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
|
||||
.icon_enterprise {
|
||||
background-position: 0% 50%;
|
||||
background-repeat: no-repeat;
|
||||
|
|
Loading…
Reference in New Issue