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 @@ - contest.trustie.net - <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'welcome', :action => 'contest' %> > 详情 + contest.trustie.net + <%=link_to l(:field_homepage), home_path %> > <%#=link_to l(:label_contest_innovate), :controller => 'welcome', :action => 'contest' %> 详情 diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb index 2b8f98494..df897151e 100644 --- a/app/views/forums/_forum_list.html.erb +++ b/app/views/forums/_forum_list.html.erb @@ -10,7 +10,7 @@

<%= link_to h(forum.name), forum_path(forum) %>

-

<%= forum.description%>

+

<%= textAreailizable forum.description%>

<%= authoring forum.created_at, forum.creator %>

diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 1622bbe02..6e41cc904 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -3,24 +3,12 @@

<%=l(:label_memo_new)%>

<% if User.current.logged? %> <%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %> -

<%= f.text_field :subject, :required => true%>

<%= f.text_area :content, :required => true, :id => 'editor02' %>

(<%= l(:label_memos_max_length) %>)

- <%= l(:label_attachment_plural) %>
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>

diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index ef376c2ec..e5597afcf 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -52,7 +52,7 @@ diff --git a/app/views/layouts/base_memos.html.erb b/app/views/layouts/base_memos.html.erb index 875fbd4fc..fdce1cc83 100644 --- a/app/views/layouts/base_memos.html.erb +++ b/app/views/layouts/base_memos.html.erb @@ -63,11 +63,16 @@
<%= image_tag(url_to_avatar(@forum.creator), :class => 'vatar-size') %> - <%=link_to @forum.creator.name, user_path(@forum.creator) %> -
- <%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %> - <%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %>
-
+ + <% unless @forum.creator.nil? %> + <%=link_to @forum.creator.name, user_path(@forum.creator) %> +
+ <%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %> + <%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %> +
+
+ <% end %> +
<% if User.current.logged? || User.current.admin? %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index a3b8e267c..a84eff2e2 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -1,7 +1,7 @@ <% @nav_dispaly_project_label = 1 @nav_dispaly_forum_label = 1 %> -<% #@nav_dispaly_project_label = 1 %> +<%#@nav_dispaly_project_label = 1 %> @@ -48,9 +48,6 @@
<%= link_to (forum.memo_count), forum_path(forum) %><%= link_to (forum.topic_count), forum_path(forum) %>
- - -