Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Infobox rank: Difference between revisions

Template page
Create Template:Infobox rank; Infobox player now auto-categorises by rank so rank member counts can be derived live via PAGESINCATEGORY
 
m No-wrap Current holders label, suppress Forums' 'on the Loka Forums' suffix, ribbon shows Staff Rank/Community Rank, desc renamed to purpose as its own row, title colour now pulled from {{Rank}} instead of a separate colour= param
Line 1: Line 1:
<includeonly><templatestyles src="Template:Infobox rank/styles.css" />{{Infobox
<includeonly><templatestyles src="Template:Infobox rank/styles.css" />{{Infobox
|name={{#if:{{{colour|{{{color|}}}}}}|<span style="color:#{{{colour|{{{color|}}}}}};">{{{name|{{PAGENAME}}}}}</span>|{{{name|{{PAGENAME}}}}}}}
|name={{Rank|{{{name|{{PAGENAME}}}}}}}
|image={{{image|}}}
|image={{{image|}}}
|type={{{desc|}}}
|type={{#if:{{{staff|}}}|{{#ifeq:{{lc:{{{staff|}}}}}|yes|Staff Rank|Community Rank}}}}
|content={{#if:{{{staff|}}}|<div class="loka-infobox-row"><span class="loka-infobox-row-key">Staff</span><span class="loka-infobox-row-value"><span class="loka-rank-staff loka-rank-staff--{{lc:{{{staff|}}}}}">{{{staff|}}}</span></span></div>}}{{#ifeq:{{lc:{{{staff|}}}}}|yes|<div class="loka-infobox-row"><span class="loka-infobox-row-key">Current holders</span><span class="loka-infobox-row-value">{{#if:{{{current|}}}|{{{current|}}}|[[:Category:{{{name|{{PAGENAME}}}}} holders|{{PAGESINCATEGORY:{{{name|{{PAGENAME}}}}} holders}}]]}}</span></div>}}{{#if:{{{forumid|{{{forumId|}}}}}}|<div class="loka-infobox-row"><span class="loka-infobox-row-key">Forum post</span><span class="loka-infobox-row-value">{{Forums|id={{{forumid|{{{forumId|}}}}}}}}</span></div>}}{{#if:{{{active|}}}|<div class="loka-infobox-row"><span class="loka-infobox-row-key">Active</span><span class="loka-infobox-row-value"><span class="loka-rank-active loka-rank-active--{{lc:{{{active|}}}}}">{{{active|}}}</span></span></div>}}
|content={{#if:{{{staff|}}}|<div class="loka-infobox-row"><span class="loka-infobox-row-key">Staff</span><span class="loka-infobox-row-value"><span class="loka-rank-staff loka-rank-staff--{{lc:{{{staff|}}}}}">{{{staff|}}}</span></span></div>}}{{#ifeq:{{lc:{{{staff|}}}}}|yes|<div class="loka-infobox-row"><span class="loka-infobox-row-key loka-rank-current-key">Current holders</span><span class="loka-infobox-row-value">{{#if:{{{current|}}}|{{{current|}}}|[[:Category:{{{name|{{PAGENAME}}}}} holders|{{PAGESINCATEGORY:{{{name|{{PAGENAME}}}}} holders}}]]}}</span></div>}}{{#if:{{{purpose|}}}|<div class="loka-infobox-row"><span class="loka-infobox-row-key">Purpose</span><span class="loka-infobox-row-value">{{{purpose|}}}</span></div>}}{{#if:{{{forumid|{{{forumId|}}}}}}|<div class="loka-infobox-row"><span class="loka-infobox-row-key">Forum post</span><span class="loka-infobox-row-value">{{Forums|id={{{forumid|{{{forumId|}}}}}}|on=no}}</span></div>}}{{#if:{{{active|}}}|<div class="loka-infobox-row"><span class="loka-infobox-row-key">Active</span><span class="loka-infobox-row-value"><span class="loka-rank-active loka-rank-active--{{lc:{{{active|}}}}}">{{{active|}}}</span></span></div>}}
}}[[Category:Ranks]]{{#ifeq:{{lc:{{{staff|}}}}}|yes|[[Category:Staff ranks]]}}</includeonly><noinclude>
}}[[Category:Ranks]]{{#ifeq:{{lc:{{{staff|}}}}}|yes|[[Category:Staff ranks]]}}</includeonly><noinclude>
== Usage ==
== Usage ==
Line 10: Line 10:
{{Infobox rank
{{Infobox rank
|name=Sentry
|name=Sentry
|desc=Chat Moderator
|purpose=Chat Moderator
|staff=Yes
|staff=Yes
|colour=FF5555
|forumid=79
|forumid=79
|active=Active
|active=Active
Line 27: Line 26:
|-
|-
| <code>name</code>
| <code>name</code>
| Rank name. Defaults to the page name.
| Rank name. Defaults to the page name. Also drives the infobox title's colour -- see below.
|-
|-
| <code>image</code>
| <code>image</code>
| Filename of a badge/icon image uploaded to the wiki (no <code>File:</code> prefix).
| Filename of a badge/icon image uploaded to the wiki (no <code>File:</code> prefix).
|-
|-
| <code>desc</code>
| <code>purpose</code>
| Short badge shown under the name (e.g. <code>Chat Moderator</code>, <code>Sub-admin</code>).
| Short description shown as its own row (e.g. <code>Chat Moderator</code>, <code>Sub-admin</code>).
|-
| <code>colour</code>
| Hex colour applied to the name at the top of the infobox, entered '''without''' a leading <code>#</code> (e.g. <code>FF5555</code>, not <code>#FF5555</code>). <code>color</code> also works. Same colour in both light and dark mode -- there's no separate light-mode variant field.
|-
|-
| <code>staff</code>
| <code>staff</code>
| <code>Yes</code> or <code>No</code> -- shown as a green/red badge. Also gates whether the Current holders row appears at all (see below) and whether this page is added to [[:Category:Staff ranks]].
| <code>Yes</code> or <code>No</code> -- shown as a green/red badge. Also sets the ribbon under the name ("Staff Rank" / "Community Rank"), gates whether the Current holders row appears at all (see below), and whether this page is added to [[:Category:Staff ranks]]. The ribbon and Staff row are both hidden if left unset entirely, rather than guessing.
|-
|-
| <code>current</code>
| <code>current</code>
Line 45: Line 41:
|-
|-
| <code>forumid</code>
| <code>forumid</code>
| Numerical ID from this rank's forum thread URL, e.g. <code>79</code> for <code>https://forums.lokamc.com/threads/sentry-rank.79/</code>. Passed straight through [[Template:Forums]]. <code>forumId</code> also works.
| Numerical ID from this rank's forum thread URL, e.g. <code>79</code> for <code>https://forums.lokamc.com/threads/sentry-rank.79/</code>. Passed straight through [[Template:Forums]] (with its "on the Loka Forums" suffix suppressed -- this row's own "Forum post" label already says what it is). <code>forumId</code> also works.
|-
|-
| <code>active</code>
| <code>active</code>
| Current status -- <code>Active</code> or <code>Deprecated</code> are colour-coded (green/red); other values still display, just uncoloured. For a rank no longer in use, pair this with [[Template:Deprecated]] at the top of the article rather than relying on this field alone (see [[Slicer]]).
| Current status -- <code>Active</code> or <code>Deprecated</code> are colour-coded (green/red); other values still display, just uncoloured. For a rank no longer in use, pair this with [[Template:Deprecated]] at the top of the article rather than relying on this field alone (see [[Slicer]]).
|}
|}
== The title's colour comes from Template:Rank ==
There's no <code>colour</code> parameter. The infobox title is literally <code><nowiki>{{Rank|name}}</nowiki></code> -- the same colour, bold/plain weight, tooltip, and light/dark variants [[Template:Rank]] already gives that name anywhere else it's used (e.g. on a player's own infobox). One rank has one colour, defined in exactly one place, rather than a second hex code here that could say something different. A name [[Template:Rank]] doesn't recognise just displays as plain text -- add it there first if it needs a colour.


== Current holders is automatic ==
== Current holders is automatic ==

Revision as of 00:33, 22 August 2026

Usage

{{Infobox rank
|name=Sentry
|purpose=Chat Moderator
|staff=Yes
|forumid=79
|active=Active
}}

Only name is required (it otherwise defaults to the page name); every other row is hidden when omitted. Built on Template:Infobox for the shared name/image/row chrome -- see there for the wiki's common infobox look. For a rank's own article (e.g. Sentry); article prose (how to obtain it, conduct expectations) belongs below the infobox as normal. Not the same thing as Template:Rank (an inline colour badge for mentioning a rank in running prose, e.g. on a player's own infobox) or Template:Icon's unrelated PvP-tier "Rank" icon family. Automatically adds the page to Category:Ranks, and to Category:Staff ranks as well when staff=Yes.

Parameters

Parameter Description
name Rank name. Defaults to the page name. Also drives the infobox title's colour -- see below.
image Filename of a badge/icon image uploaded to the wiki (no File: prefix).
purpose Short description shown as its own row (e.g. Chat Moderator, Sub-admin).
staff Yes or No -- shown as a green/red badge. Also sets the ribbon under the name ("Staff Rank" / "Community Rank"), gates whether the Current holders row appears at all (see below), and whether this page is added to Category:Staff ranks. The ribbon and Staff row are both hidden if left unset entirely, rather than guessing.
current Manual override for Current holders (only shown when staff=Yes), for the rare case the automatic count (see below) is temporarily wrong or not yet populated. Leave unset to use the real count.
forumid Numerical ID from this rank's forum thread URL, e.g. 79 for https://forums.lokamc.com/threads/sentry-rank.79/. Passed straight through Template:Forums (with its "on the Loka Forums" suffix suppressed -- this row's own "Forum post" label already says what it is). forumId also works.
active Current status -- Active or Deprecated are colour-coded (green/red); other values still display, just uncoloured. For a rank no longer in use, pair this with Template:Deprecated at the top of the article rather than relying on this field alone (see Slicer).

The title's colour comes from Template:Rank

There's no colour parameter. The infobox title is literally {{Rank|name}} -- the same colour, bold/plain weight, tooltip, and light/dark variants Template:Rank already gives that name anywhere else it's used (e.g. on a player's own infobox). One rank has one colour, defined in exactly one place, rather than a second hex code here that could say something different. A name Template:Rank doesn't recognise just displays as plain text -- add it there first if it needs a colour.

Current holders is automatic

The Current holders count is not a number to type in and keep updated by hand -- it reads live off Template:Infobox player. Every player's own infobox sets their own rank=, which silently adds that page to a "<rank> holders" category; this template counts that category with 0 and links the number straight to it, so clicking the count shows exactly who's counted. There's exactly one place a player's rank is ever recorded -- their own page -- so this can't drift out of sync the way a hand-maintained roster number would. If the count looks wrong, the fix is updating the player's own infobox, not this one.