Difference between revisions of "Template:Segmented control"
Jump to navigation
Jump to search
Line 17: | Line 17: | ||
<div class="rsToggleContainer" style="text-align: center;"> | <div class="rsToggleContainer" style="text-align: center;"> | ||
{{#vardefine:i|1}} | {{#vardefine:i|1}} | ||
− | {{#while:|{{#ifexpr:{{#var:i}}<={{#var:segmentCount}}|true}}|<nowiki /> | + | {{#while:|{{#ifexpr:{{#var:i}}<={{#var:segmentCount}}|true}} |
− | {{#vardefine:orderClass|rsSegmentMiddle }} | + | |<nowiki /> |
− | {{#ifexpr: {{#var:i}} = 1| {{#vardefine:orderClass|rsSegmentFirst }} }} | + | {{#vardefine:orderClass|rsSegmentMiddle }} |
− | {{#ifexpr: {{#var:i}} = {{#var:segmentCount}} | {{#vardefine:orderClass|rsSegmentLast}} }} | + | {{#ifexpr:{{#var:i}}=1|{{#vardefine:orderClass|rsSegmentFirst}}}} |
− | {{#vardefine:segment|{{{ {{#var:i}} |}}} }} | + | {{#ifexpr:{{#var:i}}={{#var:segmentCount}}|{{#vardefine:orderClass|rsSegmentLast}}}} |
− | {{#vardefine:titleAndImage|{{#explode:{{#var:segment}}|;|0}} }} | + | {{#vardefine:segment|{{{{{#var:i}}|}}}}} |
− | {{#vardefine:segmentLink|{{#explode:{{#var:segment}}|;|1}} }} | + | {{#vardefine:titleAndImage|{{#explode:{{#var:segment}}|;|0}} }} |
− | {{#vardefine:segmentTitle|{{#explode:{{#var:titleAndImage}}|$|0}} }} | + | {{#vardefine:segmentLink|{{#explode:{{#var:segment}}|;|1}} }} |
− | {{#vardefine:segmentImage|{{#explode:{{#var:titleAndImage}}|$|1}} }} | + | {{#vardefine:segmentTitle|{{#explode:{{#var:titleAndImage}}|$|0}} }} |
− | {{#vardefine:segmentSelected|{{#if:{{#var:segmentLink}}||true}} }} | + | {{#vardefine:segmentImage|{{#explode:{{#var:titleAndImage}}|$|1}} }} |
− | {{#vardefine:segmentClasses|rsSegment {{#var:orderClass}} {{#if:{{#var:segmentSelected}}|rsSegmentSelected}}}} | + | {{#vardefine:segmentSelected|{{#if:{{#var:segmentLink}}||true}} }} |
− | {{#vardefine:segmentIconHTML|{{#if:{{#var:segmentImage}}|<span class="rsSegmentIcon">[[File:{{#var:segmentImage}}|20px|none|link={{#var:segmentLink}}]]</span>}} }} | + | {{#vardefine:segmentClasses|rsSegment {{#var:orderClass}} {{#if:{{#var:segmentSelected}}|rsSegmentSelected}}}} |
− | {{#vardefine:segmentFillHTML|<div class="rsSegmentFill"><span class="rsSegmentTitle">{{#var:segmentIconHTML}}}}<span class="rsSegmentTitleText">{{#var:segmentTitle}}</span></span></div>}} | + | {{#vardefine:segmentIconHTML|{{#if:{{#var:segmentImage}}|<span class="rsSegmentIcon">[[File:{{#var:segmentImage}}|20px|none|link={{#var:segmentLink}}]]</span>}} }} |
+ | {{#vardefine:segmentFillHTML|<div class="rsSegmentFill"><span class="rsSegmentTitle">{{#var:segmentIconHTML}}}}<span class="rsSegmentTitleText">{{#var:segmentTitle}}</span></span></div>}} | ||
<div class="{{#var:segmentClasses}}">{{#if:{{#var:segmentSelected}}|{{#var:segmentFillHTML}}|[[{{#var:segmentLink}}|{{#var:segmentFillHTML}}]]}}</div>{{#vardefine:i|{{#expr:{{#var:i}}+1}} }} }}</div></includeonly> | <div class="{{#var:segmentClasses}}">{{#if:{{#var:segmentSelected}}|{{#var:segmentFillHTML}}|[[{{#var:segmentLink}}|{{#var:segmentFillHTML}}]]}}</div>{{#vardefine:i|{{#expr:{{#var:i}}+1}} }} }}</div></includeonly> |
Revision as of 18:18, 28 March 2020
Usage example:
{{SegmentedControl |Title;Wiki page name |Title$icon.png;Wiki page name |Selected title |etc}}