Project

General

Profile

Actions

Patch #4250

closed

Tree based menus

Added by Eric Davis about 15 years ago. Updated almost 15 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
UI
Target version:
Start date:
2009-11-19
Due date:
% Done:

100%

Estimated time:

Description

Currently Redmine's menus are only liner: Overview, Activity...

These patches convert the menus into a tree structure. The first patch will let menus be grouped and organized like so:

  • Overview
  • Issues
    • New Issue
  • Activity
  • Settings

Which renders to html as:

<div id="main-menu">
  <ul>
    ... other menu items here ...
    <li>
      <a class="issues" href="/projects/abc/issues">Issues</a>
      <ul class="menu-children">
        <li>
          <a class="new-issue" accesskey="7" href="/projects/abc/issues/new">New issue</a>
        </li>
      </ul>
    </li>
    ... other items ...
  </ul>
</div>

The second patch will allow a menu to define an "unattached" menu. This type of menu is a chunk of code that will create a menu on the fly, based on the current page's data (e.g. current project). I've used this to add a menu that lists all of the Custom Queries on a project:

<div id="main-menu">
  <ul>
    ... other menu items here ...
    <li>
      <a class="issues" href="/projects/abc/issues">Issues</a>
      <ul class="menu-children">
        <li>
          <a class="new-issue" accesskey="7" href="/projects/abc/issues/new">New issue</a>
        </li>
      </ul>
      <ul class="menu-children unattached">
        <li>
          <a class="query-2" href="/projects/cremin4/issues?query_id=2">Late</a>
          <a class="query-3" href="/projects/cremin4/issues?query_id=3">Needs an estimate</a>
      </li>
      </ul>

    </li>
    ... other items ...
  </ul>
</div>

These two patches (plus some javascript and custom css) are what makes the Shane and Peter theme work. You can see how the theme is building the menus in it's init.rb

Both of these patches are backwards compatible. They only change how menus are stored internally and provide a some new methods for core/plugin menus. I've also included a bunch of tests for the MenuManager (which was untested). Once I get a code review or two, I can commit these. If anyone has any questions, feel free to ask.


Files


Related issues

Related to Redmine - Patch #6427: Create CSS to support child and nested menusClosed2010-09-17

Actions
Actions

Also available in: Atom PDF