This commit is contained in:
sw 2014-06-26 14:48:31 +08:00
commit dbd5c49246
3 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,10 @@ class CoursesController < ApplicationController
helper :members helper :members
helper :words 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_time), :only => :index
menu_item l(:label_sort_by_active), :only => :index menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :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 'homework', :action => 'homework', :as => 'homework'
get 'new_homework', :action => 'new_homework', :as => 'new_homework' get 'new_homework', :action => 'new_homework', :as => 'new_homework'
get 'file', :action => 'file', :as => 'file' get 'file', :action => 'file', :as => 'file'
get 'feedback', :action => 'feedback', :as => 'course_feedback'
get 'member', :controller => 'courses', :action => 'member', :as => 'member' get 'member', :controller => 'courses', :action => 'member', :as => 'member'
post 'finishcourse' post 'finishcourse'
post 'restartcourse' post 'restartcourse'

View File

@ -67,6 +67,16 @@ module Redmine
end end
false false
end 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 end
module MenuHelper module MenuHelper