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

Render menu starting at certain depth #145

Open
theduke opened this issue Dec 22, 2014 · 8 comments
Open

Render menu starting at certain depth #145

theduke opened this issue Dec 22, 2014 · 8 comments

Comments

@theduke
Copy link

theduke commented Dec 22, 2014

I need to render a sites submenu which always starts with the tree items beginning with depth 3 (assuming that root is depth 1).

I do not see a way to do this with sitetree_menu(). this-siblings etc will not work in that case, as far as I understand it. What I would need is something like

{% sitetree_menu from "nav" include "trunk-depth-3" %}

Any way to do that?

To clarify - let's assume the tree looks like this:

Root

  • A
  • - A1
  • - A2
  • B
  • - B1
  • - - B1A
  • - B2
  • C

I need the tree to always start at the third level.
Soi if A1 is active, the menu would show:

A1
A2

If B1 OR B1A were active, the menu would be:
B1
-B1A
B2


ps: I realized I can do this with 2 custom templates that do not render anything for the first two levels, but that's really awkward.

@idlesign
Copy link
Owner

Any way to do that?

No, currently no. Yet it was already proposed in some issue or even a pull request some time ago, if I'm not mistaken.

There are some questions to answer before it could be implemented: 1. 3 or any other number basically says nothing to a person making a template?; 2. if a tree is restructured will it take to also update templates and swap one obscure number to another?

Wouldn't it be more proper for your use case to try and use two different trees?

@idlesign
Copy link
Owner

Closing this. Feel free to reopen if any updates.

@vit-ivanov
Copy link

Hi!

I need this feature too, and I have a idea how to implement it.

We can set 'breakpoint' on menu item and stop on it climbing up the tree from current item.

According to example above:

  • A
  • - A1
  • - A2
  • B
  • - B1
  • - - B1A
  • - B2
  • C

We can set 'breakpoint' named 'example' on "A" and "B" items and get that we need in template calling {% sitetree_menu from "nav" breakpoint='example' %}.
It looks clear, as for me.

@idlesign
Copy link
Owner

@vit-ivanov
Hi,

Looks somewhat unclear to me: why do you want to set two breakpoints. What if someone put four, six, etc.? Thta breakpoint is it alias or an additional field?
Generally this issue is about limiting rendering depth down but not up the tree.

@vit-ivanov
Copy link

  • Root
  • - A
  • - - A1
  • - - A2
  • - B
  • - - B1
  • - - - B1A
  • - - B2
  • - C

The goal is to start rendering

  • from "A" then current item is "A1"
  • from "B" then current item is "B1" or "B1A".

Possibly we can start rendering from certain level, but it looks like bad idea — it's not a solution for some menu configurations.
My proposal is to mark "A" and "B" as stop points and stop climbing up on them.

Maybe russian? :))) skype, gtalk, icq etc

@vit-ivanov
Copy link

why do you want to set two breakpoints. What if someone put four, six, etc.? Thta breakpoint is it alias or an additional field?

Breakpoint is an additional field.

@idlesign
Copy link
Owner

Guess I got what you're up to. Need a couple of days to think that over, yet.

Maybe russian? :))) skype, gtalk, icq etc

Possibly if I have some additional questions %)

For now let's reopen the issue to not to forget.

@idlesign idlesign reopened this Mar 31, 2015
@idlesign
Copy link
Owner

idlesign commented Apr 1, 2015

Seems interesting. Yet we probably should change breakpoint for something less associated with hooks. Maybe call that field scope marker. Than we could introduce sitetree_menu tag optional clause scope and allow it to accept slicing-style value to be able to limit rendering both up and down.

Example: {% sitetree_menu from "nav" include "trunk" scope "upper_scope_marker:lower_scope_marker" %}.

That's needs to be further analysed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants