redmine 主菜单显示

在app/views/layerout/base.rb文件中

 <div id="main-menu">
        <%= render_main_menu(@project) %>
    </div>


render_main_menu 方法定义在 

./lib/redmine/menu_manager.rb 文件中

def render_main_menu(project)
        render_menu((project && !project.new_record?) ? :project_menu : :application_menu, project)
 end

render_menu定义:

def render_menu(menu, project=nil)
        links = []
        menu_items_for(menu, project) do |node|
          links << render_menu_node(node, project)
        end
        links.empty? ? nil : content_tag('ul', links.join("\n").html_safe)
      end

project_menu 定义在

./lib/redmine.rb 文件中

Redmine::MenuManager.map :project_menu do |menu|
  menu.push :overview, { :controller => 'projects', :action => 'show' }
  menu.push :activity, { :controller => 'activities', :action => 'index' }
  menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id,
              :if => Proc.new { |p| p.shared_versions.any? }
  menu.push :issues, { :controller => 'issues', :action => 'index' }, :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,
              :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) },
              :if => Proc.new { |p| p.trackers.any? }
  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 :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
  menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plura
l
  menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id,
              :if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
  menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id,
              :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural
  menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural, :param => :project_id
  menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil },
              :if => Proc.new { |p| p.repository && !p.repository.new_record? }
  menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true
end


render_menu_node 定义在文件

./lib/redmine/menu_manager.rb

def render_main_menu(project)
        render_menu((project && !project.new_record?) ? :project_menu : :application_menu, project)
      end

def render_menu(menu, project=nil)
        links = []
        menu_items_for(menu, project) do |node|
          links << render_menu_node(node, project)
        end
        links.empty? ? nil : content_tag('ul', links.join("\n").html_safe)
      end


      def render_menu_node(node, project=nil)
        if node.children.present? || !node.child_menus.nil?
          return render_menu_node_with_children(node, project)
        else
          caption, url, selected = extract_node_details(node, project)
          return content_tag('li',
                               render_single_menu_node(node, caption, url, selected))
        end
      end


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Redmine是一个开源的项目管理工具,用于跟踪和管理项目的进展、问题和任务。升级Redmine可以带来许多好处,包括修复漏洞、增加功能和提高性能。下面是升级Redmine的一般步骤: 1.备份数据库:在升级之前,务必备份Redmine的数据库,以防止数据丢失。 2.备份文件:同样地,还需要备份Redmine文件和配置,包括插件、题和自定义修改等。 3.下载新版本:从Redmine官方网站或其他可信来源下载最新版本的Redmine。 4.解压文件:将下载的压缩包解压到一个新的目录中。 5.合并自定义修改:如果之前对Redmine进行了自定义修改,需要将这些修改应用到新版本中。可以使用比较工具来比较旧版本和新版本之间的差异,并手动合并修改。 6.更新Gemfile:打开Gemfile文件,将其中的Redmine版本号更新为新版本。 7.更新依赖库:运行bundle install命令来更新Redmine所依赖的库。 8.运行数据库迁移:运行rake db:migrate命令来执行数据库迁移,以更新数据库结构。 9.重新编译资产:运行rake assets:precompile命令来重新编译Redmine的资产文件。 10.重启Redmine:重启Redmine应用程序,以使升级生效。 请注意,升级Redmine可能会涉及到一些特定的步骤和注意事项,具体取决于你当前使用的Redmine版本和所需升级的版本。因此,在进行升级之前,建议先阅读Redmine官方文档或社区论坛上的相关指南,以确保顺利完成升级过程。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值