Snippet: Recursive menu in Stacey 3.*
Just wanted to share a snippet for creating a recursive menu in Stacey 3.* with Twig. Simply create a partial template partials/root-menu.html:
{% for child in node|default(page.root) %}
<li{% if child.children_count > 0 %} class=has-dropdown{% endif %}>
<a href="/{{ child.permalink }}">{{ child.label|default(child.slug|title) }}</a>
{% if child.children_count > 0 %}
<ul class=dropdown>
{% include "partials/root-menu.html" with {'node': child.children} %}
</ul>
{% endif %}
</li>
{% endfor %}
In the above, you may need to edit the content of the <a> link. Add it to your main template like this:
<ul class="your-menu-class">
{% include 'partials/root-menu.html' %}
</ul>
Nice!
How about a "Stacey snippets" in the Wiki?
Indeed. I was perhaps hoping for a snippets section on a new Stacey website.
@o-l-e Snippets in the Wiki is an awesome idea. So much so that I thought I'd take a crack at adding it to the Wiki. I used @mjau-mjau 's snippet as the first entry. What do you all think? https://github.com/kolber/stacey/wiki
@pbatts that's great! I added a snippet in there just now together with @mjau-mjau 's snippet.
Would be nice with a possibility to post new snippet without having to edit the same post though. Is there any way of creating individual posts in snippets? Maybe a list similar to the wiki itself?
@o-l-e I agree, it would be nice to post new snippet without having to edit the same post. I can see where things could get messy.
It would be easy enough to create sub-pages under the 'Snippets' page. But, that will eventually get messy as well. We would end up with numerous snippet page links showing on the Wiki's Home page and in the menu on the right side of all pages.
Perhaps a better approach would be if @kolber could create a new repo strictly for the creation of a snippets wiki. I've thrown something together here to demonstrate how it might be done.
@o-l-e Btw, love your snippet.
Thanks @pbatts i use the active-class partial all the time now, it really does work very well. I don't know what the best solution for the snippets page is. It would be really nice to see it come alive though :)
@o-l-e I have emailed @kolber and asked if this is something he would be interested in and if he would consider my above suggestion a viable solution and, if so, to create the snippets repo.
Great!
Nice to see there are still figures blowing on the embers! Shortly, I have an ajax-based control panel ready to be used with Stacey, and would be cool if anyone wanted to try it ...
@mjau-mjau i am sure we all would want to hear more about your control panel. I do!
Sure! Same here, I'd be happy to try the panel @mjau-mjau Cheers!
@mjau-mjau Definitely looking forward to seeing what you've cooked up.
All, @kolber has created a new repo for a Snippets Wiki. View it here https://github.com/kolber/Stacey-Snippets/wiki Enjoy.
A quick glance at the Stacey-friendly ajax panel for those who are interested. This is basically a hurried design version 0.0.1, and we have lots of plans for changes. I have disabled write permissions in this folder, so you won't be able to actually make any changes. http://imagevuex.com/demo/x3/panel/ login as admin/admin
Goals For this panel, we basically had a few fundamental goals:
- Allow the user to add- and manage folders (pages) inside the content structure.
- Allow the user to easily edit page content files (normally *.yml or *txt file).
- Allow the user to upload- and manage files in each folder (galleries etc).
- Allow the user to easily edit settings (if permitted).
DB There is an optional database-login for the panel, which does not affect Stacey in any way, but it allows multiple users, improved user-management, user-permissions and edit-profile. Screens: http://d.pr/i/17iSS http://d.pr/i/Ox96 http://d.pr/i/LDOE
Thanks @pbatts and @kolber for the wiki! @mjau-mjau the control panel looks incredible!
This looks fantastic!
@mjau-mjau ajax panel looks awesome.