User:Mtew/templates/PageNav/FolderTabs/doc

=Usage=

Positional

 * Each positional parameter specifies the text to appear on the tab.
 * The parameter should not be a link.
 * Other enumerated keyword parameters can be specified to provide additional attributes.
 * The current implementation supports eleven (11) positional parameters.

Enumerated keywords
&lt;n&gt; is the number of the corresponding positional parameter.

page &lt;n&gt; =
 * The name of the page the tab references. If present, it will be combined with the positional parameter to form a link.

path &lt;n&gt; =
 * A path name used to detect matches for sub-pages.

SelectedColor &lt;n&gt; =
 * The background color of the selected tab. Defaults to the value of the unenumerated keyword SelectedColor.

UnselectedColor &lt;n&gt; =
 * The background color of the unselected tab. Defaults to the value of the unenumerated keyword UnselectedColor.

Others
 * To Be Supplied as needed.

Required keywords
none

Optional keywords
Select=
 * Specifies the tab text to be matched.

level=
 * A suffix to be used when checking for a page or path match. The default is no suffix, which will cause the tab for the current page to be selected.  '/..' would cause the tab for the parent page to be selected.

BackgroundColor=
 * The color for the background behind and between the tabs. Default value is #FFFFFF, a.k.a white.

SelectedColor=
 * The background color of the selected tab. Default value is #FFFFFF, a.k.a. white.

UnselectedColor=
 * The background color of the unselected tabs. Default value is #E0E0E0, a light grey.

BorderColor=
 * The color of the tab's border. Default value is #000000, a.k.a. black.

CornerRadius=
 * How much to round the top corners of the tabs. Default value is 4px.

wrap=
 * 'no' prevents the text in the tab being wrapped. Default value is to allow wrapping.

Others...
 * TBS

Note on using many tabs
If you have more tabs than will fit on one row, you will need to split the tabs into several rows by invoking &#x7b;&#x7b;FileTabs&#x7c;&hellip; multiple times in your tab list template. 'Select&zwj;=&zwj;0' can be used for rows that do not contain the selected tab. The row with the selected tab should be last and should contain something like 'Select&zwj; =&#x7b;&#x7b;&#x7b;tab&#x7d;&#x7d;&#x7d;'. There should not be a line break between the template invocations for each row.

You will probably need multiple variants of the tab list template, each with a different row last. Warning You will have to invoke the correctly ordered tab list variant on each page.

While maintaining several variants of a tab list is painful, the information needed and the computation resources needed to automatically split up a long list of tabs is not available and would be inappropriate to use in a WIKI.

In-line form
&#x7b;&#x7b;&hellip;FolderTabs &#x7c;First Tab&#x7c;page1=Page1&#x7c;Second Tab&#x7c;Third Tab&#x7c;Fourth Tab(#x7cSelect=Second Tab#x7d;&#x7d;

Multi-line form
&#x7b;&#x7b;&hellip;FolderTabs &#x7c;First Tab&#x7c;page1=Page1 &#x7c;Second Tab &#x7c;Third Tab &#x7c;Fourth Tab &#x7c;Select=Second Tab &#x7d;&#x7d;

Results
Note: These examples also serve as regression tests.

Multi-line form
Note: An earlier implementation of this template had trouble with this form.

=Contributors= TheRave 's Tabs are the artistic and stylistic origin of these templates.

mtew (talk)          November 2008       – Initiial Development. poke (talk)      27 December 2008       – Assistance with page matching.

=Requirements=

Goals

 * Display a single row of page tabs that switch pages when one is activated.
 * A page may have several different sets of tabs a the top reflecting different levels in the structure of the overall page set.
 * The coloring of all the tabs should be parameters in the tab list.
 * Reasonable defaults for unspecified parameters.
 * The tab list should be self counting.
 * There may be a restriction on the number of tabs in each list.
 * 'Western' page progression.  Not Manga order.
 * Use WIKI table constructs, not HTML.
 * Automatic detection of page or path matches. That is it should be possible to reorder the tab descriptions with only simple and obvious changes.

Non-Goals

 * Multiple row tabs is NOT a goal!  However comments on how to do a multiple row version may be included.

Environment

 * A 'trim' template exists to trim white space from strings.
 * The LoopFunctions WIKI extension is not installed BUT inactive code for LoopFunctions is required.
 * The Tab lists are to be built by the user and should probably be confined to a special directory tree. This should make actually using the tabs a bit easier.

Desirabilia

 * CSS support.

Future Directions

 * A page using this template really should have to supply nothing but the relative level, compared to the current page, of the tab bar. In particular, it should not have to know its index in the tab bar or the display text for the tab.  Both limit the ability to change the tab structure.  That index problem was the trigger for this effort; it was very tedious to have to edit each referencing page when the tab order was changed.  The same is true, but to a lesser extent, now if the display text is changed.

=Internals=

FolderTabs
The page switching implementation template – It constructs a one-row table of links.
 * Starts with the WIKI table marker and style specifications.
 * For each positional parameter, it, the corresponding enumerated keyword parameters and the global keyword parameters are passed to the 'tab' (singular) template. Note that the selected/unselected check is no longer done in this template.
 * After the positional parameters, a dummy cell fills in the rest of the top of the folder line.
 * Last, the WIKI table is ended and the template is completed.

Folder_Tab
Displays a tab – the background color, bottom boarder and some of the text characteristics vary between selected and unselected tabs. The tab is considered to be selected if any one if the following criteria is met – Note that the 'trim' template fixes problems caused by line breaks in positional parameters. = Status and Implementation Notes =
 * Display an initial spacing cell. Its width will be wider if the tab is selected.
 * Display the tab text or a link (if 'page' is not blank) with the background and bottom border depending on whether the tab is selected or not.
 * Display a final spacing cell. Its width will be wider if the tab is selected.
 * The current page, modified by level, matches the 'page' parameter,
 * The current page, modified by level, matches the 'path' parameter,
 * The tab text matches the the 'Select' parameter.

FolderTabs
This is stable.
 * The last change removed most of the parameter default setting. The only remaining default setting is the bottom boarder color for the last cell.
 * Eleven positional parameters are allowed. The tital tab text has to be quite short to fit this many tabs on a single line.
 * The #foreach version has not been written yet.

Folder_Tab
Work needed 16:49, 14 January 2009 (UTC)
 * The selection criteria is done with nested #if and #ifeq checks. Since the WIKI apparently evaluates each branch whether it is used or not, the nesting is an unnecessary complication.  This needs to be rewritten to concatenate the results of each check, effectively 'or'ing them.

Overall
With some cleanup, I think it could be a good candidate for a main line template. = Work List =
 * Test on different browsers. IE in particular.
 * Pixels is the wrong unit for defaults. .01 Pica?
 * Additional 'style' parameters or a generalized style parameter if needed.
 * Tabs – Only on an as required basis: Handle more positional parameters.
 * Move this and related templates to the main template name space.