diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ccc9a884c..4be91c9b4 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -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)
diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb
index ce7b2db59..9326b32ec 100644
--- a/app/views/attachments/_links.html.erb
+++ b/app/views/attachments/_links.html.erb
@@ -1,8 +1,13 @@
<% for attachment in attachments %>
-
- <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,: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 %>
+
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
@@ -12,9 +17,10 @@
:filename => attachment.filename%>
<% end %>
- <%= 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? %>
(<%= number_to_human_size attachment.filesize %>)
+
<% 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] %>
+
+
+ <% end %>
<% if options[:author] %>
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %>,
diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb
index 3d8a76537..75d3a8949 100644
--- a/app/views/layouts/base_homework.html.erb
+++ b/app/views/layouts/base_homework.html.erb
@@ -111,8 +111,8 @@
-
@@ -133,9 +133,16 @@
-
+ |
+
+ <%= l(:label_attachment) %> :
+
+ |
+
+
+
<% 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 %>
|
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e886683f0..7bd6b8184 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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
\ No newline at end of file
+ button_delete_file: delete
+ label_attachment: attachment
\ No newline at end of file
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index d32ebb04b..96584e8ac 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2177,3 +2177,4 @@ zh:
label_without_score: 未评分
label_homework_list: 作品列表
label_time: 时间
+ label_attachment: 附件
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 8f0ed1ca7..d6a5e22cd 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -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;