Template:Navbox with collapsible groups/doc: Difference between revisions

From The Sims Wiki, a collaborative database for The Sims series
Jump to navigation Jump to search
Content added Content deleted
sims>A morris
mNo edit summary
sims>A morris
Line 160: Line 160:
This example shows {{t|Navbox}}, {{t|Navbox with collapsible groups}} and {{t|Navbox with columns}} all working together. Press the edit button for the section to view the code. Note that each of the child navboxes has the first parameter set to <code>child</code>
This example shows {{t|Navbox}}, {{t|Navbox with collapsible groups}} and {{t|Navbox with columns}} all working together. Press the edit button for the section to view the code. Note that each of the child navboxes has the first parameter set to <code>child</code>
{{Navbox with collapsible groups
{{Navbox with collapsible groups
|name = Navbox with collapsible groups
|name = Aspirations
|title= [[Aspiration]]s in ''[[The Sims 2]]''
|title = Navbox, Navbox with columns, and Navbox with collapsible groups together
|groupstyle=text-align: center;
|selected = {{{1|}}}
|liststyle=font-size:75%;text-align: center;


|group1 = [[:Category:Scouting|The Scouting Movement]]
|group1 = PC and Mac
|list1= {{Navbox with columns|child
|abbr1 = movement
|colwidth = 16%
|list1 = [[Scouting]] ·''[[Scouting for Boys]]'' ·[[Scout method]] ·[[Scout Law]] ·[[Scout Promise]] ·[[Scout Motto]] ·[[Wood Badge]] ·[[Age groups in Scouting and Guiding]] ·[[Cub Scout]] ·[[Boy Scout]] ·[[Rover Scout]] ·[[Brownie (Girl Guides)|Brownie]] ·[[Girl Guiding and Girl Scouting]] ·[[Ranger (Girl Guide)]] ·[[Jamboree (Scouting)|Jamboree]] ·[[Scout Leader]] ·[[World Organization of the Scout Movement|WOSM]] ·[[World Association of Girl Guides and Girl Scouts|WAGGGS]] ·[[Non-aligned Scouting and Scout-like organisations|Non-aligned organisations]] ·[[Scouting controversy and conflict]] ·[[Scouting in popular culture]] ·[[List of Scouts]] ·[[List of highest awards in Scouting]]
|col6width = 20%
|colstyle=text-align: center;


|col1= [[File:Growup.gif|link=Grow Up]]<br />[[Grow Up]]
|list2 = {{Navbox|child
|col2= [[File:Family.gif|link=Family (aspiration)]]<br />[[Family (aspiration)|Family]]
|title = [[French colonial empires|Former French colonies]] in [[Africa]] and the [[Indian Ocean]]
|col3= [[File:Knowledge.gif|link=Knowledge]] [[Knowledge]]
|state = {{#ifeq:{{{1|}}}|french|uncollapsed|collapsed}}
|col4= [[File:Romance.gif|link=Romance]]<br />[[Romance]]
|titlestyle = background#
|col5= [[File:Fortune.gif|link=Fortune]]<br />[[Fortune]]
|groupstyle = background:lavender;
|col6= [[File:Popularity.gif|link=Popularity]]<br />[[Popularity]]
}}
{{Navbox with columns|child
|colheaderstyle=text-align: center;background-color:#C0C0C0;
|colstyle=text-align: center;


|col1header = Removed aspirations
|group1 = [[Mahgreb]]
|col1= [[Power (aspiration)|Power]] · [[Aspiration#Defunct|Craft]]
|list1 = [[French rule in Algeria|Algeria]] · [[French Morocco|Morocco]]&nbsp;<small>([[Arguin|Arguin Island]])</small> · [[History of Tunisia|Tunisia]]


|col2header = ''[[The Sims 2: Nightlife|Nightlife]]''
|group2 = [[French West Africa]]
|col2 = {{Navbox with columns|child
|list2 = [[History of Côte d'Ivoire#French Period|Côte d'Ivoire]] · [[French Dahomey|Dahomey]] · [[French Sudan]] · [[French Guinea|Guinea]] · [[History of Mauritania#French colonization and post-colonial history|Mauritania]] · [[History of Niger#Colonization|Niger]] · [[History of Senegal|Senegal]] · [[French Upper Volta|Upper Volta]]


|colwidth = 50%
|group3 = &nbsp;
|colstyle=text-align: center;
|list3 = [[French Togoland]] · [[James Island (The Gambia)|James Island]]


|col1= [[File:Pleasure.gif|link=Pleasure]] <br /> [[Pleasure]]
|group4 = [[French Equatorial Africa]]
|col2= [[File:Grilled cheese.gif|link=Grilled Cheese]] <br /> [[Grilled Cheese|Grilled Cheese]]
|list4 = [[Colonial Chad|Chad]] · [[History of Gabon|Gabon]] · [[History of the Republic of the Congo|Middle Congo]] · [[Oubangui-Chari]]
}}
}}
|list2= {{Navbox with columns|child
|title = Consoles and handhelds
|colstyle = font-size:75%;text-align:center;
|colheaderstyle= font-size:75%;text-align:center;background-color:#C0C0C0


|col1width = 30%
|group5 = [[Comoros]]
|col2width = 40%
|list5 = [[Anjouan]] · [[Grande Comore]] · [[Mohéli]]
|col3width = 30%


|col1header = [[The Sims 2 (console)|Console]] and<br>[[The Sims 2 Pets (console)|''Pets'' console]]
|group6 = &nbsp;
|col2header = [[The Sims 2 (GBA)|Game Boy Advance]]
|list6 = [[History of Djibouti#French interest|French Somaliland (Djibouti)]] · [[History of Madagascar#French control|Madagascar]] · [[Mauritius|Ile de France]] · [[Seychelles]]
|col3header = [[The Sims 2 (Nintendo DS)|Nintendo DS]]


|col1 = [[File:Creativity.png|link=Creativity (aspiration)]]<br />[[Creativity (aspiration)|Creativity]]
}}


|col2 = {{Navbox with columns|child
|group3 = [[:Category:Scouting in the United Kingdom|Scouting in the United Kingdom]]
|colwidth = 33%
|abbr3 = Scouting
|colstyle = text-align:center;
|list3 = [[The Scout Association]] ·[[Girlguiding UK]] ·[[Beaver Scouts]] ·[[Cub Section (UK)]] ·[[Venture Scout]] ·[[Explorer Scouts]] ·[[Brownie (Girl Guides)]] ·[[Ranger (Girl Guide)]] ·[[Rainbow (Girl Guides)]] ·[[Scout Network]] ·[[Chief Scout (United Kingdom)]] ·[[Scout Counties]] ·[[Scout District]] ·[[Scout Section (UK)]] ·[[Scout Activity Centre]] ·[[Young Leaders (The Scout Association)|Young Leaders]]


|col1 = [[File:Friendly.png|45px|link=Friendly (aspiration)]]<br />[[Friendly (aspiration)|Friendly]]
|list4 = {{Navbox with columns|child
|col2 = [[File:Romantic.png|45px|link=Romantic]]<br />[[Romantic]]
|state = {{#ifeq:{{{1|}}}|coltest|uncollapsed|collapsed}}
|col3= [[File:Intimidating.png|45px|link=Intimidating]]<br />[[Intimidating]]
|title = Navbox with columns nested in itself
}}
|colstyle = text-align:center;


|col3 = [[File:Party.png|46px|link=Party (aspiration)]]<br />[[Party (aspiration)|Party]]
|col1width = 33%
|col2width = 17%
|col3width = 33%
|col4width = 17%

|col1header = Col1Header
|col2header = Col2Header
|col3header = Col3Header
|col4header = Col4Header

|col1 = {{Navbox with columns|child
|colwidth = 50%
|colstyle = text-align:center;

|col1header = Col1.1Header
|col2header = Col1.2Header

|col1 = Col1.1
|col2 = Col1.2
}}

|col2 = Col2

|col3 = {{Navbox with columns|child
|colwidth = 33%
|colstyle = text-align:center;

|col1header = Col3.1Header
|col2header = Col3.2Header
|col3header = Col3.3Header

|col1 = Col3.1
|col2 = Col3.2
|col3 = Col3.3
}}

|col4 = Col4
}}


}}
}}
}}



Revision as of 21:48, 5 March 2011

This template produces a navigational template that has groups of relevant articles on a certain topic. All groups are hidden by default. However, with a parameter call, an individual group can be shown that has the other articles in the same group.

Usage

Please remove the parameters that are left blank. The template currently supports up to 10 groups/lists but more can be added if needed. You should use a minimum of two groups/lists; otherwise, use {{Navbox}} instead.

{{Navbox with collapsible groups
|name = {{subst:PAGENAME}}
|state = 
|selected = {{{1|}}}

|title = 
|titlestyle = 
|groupstyle = 
|image = 

|group1 = 
|abbr1 = 
|list1 =

|group2 = 
|abbr2 = 
|list2 = 

 ...

|group10 = 
|abbr10 = 
|list10 = 
}}

Parameters

This template shares many common parameters with its sister templates {{Navbox}} and {{Navbox with columns}}. The common parameters are marked with a cross. Please refer to the documentation of {{Navbox}} for more in depth descriptions and examples of those parameters.

Setup parameters

name
The name of the template. The name of this template, for example, is "Navbox with collapsible groups".
state [autocollapse, uncollapsed, collapsed, plain, off]
The initial state of the show/hide feature for the main title. See {{Navbox}} for more information. Does not affect display or hiding of group items, see staten, below.
navbar
Possible values are plain, off, and the default value of blank. See {{Navbox}} for more information.
border
Possible values are child, none, and the default value of blank. Set to child if you wish to use the navbox inside of another navbox; with this option, the child navbox is borderless and fits snuggly inside of its parent navbox. The parent navbox may be the list area of {{Navbox}}, the columns of a {{Navbox with columns}}, or a list area of {{Navbox with collapsible groups}}. See {{Navbox}} for more information and examples.

Basic data parameters

title
The title of the template, displayed centered in the titlebar at the top of the template.
above
Text or other elements to appear above groups/lists.
image
Image to the right of all of the groups/lists.
imageleft
Image to the left of all of the groups/lists.
below
Text or other elements to appear below the groups/lists.

Group/list parameters

groupn
The title of each section.
listn
The content/wikilinks that will be shown in the group. Use dots or bullets as separators (see the See also section). A {{Navbox}} or {{Navbox with columns}} can optionally be used here with its border = child parameter set. If this is done, leave the corresponding groupn blank, as the child navbox will already provide the collapsible feature.
abbrn
This is the abbreviation of the group. See selected parameter immediately below to see how to use this parameter. This parameter is optional, but recommended.
selected
If the value of selected equals the value of abbrn, then listn is uncollapsed and all other lists are collapsed. If selected is left blank, or if it does not match any abbrn, then all groups are collapsed. Usually this parameter should be set to {{{1|}}}. Since this template is a base template for others, there has to be a way to pass the group parameter from the article, to the secondary template to this one.
staten [autocollapse, uncollapsed, collapsed, plain, off]
The initial collapsible state of listn. Set to collapsed by default. Overridden to uncollapsed if selected equals abbrn.
imagen
An image to appear in the listn content area on the right side.
imageleftn
An image to appear in the listn content area on the left side.

Style parameters

bodystyle
CSS style/s to apply to the entire template
titlestyle
CSS style/s to apply to titlebar; usually background:color. The color of wikilink text must be manually changed using span tags. For example use title = [[Scouting|<span style="color:ivory;">Scouting</span>]] to change the color of the link to ivory. The [show]/[hide] button and the vde link button use the color set in the titlestyle parameter. Here is an example of setting the titlestyle:
titlestyle = background:darkgreen;color:ivory;
abovestyle
belowstyle
CSS style/s to apply to the above and below parameters, respectively.
basestyle
CSS style/s to apply to the title, above, below, and groupn parameters, all at the same time.
imagestyle
CSS style/s to apply to the image parameter. Does not get applied to the imagen parameters.
imageleftstyle
CSS style/s to apply to the imageleft parameter. Does not get applied to the imageleftn parameters.
groupstyle
CSS style/s to apply to all group heading parameters. Visit this website to get a lighter color similar to the title background color. Example:
groupstyle = background:lightgreen;
groupnstyle
CSS style/s to apply to a specific group heading; overrides any CSS styles set in groupstyle.
liststyle
CSS style/s to apply to all list content parameters.
listnstyle
CSS style/s to apply to specific list content parameters; overrides any CSS styles set in liststyle.
listpadding
Padding to have in each list cell; defaults to 0.25em on the left/right and 0em on the top/bottom.

Microformat parameters

bodyclass
This parameter is inserted into the "class" attribute for the infobox as a whole.
titleclass
This parameter is inserted into the "class" attribute for the infobox's title caption.
See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Examples

Basic example

{{Navbox with collapsible groups
|name = Patch-nav
|title = [[patch notes|Patches]] <small>[[:Category:Patches and updates|(Category)]]</small>
|titlestyle = background-color:#BFD7FF;
|liststyle = font-size:90%;

|group1 = [[patch notes#The Sims|The Sims]]
|group1style = background-color:#ffccaa;
|list1 = [[The Sims Deluxe Edition/patch|Deluxe Edition]] · [[The Sims: Hot Date/patch|Hot Date]] · [[The Sims: Unleashed/patch|Unleashed]]

|group2 = [[patch notes#The Sims 2|The Sims 2]]
|group2style = background-color:#ffffaa;
|list2 = [[The Sims 2/patch|The Sims 2]] · [[The Sims 2: University/patch|University]] · [[The Sims 2: Nightlife/patch|Nightlife]] · [[The Sims 2: Open for Business/patch|Open for Business]] · [[The Sims 2: Pets/patch|Pets]] · [[The Sims 2: Seasons/patch|Seasons]] · [[The Sims 2: Bon Voyage/patch|Bon Voyage]] · [[The Sims 2: FreeTime/patch|FreeTime]] · [[The Sims 2: Apartment Life/patch|Apartment Life]]

[[The Sims 2: Family Fun Stuff/patch|Family Fun Stuff]] · [[The Exchange#Patch|The Exchange]]

|group3 = [[The Sims 3/patch|The Sims 3]]
|group3style = background-color:#ccffaa;
|list3 = '''[[The Sims 3/patch|Index]]''' · [[The Sims 3/Patch 1|Patch 1]] · [[The Sims 3/Patch 2|Patch 2]] · [[The Sims 3/Patch 3|Patch 3]] · [[The Sims 3/Patch 4|Patch 4]] · [[The Sims 3/Patch 6|Patch 6]] · [[The Sims 3/Patch 7|Patch 7]] · [[The Sims 3/Patch 8|Patch 8]] · [[The Sims 3/Patch 9|Patch 9]] · [[The Sims 3/Patch 10|Patch 10]] · [[The Sims 3/Patch 11|Patch 11]] · [[The Sims 3/Patch 12|Patch 12]] · [[The Sims 3/Patch 14|Patch 14]] · [[The Sims 3/Patch 15|Patch 15]] · [[The Sims 3/Patch 17|Patch 17]] · [[The Sims 3/Patch 18|Patch 18]] · [[The Sims 3/Patch 19|Patch 19]]

[[Create a World#Download|Create a World]]
}}

Nesting other Navbox forms

This example shows {{Navbox}}, {{Navbox with collapsible groups}} and {{Navbox with columns}} all working together. Press the edit button for the section to view the code. Note that each of the child navboxes has the first parameter set to child

Nesting Navboxes to get more groups/lists

You can conveniently nest Navboxes, including {{Navbox with collapsible groups}}, to get an unlimited number of groups/lists. The following example uses one instance of {{Navbox with collapsible groups}} to get the first 10 collapsible groups, a nested instance to get the next 10, and another nested instance to get the last 6. See the code to learn how it works. It is fairly simple to extend this to as many groups/lists as you like:

See also