User:Mtew/templates/PageNav/FolderTabs/doc
FileTabs Template |
| | | General | | | Talk | | | Characters | | | Diaries | | | Projects | | My templates | | Special Pages | |
---|
| | Page Navigation | | Quest Progress | | | Standard Formats | |
---|
| LocLegend | | | Cat all values | | | Five Rows of Four | | | 100 Rows of Four | | | For all 1's Digits | | | For all 10's Digits | | | For all 100's Digits | |
---|
|
| For all Guideline Items | |
---|
| | | NavBar | | Folder Tabs | | Internal: A Folder Tab | | | Region Info | |
---|
Usage[edit]
Parameters[edit]
Positional[edit]
- 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[edit]
<n> is the number of the corresponding positional parameter.
page<n>=
- The name of the page the tab references. If present, it will be combined with the positional parameter to form a link.
path<n>=
- A path name used to detect matches for sub-pages.
SelectedColor<n>=
- The background color of the selected tab. Defaults to the value of the unenumerated keyword SelectedColor.
UnselectedColor<n>=
- The background color of the unselected tab. Defaults to the value of the unenumerated keyword UnselectedColor.
Others
- To Be Supplied as needed.
Required keywords[edit]
none
Optional keywords[edit]
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[edit]
If you have more tabs than will fit on one row, you will need to split the tabs into several rows by invoking {{FileTabs|… multiple times in your tab list template. 'Select=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 ={{{tab}}}'. 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.
Examples[edit]
In-line form[edit]
{{…FolderTabs |First Tab|page1=Page1|Second Tab|Third Tab|Fourth Tab(#x7cSelect=Second Tab#x7d;}
Multi-line form[edit]
{{…FolderTabs
|First Tab|page1=Page1
|Second Tab
|Third Tab
|Fourth Tab
|Select=Second Tab
}}
Results[edit]
Note: These examples also serve as regression tests.
In-line form[edit]
| First Tab | | | Second Tab | | | Third Tab | | | Fourth Tab | |
---|
Multi-line form[edit]
Note: An earlier implementation of this template had trouble with this form.
| First Tab | | Second Tab | | Third Tab | | | Fourth Tab | |
---|
Contributors[edit]
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[edit]
Goals[edit]
- 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[edit]
- Multiple row tabs is NOT a goal! However comments on how to do a multiple row version may be included.
Environment[edit]
- 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[edit]
- CSS support.
Future Directions[edit]
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[edit]
FolderTabs[edit]
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[edit]
Displays a tab – the background color, bottom boarder and some of the text characteristics vary between selected and unselected tabs.
- 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 tab is considered to be selected if any one if the following criteria is met –
- 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.
Note that the 'trim' template fixes problems caused by line breaks in positional parameters.
Status and Implementation Notes[edit]
FolderTabs[edit]
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[edit]
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[edit]
With some cleanup, I think it could be a good candidate for a main line template.
Work List[edit]
- 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.
FileTabs Template |