修改课程标签页选中状态

This commit is contained in:
nwb 2014-06-26 14:47:29 +08:00
parent 9ae5f59a29
commit a115edea9d
3 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,10 @@ class CoursesController < ApplicationController
helper :members
helper :words
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework
menu_item l(:label_sort_by_time), :only => :index
menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :only => :index

View File

@ -580,6 +580,7 @@ RedmineApp::Application.routes.draw do
get 'homework', :action => 'homework', :as => 'homework'
get 'new_homework', :action => 'new_homework', :as => 'new_homework'
get 'file', :action => 'file', :as => 'file'
get 'feedback', :action => 'feedback', :as => 'course_feedback'
get 'member', :controller => 'courses', :action => 'member', :as => 'member'
post 'finishcourse'
post 'restartcourse'

View File

@ -67,6 +67,16 @@ module Redmine
end
false
end
def redirect_to_course_menu_item(course, name)
item = Redmine::MenuManager.items(:course_menu).detect {|i| i.name.to_s == name.to_s}
if item && User.current.allowed_to?(item.url, course) && (item.condition.nil? || item.condition.call(course))
redirect_to({item.param => course}.merge(item.url))
return true
end
false
end
end
module MenuHelper