Merge branch 'Homework' of http://repository.trustie.net/xianbo/trustie2 into Homework

This commit is contained in:
sw 2014-10-31 11:49:01 +08:00
commit 58d32bcf2b
6 changed files with 47 additions and 79 deletions

View File

@ -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)

View File

@ -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 -%>
<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/>
&nbsp;
<% end %>
<% if options[:author] %>
<span class="author" title="<%= attachment.author%>">
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>,

View File

@ -105,66 +105,26 @@
<tr>
<td valign="top" colspan="2" style="font-size: 16px;padding-left: 8px;">
<strong>
<%= l(:label_new_course_description) %> :
<%= l(:label_homework_description) %> :
</strong>
</td>
</tr>
<tr>
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;">
<%= textilizable course.description %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_create_time) %> :
</td>
<td class="font_lighter_sidebar">
<%= format_time course.created_at %>
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;" title="<%= @bid.description %>">
<%= textilizable truncate(@bid.description, length: 200, omission: '...') %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px; width:62px;">
<%= l(:lable_course_teacher) %> :
<%= l(:label_limit_time) %>:
</td>
<td class="font_lighter_sidebar">
<%= link_to(course.teacher.lastname+course.teacher.firstname, user_path(course.teacher)) %>
<%= @bid.deadline %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_class_period) %> :
</td>
<td class="font_lighter_sidebar">
<%= course.class_period.to_s %>&nbsp;
<%= l(:label_class_hour) %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_main_term) %> :
</td>
<td class="font_lighter_sidebar">
<%= course.time.to_s %>
<%= course.term %>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px;">
<%= l(:label_teacher_work_unit) %> :
</td>
<!-- modified by zjc 有@user.user_extensions.occupation改为 @user.user_extensions.school 并添加超链接 -->
<% unless @user.user_extensions.nil? || @user.user_extensions.school.nil? %>
<td class="font_lighter_sidebar">
<%= link_to @user.user_extensions.school,"http://#{Setting.host_course}/?school_id=#{@user.user_extensions.school.id}" %>
</td>
<% end %>
</tr>
</table>
</div>
<div class="user_underline"></div>
@ -173,9 +133,18 @@
<div class="inf_user_image">
<table>
<tr>
<td>
<%= l(:label_limit_time) %>:
<%= @bid.deadline %>
<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),:wrap => true,:length => 7} %>
<%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %>
<% end %>
</td>
</tr>
<tr>
@ -183,33 +152,9 @@
<%#= @bid.homework_type==Bid::HomeworkFile ? "提交文件" : "提交项目" %>
</td-->
</tr>
<% unless @bid.parent_id.nil? %>
<tr>
<td>
<div style=" color: rgb(255, 0, 0); width:200px">
<% author=Bid.find(@bid.parent_id).author %>
作业来源于<%= link_to(author.lastname+author.firstname, user_path(Bid.find(@bid.parent_id).author)) %>
的需求:<%= link_to(Bid.find(@bid.parent_id).name, respond_path(Bid.find(@bid.parent_id))) %>
</div>
</td>
</tr>
<% end %>
</table>
</div>
<!-- tags -->
<div class="user_fans">
<div class="user_underline"></div>
<table style="font-family:'微软雅黑'; padding-left: 8px">
<tr>
<td><!-- added by william -for tag -->
<%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"} %>
</td>
</tr>
</table>
</div>
<!--homework-->
<div class="user_fans">

View File

@ -1843,3 +1843,4 @@ en:
label_search_conditions_not_null: The search conditions can not be empty
lable_school_list: List of schools
button_delete_file: delete
label_attachment: attachment

View File

@ -1894,6 +1894,7 @@ zh:
label_new_course_password: 课程密码
label_new_course_school: 开课学校
label_new_course_description: 课程描述
label_homework_description: 作业描述
label_new_join_order: 请输入课程密码
label_task_submit_form_accessory: 作业最终以附件形式提交
label_task_submit_form_project: 作业最终以项目形式提交
@ -2176,3 +2177,4 @@ zh:
label_without_score: 未评分
label_homework_list: 作品列表
label_time: 时间
label_attachment: 附件

View File

@ -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;