Difference between revisions of "Template:Segmented control"

From Co-Optitude Wiki
Jump to navigation Jump to search
Line 29: Line 29:
 
{{#vardefine:segmentImage|{{#explode:{{#var:titleAndImage}}|$|1}}}}
 
{{#vardefine:segmentImage|{{#explode:{{#var:titleAndImage}}|$|1}}}}
 
* segmentImage = {{#var:segmentImage}}
 
* segmentImage = {{#var:segmentImage}}
{{#vardefine:segmentSelected|{{#if:{{#var:segmentLink}}|true|false}}}}
+
{{#vardefine:segmentSelected|{{#if:{{#var:segmentLink}}|false|true}}}}
 
* {{#var:segmentTitle}} = {{#var:segmentLink}} ({{#var:segmentSelected}})
 
* {{#var:segmentTitle}} = {{#var:segmentLink}} ({{#var:segmentSelected}})
 
<div class="rsSegment rsSegmentFirst rsSegmentSelected">
 
<div class="rsSegment rsSegmentFirst rsSegmentSelected">
<div class="rsSegmentFill">
+
{{#if:{{#var:segmentSelected}}|[[{{#var:segmentLink}}|<div class="rsSegmentFill"><span class="rsSegmentTitle">{{#var:segmentTitle}}</span></div>]]|<div class="rsSegmentFill"><span class="rsSegmentTitle">{{#var:segmentTitle}}</span></div>}}
<span class="rsSegmentTitle">{{#var:imageAndTitle}}</span>
 
</div>
 
 
</div>
 
</div>
 
{{#vardefine:i|{{#expr:{{#var:i}}+1}} }}
 
{{#vardefine:i|{{#expr:{{#var:i}}+1}} }}

Revision as of 17:22, 28 March 2020

Usage example:

{{SegmentedControl
  |Title;Wiki page name
  |[Image.png]Title;Wiki page name
  |Selected title
  |etc}}