Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
15 posts Page 2 of 2
@Blutbaden,
am I right in understanding that what you want is this -
suppose the sidebar has several groups (i.e. collapsible regions) with several templates below each group.
Now if it so happens that for a certain admin *all* the templates below a particular group are hidden, what we are left with is the empty group.
You'd like that if there are no templates below a group, that group should also not show.

Please let me know if that is correct. Thanks.
Yes, correct. :)

Automatically or there could be config options for groups like there is for templates.
Would something like this be possible in 2.0?
@Blutbaden,

We can do that in v2.0 by overriding the theme snippet that renders the sidebar with our own version that first checks if a group has any children before displaying it.

The concept of theme overriding has been discussed at viewtopic.php?f=5&t=10241 (under 'Theming' heading) so if you need more info please take a look at that post.

Here is how we'll use it for your problem.
First of all, we'll signal to Couch that we have our own custom theme that can override GUI items of the admin-panel.
To do that, find the following line in couch/config.php file.and uncomment it (i.e. remove the two leading slashes) -
// 26.
// If the admin-panel uses a custom theme, set the following to the folder-name of the theme.
// Theme folder is expected to be within the 'couch/theme' folder. No leading or trailing slashes please.
//define( 'K_ADMIN_THEME', 'sample' );

This is the sample theme that ships with Couch and you can its folder at 'couch/theme/sample'.

As explained in the v2.0 post I mentioned, once the theme is activated, all snippets placed in this folder will be used by Couch in place of the system theme snippets (found in 'couch/theme/_system' folder) that it normally uses.

We are interested only in overriding the snippet used for the sidebar. That happens to be 'sidebar.html'.

I am attaching a modified version of the system sidebar.html. Please extract it from the zip and place it in the 'sample' folder mentioned above.

And that should be it.
The sidebar should now only show the headers that have atleast one child beneath them.

Hope it helps. Do let me know.

Attachments

All this is very useful KK, thank you very much :D
15 posts Page 2 of 2

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests