luci-base: add ability to hide section titles
authorDavid Härdeman <[email protected]>
Wed, 22 Oct 2025 21:22:14 +0000 (23:22 +0200)
committerPaul Donald <[email protected]>
Thu, 23 Oct 2025 15:05:03 +0000 (17:05 +0200)
commit545de2a4b5b9881104bb5b3bd82a1f1ccf6b6b8a
treee9ead20a21353836c2a1a76cc21a784ba4ee04b2
parent1b8564ead6931038a4822652c885c7d54d2e4b38
luci-base: add ability to hide section titles

The rationale here is that tabbed CBIMaps were introduced in commit
082fd9ff10b.

With tabbed maps, code could typically look like this:

m = new form.Map('foobar', _('FooBar'));
m.tabbed = true;
s = m.section(form.TypedSection, 'foo', _('foo Settings'));

The problem is that the title of "s" will be used as the name of the tab
rendered in "m", but also rendered as an <h3> right below the tab. IOW,
the same information will be presented twice, which looks weird.

Doing this instead...

m = new form.Map('foobar', _('FooBar'));
m.tabbed = true;
s = m.section(form.TypedSection, 'foo');

...means that the superfluous <h3> won't be rendered (since "s" has no
title), but the tab will then simply have the name of the section
("foo"), which can't be translated (bad).

After this change, the tabbed map can be written like this:

m = new form.Map('foobar', _('FooBar'));
m.tabbed = true;
s = m.section(form.TypedSection, 'foo', _('foo Settings'));
s.hidetitle = true;

Which will give the Map tab the name "foo Settings", but won't add a
title for the TypedSection right under the tab.

Signed-off-by: David Härdeman <[email protected]>
modules/luci-base/htdocs/luci-static/resources/form.js