From f41d3f8b6a9115913cbc4a97e80d98dcf566ad16 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 22 Aug 2014 11:24:25 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9C=9F=E5=AE=9E=E5=90=8D=E5=AD=97=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 2 +- app/views/bids/_homework_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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 %> From d1d2dd0e4bf334df2ec66b98f58c1fb703698778 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 22 Aug 2014 11:58:12 +0800 Subject: [PATCH 2/9] =?UTF-8?q?undefined=20m=5Fcoumt=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/user_score_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From c6a19209f48a65b971ec1aa666068324610732dd Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 22 Aug 2014 12:32:16 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E3=80=81=E9=A1=B9=E7=9B=AE=E6=97=A0=E6=B3=95=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 37 ++++++++++++++--------------- db/schema.rb | 16 ++++++------- 2 files changed, 26 insertions(+), 27 deletions(-) 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/db/schema.rb b/db/schema.rb index cdedc6a2c..525cfb745 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140812065417) do +ActiveRecord::Schema.define(:version => 20140814062455) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -441,21 +441,21 @@ ActiveRecord::Schema.define(:version => 20140812065417) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 t.integer "show_course", :default => 1 t.integer "show_contest", :default => 1 + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 end create_table "forums", :force => true do |t| - t.string "name", :null => false - t.string "description", :default => "" + t.string "name", :null => false + t.text "description" t.integer "topic_count", :default => 0 t.integer "memo_count", :default => 0 t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "groups_users", :id => false, :force => true do |t| From 08a6e9af1a38b3dca0fa22be80de838e2c22e80a Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Fri, 22 Aug 2014 13:43:48 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E8=BE=B9=E6=A1=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../files/_course_show_all_attachment.html.erb | 16 ++++++++-------- app/views/files/_show_all_attachment.html.erb | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) 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) %> -
<%= image_tag(url_to_avatar(homework.user), :class => "avatar")%>
+
@@ -40,17 +40,17 @@ <%next%> <%end%> "> - + - - + - - + - + - diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index f865235ae..e4af62cad 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) %>
-
<%= 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 %>
+
From c046ad011cab643fedd7626f83d370c3935f2e19 Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Fri, 22 Aug 2014 14:17:20 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_show_all_attachment.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index e4af62cad..aeabcfa9c 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) %>
-
+
From 00b38dc7926f8f973a17f2d8362368427aacdc59 Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Fri, 22 Aug 2014 14:20:45 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=BE=B9=E6=A1=86=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_show_all_attachment.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index aeabcfa9c..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) %>
-
+
From 25affe30b0eac5d1767f42a7aa2e708ea72e8fd9 Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Fri, 22 Aug 2014 14:38:16 +0800 Subject: [PATCH 7/9] =?UTF-8?q?#1059=20=E8=BD=AF=E4=BB=B6=E5=88=9B?= =?UTF-8?q?=E5=AE=A2=E2=80=9D=20=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=B5=84=E6=96=99=E4=B8=AD=E7=9A=84=E7=94=A8=E6=88=B7=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 6a937b376..a57e35e65 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -128,7 +128,7 @@

学校列表

- +   
-
+