#1309 项目--配置--模块:不勾选相关模块,却也能在项目主页显示,解决添加条件判断,不勾选的模块不再显示。admin首页定制中设置不显示课程时,个人主页出的课程tab页也不在显示

This commit is contained in:
z9hang 2014-10-10 10:49:21 +08:00
parent 8485a59db6
commit 75b9fccb84
2 changed files with 6 additions and 6 deletions

View File

@ -384,20 +384,20 @@ Redmine::MenuManager.map :project_menu do |menu|
# menu.push :activity, { :controller => 'activities', :action => 'index' } # menu.push :activity, { :controller => 'activities', :action => 'index' }
#menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id #menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id
# :if => Proc.new { |p| p.shared_versions.any? } # :if => Proc.new { |p| p.shared_versions.any? }
menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural menu.push :issues, { :controller => 'issues', :action => 'index' },:if => Proc.new {|p| p.enabled_module_names.include?('issues') } ,:param => :project_id, :caption => :label_issue_plural
# menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new, # menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
# :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } # :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
# menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt # menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
# menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar # menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar
menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural menu.push :news, { :controller => 'news', :action => 'index' }, :if => Proc.new {|p| p.enabled_module_names.include?('news') },:param => :project_id, :caption => :label_news_plural
# menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural # menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural
# menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id, # menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id,
# :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } # :if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id,
:if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural :if => Proc.new { |p| p.boards.any? && p.enabled_module_names.include?('boards') }, :caption => :label_board_plural
#menu.push :files, { :controller => 'files', :action => 'index' }, :param => :project_id, :caption => :label_file_new #menu.push :files, { :controller => 'files', :action => 'index' }, :param => :project_id, :caption => :label_file_new
menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil }, menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil },
:if => Proc.new { |p| p.repository && !p.repository.new_record? && !( !User.current.member_of?(p) && p.hidden_repo ) } :if => Proc.new { |p| p.repository && !p.repository.new_record? && !( !User.current.member_of?(p) && p.hidden_repo ) && p.enabled_module_names.include?('repository') }
menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true
end end
@ -415,7 +415,7 @@ Redmine::MenuManager.map :course_menu do |menu|
end end
Redmine::MenuManager.map :user_menu do |menu| Redmine::MenuManager.map :user_menu do |menu|
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain } menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
menu.push :user_course, {:controller => 'users', :action => 'user_courses'} menu.push :user_course, {:controller => 'users', :action => 'user_courses'},:if => Proc.new {|c| FirstPage.where("page_type = 'project'").first.show_course != 2}
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang #menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain} menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang # menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang

View File

@ -73,7 +73,7 @@ Redmine::Plugin.register :redmine_code_review do
menu :project_menu, :code_review, { :controller => 'code_review', :action => 'index' }, :caption => :code_reviews, menu :project_menu, :code_review, { :controller => 'code_review', :action => 'index' }, :caption => :code_reviews,
:if => Proc.new{|project| :if => Proc.new{|project|
setting = CodeReviewProjectSetting.find_or_create(project) setting = CodeReviewProjectSetting.find_or_create(project)
project.repository != nil and setting and !setting.hide_code_review_tab project.repository != nil and setting and !setting.hide_code_review_tab and project.enabled_module_names.include?('code_review')
}, :after => :repository }, :after => :repository