class="active" in toc() for the active page

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

class="active" in toc() for the active page

Post by svasti » Sun Dec 22, 2013 9:12 pm

While building the navigation of a site, I find that it is sometimes quite difficult to give the active pagename in the menu some special styling.

Usually you would add a styling. But in CMSimple it's different, as all pages are links and the active page is no link. Links css goes on top of basic css styling. So to style the active pagename you have to style the basic entry and to style the non active page names, you have to add css styling top of it the basic entries.

This is kind of upside down.

Wouldn't it be easier to have an additional class="active" for the active page? Wouldn't break any old templates.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: class="active" in toc() for the active page

Post by cmb » Sun Dec 22, 2013 9:36 pm

Hm, the active page has the class .sdoc resp. .sdocs since early versions of CMSimple. :)

Furthermore the active page is wrapped in a <span> (see http://cmsimpleforum.com/viewtopic.php?f=29&t=5364) in XH 1.6 and in CMSimple 4(.?), so this could be used alternatively (something like .menulevel span).
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

Re: class="active" in toc() for the active page

Post by svasti » Tue Dec 24, 2013 1:13 am

Oops, I think I still have to learn a lot.

svasti

svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

Re: class="active" in toc() for the active page

Post by svasti » Fri Dec 27, 2013 11:05 pm

cmb wrote:the active page has the class .sdoc resp. .sdocs since early versions of CMSimple
which can be quite tricky, consider:
A level 2 page is selected: it got class="sdocs", but its parent page also has "sdocs" if parent is selected in config,
and all subpages inherit "sdocs" as they are inside the same <li>.
cmb wrote:the active page is wrapped in a <span> ... in XH 1.6
I overlooked this. It's manu's suggestion, a great idea, as this doesn't inherit. It will make designing interesting menus easier. Why haven't we put it into 1.5.9?

By the way, what could (s)doc(s) mean? (selected) document (with sequence)? Sometimes I find the abbreviated variable names quite cryptic.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: class="active" in toc() for the active page

Post by cmb » Sat Dec 28, 2013 12:02 pm

svasti wrote:A level 2 page is selected: it got class="sdocs", but its parent page also has "sdocs" if parent is selected in config,
and all subpages inherit "sdocs" as they are inside the same <li>.
Yes, but the subpages are on another level, so you can distinguish them (requires more style rules, though).
svasti wrote:I overlooked this. It's manu's suggestion, a great idea, as this doesn't inherit. It will make designing interesting menus easier. Why haven't we put it into 1.5.9?
Nobody has suggested to do so. ;) And actually, I'm not sure if that small change might break some templates.
svasti wrote:By the way, what could (s)doc(s) mean? (selected) document (with sequence)? Sometimes I find the abbreviated variable names quite cryptic.
Indeed, the identifiers used in CMSimple are most often overly terse. I assume that the prefix "s" often means "selected" (as in $s, $su, $sl etc.; cf. $selected), and that "doc" means a single document, and "docs" (plural) means multiple documents.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply