Skip to content

Instantly share code, notes, and snippets.

Created June 30, 2009 00:26
Show Gist options
  • Save anonymous/137909 to your computer and use it in GitHub Desktop.
Save anonymous/137909 to your computer and use it in GitHub Desktop.
## vendor/plugins/redmine_dana/init.rb
require 'redmine'
Redmine::Plugin.register :redmine_hide_projects do
name 'Hide Projects'
author 'Dana Jones'
url 'http://www.sterlingrosedesign.com/'
author_url 'http://www.sterlingrosedesign.com/'
description 'The Redmine Hid Projects plugin is used to hide the projects link at the top of the
template except for admins.'
version '0.1.0'
Redmine::MenuManager.map :top_menu do |menu|
menu.push :home, :home_path
menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
menu.push :projects, { :controller => 'projects', :action => 'index' }, :if => Proc.new {
User.current.admin? }, :last => true, :caption => :label_project_plural
menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new {
User.current.admin? }, :last => true
menu.push :help, Redmine::Info.help_url, :last => true
end
end
## lib/redmine.rb
Redmine::MenuManager.map :top_menu do |menu|
menu.push :home, :home_path
menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural
menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new {
User.current.admin? }, :last => true
menu.push :help, Redmine::Info.help_url, :last => true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment