diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 666c39d30..3d541fd61 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -26,6 +26,18 @@ class FilesController < ApplicationController
include SortHelper
helper :project_score
+ def show_attachments obj
+ all_attachments = []
+ obj.each do |container|
+ all_attachments += container.attachments
+ end
+ @limit = 10
+ @feedback_count = all_attachments.count
+ @feedback_pages = Paginator.new @feedback_count, @limit, params['page']
+ @offset ||= @feedback_pages.offset
+ @curse_attachments = all_attachments[@offset, @limit]
+ end
+
def index
#sort_init 'filename', 'asc'
sort_init 'created_on', 'desc'
@@ -39,15 +51,7 @@ class FilesController < ApplicationController
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
- all_attachments = []
- @containers.each do |container|
- all_attachments += container.attachments
- end
- @limit = 10
- @feedback_count = all_attachments.count
- @feedback_pages = Paginator.new @feedback_count, @limit, params['page']
- @offset ||= @feedback_pages.offset
- @curse_attachments = all_attachments[@offset, @limit]
+ show_attachments @containers
render :layout => !request.xhr?
elsif params[:course_id]
@@ -79,16 +83,7 @@ class FilesController < ApplicationController
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)]
end
- all_attachments = []
- @containers.each do |container|
- all_attachments += container.attachments
- end
-
- @limit = 10
- @feedback_count = all_attachments.count
- @feedback_pages = Paginator.new @feedback_count, @limit, params['page']
- @offset ||= @feedback_pages.offset
- @curse_attachments = all_attachments[@offset, @limit]
+ show_attachments @containers
render :layout => 'base_courses'
end
@@ -133,6 +128,8 @@ class FilesController < ApplicationController
@containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
+ show_attachments @containers
+
@attachtype = 0
@contenttype = 0
@@ -159,6 +156,8 @@ class FilesController < ApplicationController
@containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
+ show_attachments @containers
+
@attachtype = 0
@contenttype = 0
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index e08e50e80..1fd1646b8 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -441,7 +441,7 @@ module CoursesHelper
def homework_user_of_homework homework,is_teacher
homework_users = ""
homework.users.each do |user|
- homework_users = homework_users + (is_teacher ? (user.firstname + user.lastname) : user.login)
+ homework_users = homework_users + (is_teacher ? (user.lastname + user.firstname) : user.login)
if user != homework.users.last
homework_users = homework_users + "、"
end
diff --git a/app/helpers/user_score_helper.rb b/app/helpers/user_score_helper.rb
index 376f676b7..c94763e31 100644
--- a/app/helpers/user_score_helper.rb
+++ b/app/helpers/user_score_helper.rb
@@ -864,7 +864,7 @@ FROM `users` where id = #{user.id}")
users = Attachment.find_by_sql("SELECT COUNT(*) as m_count FROM #{Attachment.table_name} WHERE author_id = '#{user.id}' and container_type = 'Project' and container_id = #{project.id}")
result = 0
if users.count > 0
- result = users.first.m_coumt
+ result = users.first.m_count
end
result
end
diff --git a/app/views/attachments/autocomplete.js.erb b/app/views/attachments/autocomplete.js.erb
index 404ad9a61..abe2c3757 100644
--- a/app/views/attachments/autocomplete.js.erb
+++ b/app/views/attachments/autocomplete.js.erb
@@ -4,4 +4,5 @@ $('#relation_file').html('<%=render_attachments_for_new_project(@project, nil)%>
<% elsif @course%>
$('#relation_file').html('<%=render_attachments_for_new_course(@course, nil)%>');
<% end%>
+$('#attachments').children().css("width","100%").css("word-break","break-all");
diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb
index 6d3a2adcc..6d1581820 100644
--- a/app/views/bids/_homework_list.html.erb
+++ b/app/views/bids/_homework_list.html.erb
@@ -28,7 +28,7 @@
- <% user_name = is_teacher ? (homework.user.firstname + homework.user.lastname) : homework.user.login %>
+ <% user_name = is_teacher ? (homework.user.lastname + homework.user.firstname) : homework.user.login %>
<%= image_tag(url_to_avatar(homework.user), :class => "avatar")%> |
diff --git a/app/views/files/_course_show_all_attachment.html.erb b/app/views/files/_course_show_all_attachment.html.erb
index f70142a05..fbf398c36 100644
--- a/app/views/files/_course_show_all_attachment.html.erb
+++ b/app/views/files/_course_show_all_attachment.html.erb
@@ -3,7 +3,7 @@
<% attachmenttypes = @course.attachmenttypes %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
<% edit_allowed = User.current.allowed_to?(:manage_files, @course) %>
-
+
@@ -40,17 +40,17 @@
<%next%>
<%end%>
">
- <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> |
+ <%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> |
- <%= number_to_human_size(file.filesize) %> |
-
+ | <%= number_to_human_size(file.filesize) %> |
+
<%= file.attachmentstype.typeName unless file.attachmentstype.nil? %>
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %>
|
- <%= file.show_suffix_type %> |
-
+ | <%= file.show_suffix_type %> |
+
<%= file.file_dense_str %>
@@ -58,9 +58,9 @@
:attachment => file} %>
|
- <%= file.downloads %> |
+ <%= file.downloads %> |
-
+ |
<%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb
index f865235ae..0dbd735c4 100644
--- a/app/views/files/_show_all_attachment.html.erb
+++ b/app/views/files/_show_all_attachment.html.erb
@@ -4,7 +4,7 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|