Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage questions #20

Closed
marltu opened this issue Aug 25, 2011 · 3 comments
Closed

Usage questions #20

marltu opened this issue Aug 25, 2011 · 3 comments
Labels

Comments

@marltu
Copy link

marltu commented Aug 25, 2011

Typical scenario: there are two menus (representing one tree), one on top (tab based, contains 1st level items), and sidemenu (contains 2nd and 3rd level items)

Tree structure looks like this:

  • Home
  • About
  • User
    • Change password
    • Messaging
      • Read messages
        • Latest
        • Unread
  • Legal

Top menu items:

  • Home
  • About
  • User
  • Legal

Side menu shows two levels starting from top menu. When any page in tree of "User" is selected, sidemenu should be:

  • Change password
  • Messaging
    • Read messages

Question: how do I show sidemenu?

Possible options are:

  1. using trunk -- problem is you don't know which branch of top menu is selected.
  2. using this-* -- problem is that "this" position changes depending on current page.

Is it possible to get something like current-active-branch-2nd-level-from-top and item.is_in_active_branch()

Thank you.

@idlesign
Copy link
Owner

Hi,

It seems that the effect could be achived by using the second option and playing around with custom templates.

Something similar to 'item.is_in_active_branch' feature is planned. Can say nothing about 'current-active-branch-2nd-level-from-top' for now, except that such-long-identifiers make me feel uneasy %)

@marltu
Copy link
Author

marltu commented Aug 25, 2011

Could you elaborate on how i would do this by using this-*

@idlesign
Copy link
Owner

idlesign commented Sep 1, 2011

Sorry for the delay.

I think you can try something like the following way:

  1. Override template for main menu;
  2. In overriden template find current branch item (I've just made a commit introducing 'in_current_branch' item property);
  3. Copy found item into some variable of the main document context (e.g.: variable 'my_current_root');
  4. Use that variable in 'sitetree_menu' tag instead of hard-coded alias.

Moreover in your templates you can play around with 'depth' items property.

@idlesign idlesign closed this as completed Oct 4, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants