diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 943718392..c1593e320 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -468,8 +468,8 @@ class ProjectsController < ApplicationController def new @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @project = Project.new + @trackers = Tracker.sorted.all + @project = Project.new @project.safe_attributes = params[:project] render :layout => 'base' end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d15036fa0..d479b8804 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -791,7 +791,7 @@ class UsersController < ApplicationController # 必填自己的工作单位,其实就是学校 def auth_user_extension - if @user == User.current && @user.user_extensions.school.nil? + if @user == User.current && (@user.user_extensions.nil? || @user.user_extensions.school.nil?) flash[:error] = l(:error_complete_occupation) redirect_to my_account_path end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 641f02af7..8f0723f2e 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -64,7 +64,7 @@ class WelcomeController < ApplicationController @course_page = FirstPage.where("page_type = 'course'").first if params[:school_id] @school_id = params[:school_id] - elsif User.current.logged? && User.current.user_extensions.school + elsif User.current.logged? && User.current.user_extensions.try(:school) @school_id = User.current.user_extensions.school.try(:id) end @logoLink ||= logolink() diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 10aa39df2..8896da38c 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -44,15 +44,14 @@ class ZipdownController < ApplicationController zipfile = zip_homework_by_user homework send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile) else - render_403 :message => :no_file_dowmload ,:layout => "course_base" + render file: 'public/no_file_found.html' , :layout => 'course_base' end else - render_403 :message =>:notice_file_not_found ,:layout => "course_base" + render file: 'public/file_not_found.html' , :layout => 'course_base' end else render_403 :message => :notice_not_authorized ,:layout => "course_base" end - rescue => e render file: 'public/file_not_found.html' , :layout => 'course_base' end @@ -76,13 +75,19 @@ class ZipdownController < ApplicationController # Todo: User Access Controll homeattaches = bid.homeworks + #记录所有作业是不是有附件,有一个附件就改为true + has_file = false # 得到每一个人所有文件打包的zip文件 # 并将每一个人的zip打包为一个并返回路径 user_zip_paths = homeattaches.map do |homeattach| if homeattach.attachments.count > 0 zip_homework_by_user homeattach + has_file = true if has_file == false end end + if has_file == false + render file: 'public/no_file_fond.html.erb' , :layout => 'course_base' + end zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER #@paths = homeworks_attach_path diff --git a/app/models/project.rb b/app/models/project.rb index 1a2c0504d..dfb6ccd2d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -123,7 +123,8 @@ class Project < ActiveRecord::Base # reserved words validates_exclusion_of :identifier, :in => %w( new ) - after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?} + #此代码功能:为原redmine中项目的树形结构按名称首字母排序,本系统项目非树形结构,且项目排序方式无按首字母排序,另该代码执行会使空数据库时创建项目时出异常故注释掉 + #after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?} after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} # 创建project之后默认创建一个board,之后的board去掉了board的概念 after_create :create_board_sync diff --git a/app/views/contest_notification/show.html.erb b/app/views/contest_notification/show.html.erb index 93fa1f4af..e04a18c68 100644 --- a/app/views/contest_notification/show.html.erb +++ b/app/views/contest_notification/show.html.erb @@ -9,8 +9,8 @@
<%= link_to h(forum.name), forum_path(forum) %>
-<%= forum.description%>
+<%= textAreailizable forum.description%>
<%= authoring forum.created_at, forum.creator %>
<%= link_to (forum.memo_count), forum_path(forum) %> | <%= link_to (forum.topic_count), forum_path(forum) %> |