修改部分拍段project、course方式

projectlist 报错
This commit is contained in:
yanxd 2014-04-25 08:29:20 +08:00
parent 08b27f38a7
commit f4595dfcd2
3 changed files with 5 additions and 14 deletions

View File

@ -128,7 +128,7 @@ class ProjectsController < ApplicationController
def index
#Modified by nie
@project_type = params[:project_type]
@project_type = params[:project_type].to_i
per_page_option = 10
@projects_all = Project.active.visible.

View File

@ -255,26 +255,17 @@ module ApplicationHelper
end
classes = (ancestors.empty? ? 'root' : 'child')
s << "<li class='project-table'><div class='#{classes}'>"
if params[:project_type] == "0"
if project.try(:project_type) == Project::ProjectType_project
s << h(block_given? ? yield(project) : project.name)
else
end
# if @project.project_type == 1
# unless Course.find_by_extra(@project.identifier).nil?
# unless Course.find_by_extra(@project.identifier).tea_id == User.current.id
# s << "<span style = 'float: right;'>"
# s << join_in_course(@project, User.current)#, ['whiteButton'])
# s << "</span>"
# end
# end
# end
if params[:project_type] == "0"
if project.try(:project_type) == Project::ProjectType_project
unless User.current.member_of?(@project)
s << "<span style = 'float: right;'>"
s << watcher_link(@project, User.current)#, ['whiteButton'])
s << "</span>"
end
end
s << (render :partial => 'projects/project', :locals => {:project => project}).to_s
else
s << (render :partial => 'projects/course', :locals => {:project => project}).to_s

View File

@ -175,7 +175,7 @@ module ProjectsHelper
def render_project_hierarchy(projects)
render_project_nested_lists(projects) do |project|
#Modified by young
if (project.project_type==1)
if (project.try(:project_type) == Project::ProjectType_course )
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}").html_safe
else
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")