User:CapitalR/Navbox/test

From Wikipedia, the free encyclopedia

This is a demonstration page for the new Navbox suite. The new Navbox template can be seen at: User:CapitalR/Navbox. It is meant to replace the existing code for the {{Navbox}} template. It should not have any significant effect on existing instances of the Navbox, but does add additional features for future Navboxes. In addition, the {{Navbox with columns}} code will be updated to {{Navbox with columns/sandbox}} and a new template, {{Navbox with collapsible sections}} will be introduced to replace {{Navigation with collapsible groups}}. All three of these templates share common parameter names, look and feel, and are compatible to be used as sub-templates in each other (in fact, the other two both just use {{Navbox}} internally to guarantee consistency).

Please feel free to edit any of the Navbox related pages in CapitalR's userpages.

The advantages of the new {{Navbox}} design are as follows:

  • Displays the same results in all browsers that I have tested (IE 6/7, Firefox, Safari, and Opera, all on Vista and XP)
  • Corrects a bug in IE where extra spaces are shown when the navbox is in the collapsed mode, and there are multiple groups/lists and an image.
  • Corrects differences in apparent font size between Firefox and IE.
  • Allows an unlimited number of lists/groups
  • Allows all groups/lists to be individually styled
  • Provides a parameter called "basestyle" that sets the style for the title, above, below, and group fields all at once. This is convenient for wanting to change the basic color of the navbox and not have to set all the style fields one at a time.
  • Allows subgroups, which are just nested navboxes with the "border" parameter set to "subgroup". There is no need for a separate "Navbox subgroup" template.
  • Allows nested navboxes (see numerous examples below) for multiple show/hide boxes in a single container
  • Post-expand size is very low, at only about 10kb for the basic box; on average, the post-expand is smaller than the current design, making the new one more efficient.
  • All parameters are optional and no display errors result from missing parameters (this includes optional title, and all lists/groups are optional)
  • Obsoletes the {{Navbox/core}} template and gets all the code in one place.
  • Provides 0.25em left and right padding inside the list area to make it easier to read. The padding can be disabled by setting "listpadding=0" (once mw:Extension:StringFunctions are enabled with the resolution of bugzilla:6455 this parameter can be obsoleted by just using "liststyle = padding:0;", but until then it is a necessary evil).
  • Imageleft is now allowed when groups are present.
  • Allows striping to be inverted (by setting "evenodd = swap", which is useful for correcting striping errors with subgroups.
  • There is more control over padding in the title when the navbar or show/hide button are not displayed.
  • When two navboxes are adjacent to each other on a page, there is now only a 1px border between them instead of a 2px border (except in IE6, which doesn't support the necessary CSS to do this, but that's okay).
  • Full support for CSS skinning.

Contents

[edit] New Navbox parameters

These are the parameters for the new {{Navbox}} template design. Parameters in magenta are common to all three Navbox suite templates. The remaining parameters are specific to {{Navbox}}. {{Navbox with columns}} and {{Navbox with collapsible sections}} have their own specific parameters, which are not listed on this doc page.

  • Setup fields
    • name: used for the VDE bar. Is a required parameter, unless one of the following is true: no title is specified, border is set to "subgroup", state is set to "plain" or "off", navbar is set to "plain" or "off"
    • state: [autocollapse, uncollapsed, collapsed, plain, off], the usual choices, with the addition of "plain" and "off", which doesn't display show/hide at all; if set to "plain", then padding is used in place of the show/hide button to keep the title centered.
    • navbar: [BLANK, plain, off], if set to "plain" or "off" then VDE is not displayed; if set to "plain" then padding is used in place of the VDE buttons to keep the title centered.
    • border: [BLANK, subgroup, none], if set to "subgroup", then the border is hidden and the navbox can be nested inside of another navbox; if set to "none", then the border is hidden and the navbox can be used in a stand-alone fashion inside of another container.
  • Information fields
    • title: same as always
    • above: same as always
    • below: same as always
    • imageleft: same as always
    • image: same as always
    • group[1-20]: same as always
    • list[1-20]: same as always
    • titlegroup: adds a group on the same line as the title; for example, use in {{US state navigation box}} for the flag. The titlegroup parameter and imageleft parameter cannot both be used at the same time.
  • Style fields
    • style: same as always
    • imageleftstyle: style for the imageleft cell in the table
    • imagestyle: style for the image cell in the table
    • titlestyle: same as always
    • basestyle: sets the titlestyle, abovestyle, belowstyle, and groupstyle all at once
    • abovestyle: same as always
    • belowstyle: same as always
    • groupstyle: same as always
    • liststyle: same as always
    • evenstyle: same as always
    • oddstyle: same as always
    • group[1-20]style: set the style for a specific group
    • list[1-20]style: set the style for a specific list
  • Advanced style fields
    • listpadding: sets the padding inside the list area. Set to 0 to eliminate the default 0.25em left and right padding on the lists. Due to complex technical reasons, simply setting "liststyle=padding:0px;" will not set the padding to 0. This extra parameter can be used in the very rare case that the padding needs to be eliminated. This parameter is meant for only advanced users who want to design a complex Navbox and not follow the default design styles.
    • evenodd: [BLANK, swap, even, odd, off]: controls whether automatic row striping of even and odd rows (currently #f9f9f9 for even rows and nothing for odd rows) is swapped (i.e. even rows get odd striping and odd rows get even striping). Setting to to "off" removes automatic striping altogether. Setting to "even" or "odd" applies that automatic striping style to all rows. This parameter has no effect on evenstyle or oddstyle (if you want to swap those, you have to do it with your own code; this is because swapping user even/odd styles is probably a very rare event, and in order to keep the code size down, this is not an included feature).
  • Deprecated parameters
    • body: does the exact same thing as list1; only used by a small number of templates. Should be advised against for consistent coding.
    • category: this is a completely pointless parameter, but someone added it to the existing Navbox design, so it's supported here for backward compatibility. It's use should be strongly advised against, because it's pointless and confusing (I'd recommend not even listing it as a parameter on the doc page to avoid having people use it).

[edit] CSS

These examples uses new CSS code that was recently added to MediaWiki:Common.css. If the examples look funny to you, then you probably need to bypass your cache, or click this link.

[edit] Known effects

While a vast majority of instances of the Navbox will be not be changed by this new implementation, a few will see slight differences.

  • One known issue is caused by the default left and right padding added to the list areas (set at 0.25em). A few current Navbox instances (about 100 or so) are designed with the expectation that the padding is 0 (as it is in the current Navbox design), and will show minor differences once the new padding is added. Those templates can be easily identified (I already ran a database dump scan to find any that are affected) and updated as soon as the new changes go into effect. The problem is relatively minor, and no one will really notice anyways, so I'm not too worried about it. I've also added a new parameter called "listpadding" which, when set to any non blank value, will cause the list padding to be set to that value instead of the 0.25em default.
  • The second issue is with {{Navbox subgroup}}. Again, due to the default list padding, there will be a big gap before the subgroups. This can temporarily be fixed with a table margin change to the subgroup templates. After that, all instances of Navbox subgroup (and all of the other subgroup templates hanging around) can be converted to just a Navbox, with "border = subgroup" set. Following that, Navbox subgroup can be deprecated. Again, I've got a tool ready to make these changes quickly upon the new Navbox code going live.

[edit] Integration plan

The main plan for getting this code in the live navbox template is as follows:

  1. Test it fully to fix any bugs, add additional features as needed, and ensure backward compatability.
  2. Get CSS into MediaWiki:Common.css and wait at least 31 days (done, waiting until May 1, 2008).
  3. Agree on an exact time when the new code will be added to the live navbox template; this is so that I (User:CapitalR) and others can be on hand to immediately identify and fix any problems with the code, and to fix any instances that might need tweaking (for example, all "Navbox subgroup" instances will be immediately converted to just "Navbox" with border=subgroup set; also, instances of Navbox that use "navbar=plain" or "state=plain" will need to be checked to ensure that title padding is okay).
  4. At the agreed upon time, add the code to the live navbox template, and update the CSS table.navbox class to have padding go from 2px to 1px (this must be done at the same time as the navbox code update, instead of being done a month ahead of time like the other changes).

[edit] Basic tests

[edit] Subgroup tests

[edit] Container tests

[edit] Style tests

[edit] Group width tests

[edit] Navbar and state tests

[edit] Titlegroup tests


[edit] Missing parameter tests

[edit] Row striping tests


[edit] Additional tests

[edit] Using Navbox with columns / Navbox with collapsible sections

[edit] Tests of actual Navboxes