Difference between revisions of "Template:Segmented control"

From Co-Optitude Wiki
Jump to navigation Jump to search
Line 4: Line 4:
 
{{SegmentedControl
 
{{SegmentedControl
 
   |Title;Wiki page name
 
   |Title;Wiki page name
   |[Image.png]Title;Wiki page name
+
   |Title$icon.png;Wiki page name
 
   |Selected title
 
   |Selected title
 
   |etc}}
 
   |etc}}
Line 12: Line 12:
 
<div class="rsToggleContainer" style="text-align: center;">
 
<div class="rsToggleContainer" style="text-align: center;">
 
{{#vardefine:i|1}}{{#while:|{{#ifexpr:{{#var:i}}<={{#var:segmentCount}}|true}}
 
{{#vardefine:i|1}}{{#while:|{{#ifexpr:{{#var:i}}<={{#var:segmentCount}}|true}}
| <nowiki />{{#vardefine:orderClass|rsSegmentMiddle }}{{#ifexpr: {{#var:i}} = 1| {{#vardefine:orderClass|rsSegmentFirst }} }}{{#ifexpr: {{#var:i}} = {{#var:segmentCount}} | {{#vardefine:orderClass|rsSegmentLast}} }}{{#vardefine:segment|{{{ {{#var:i}} |}}} }}{{#vardefine:titleAndImage|{{#explode:{{#var:segment}}|;|0}} }}{{#vardefine:segmentLink|{{#explode:{{#var:segment}}|;|1}} }}{{#vardefine:segmentTitle|{{#explode:{{#var:titleAndImage}}|$|0}} }}{{#vardefine:segmentImage|{{#explode:{{#var:titleAndImage}}|$|1}} }}{{#vardefine:segmentSelected|{{#if:{{#var:segmentLink}}||true}} }}<div class="rsSegment {{#var:orderClass}} {{#if:{{#var:segmentSelected}}| rsSegmentSelected}}">{{#if:{{#var:segmentSelected}}|<div class="rsSegmentFill"><span class="rsSegmentTitle">{{#var:segmentTitle}}</span></div>|[[{{#var:segmentLink}}|<div class="rsSegmentFill"><span class="rsSegmentTitle">{{#var:segmentTitle}}</span></div>]]}}</div>{{#vardefine:i|{{#expr:{{#var:i}}+1}} }} }}</div></includeonly>
+
| <nowiki />{{#vardefine:orderClass|rsSegmentMiddle }}{{#ifexpr: {{#var:i}} = 1| {{#vardefine:orderClass|rsSegmentFirst }} }}{{#ifexpr: {{#var:i}} = {{#var:segmentCount}} | {{#vardefine:orderClass|rsSegmentLast}} }}{{#vardefine:segment|{{{ {{#var:i}} |}}} }}{{#vardefine:titleAndImage|{{#explode:{{#var:segment}}|;|0}} }}{{#vardefine:segmentLink|{{#explode:{{#var:segment}}|;|1}} }}{{#vardefine:segmentTitle|{{#explode:{{#var:titleAndImage}}|$|0}} }}{{#vardefine:segmentImage|{{#explode:{{#var:titleAndImage}}|$|1}} }}{{#vardefine:segmentSelected|{{#if:{{#var:segmentLink}}||true}} }}<div class="rsSegment {{#var:orderClass}} {{#if:{{#var:segmentSelected}}| rsSegmentSelected}}">{{#if:{{#var:segmentSelected}}|<div class="rsSegmentFill"><span class="rsSegmentTitle">{{#if:{{#var:segmentImage}}|<span class="rsSegmentIcon">[[File:{{#var:segmentImage}}|32px|none|link={{#var:segmentLink}}]]</span>}}<span class="rsSegmentTitleText">{{#var:segmentTitle}}</span></span></div>|[[{{#var:segmentLink}}|<div class="rsSegmentFill"><span class="rsSegmentTitle">{{#if:{{#var:segmentImage}}|<span class="rsSegmentIcon">[[File:{{#var:segmentImage}}|32px|none|link={{#var:segmentLink}}]]</span>}}<span class="rsSegmentTitleText">{{#var:segmentTitle}}</span></span></div>]]}}</div>{{#vardefine:i|{{#expr:{{#var:i}}+1}} }} }}</div></includeonly>

Revision as of 17:52, 28 March 2020

Usage example:

{{SegmentedControl
  |Title;Wiki page name
  |Title$icon.png;Wiki page name
  |Selected title
  |etc}}