diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 7128014da..c0d7c1e25 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 2b7f4b007..e4a931474 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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' diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index e28d46fb8..75e79d06c 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -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