解决设置跳转404.bug
This commit is contained in:
parent
d9bc17c1ea
commit
6877ff7e8d
|
@ -16,7 +16,8 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
class ProjectsController < ApplicationController
|
||||
# if @project.project_type == 1
|
||||
layout 'base_projects'# by young
|
||||
# layout 'base_projects'# by young
|
||||
layout :select_project_layout
|
||||
menu_item :overview
|
||||
menu_item :roadmap, :only => :roadmap
|
||||
menu_item :settings, :only => :settings
|
||||
|
@ -614,12 +615,12 @@ class ProjectsController < ApplicationController
|
|||
#Added by young
|
||||
# @course_tag = params[:course]
|
||||
# if @course_tag == '1'
|
||||
if @project.project_type == 1
|
||||
@course = Course.find_by_extra(@project.identifier)
|
||||
render :layout => 'base_courses'
|
||||
else
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
# if @project.project_type == 1
|
||||
# render :layout => 'base_courses'
|
||||
# else
|
||||
# render :layout => 'base_projects'
|
||||
# end
|
||||
#Ended by young
|
||||
end
|
||||
|
||||
|
@ -837,6 +838,12 @@ class ProjectsController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
def select_project_layout
|
||||
project = Project.find_by_id(params[:id])
|
||||
project ||= @project
|
||||
(project.project_type == Project::ProjectType_project) ? 'base_projects' : 'base_courses'
|
||||
end
|
||||
|
||||
# Validates parent_id param according to user's permissions
|
||||
# TODO: move it to Project model in a validation that depends on User.current
|
||||
def validate_parent_id
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
class Project < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
ProjectType_project = 0
|
||||
ProjectType_course = 1
|
||||
|
||||
# Project statuses
|
||||
STATUS_ACTIVE = 1
|
||||
|
|
Loading…
Reference in New Issue