Difference between revisions of "Template:Honor index"
(Add excat6) |
|||
(88 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | <!--- ¦ ---> | + | <!--- ¦ ---><includeonly> |
− | < | + | <!-- assemble the tablerow argument of DPL so it is customizeable --> |
+ | <!-- initialize the variables --> | ||
+ | {{#vardefine:selectedcolumns|{{{columnselection|:honorname:insignia:category:authority:skill:year}}}}} | ||
+ | {{#vardefine:tablerow|}}{{#vardefine:tableheader|}}{{#vardefine:i|1}}{{#while: <!-- we need to start at word 1 because of the leading : -->|{{#if:{{#explode:{{#var:selectedcolumns}}|:|{{#var:i}}}}|true}}|{{#vardefine:tablerow|{{#var: tablerow}}{{#switch:{{#explode:{{#var: selectedcolumns }}|:|{{#var:i}}}}|honorname=data-sort-value=²{GetHonorName¦page=%PAGE%}²¦[[%PAGE%¦²{GetHonorName¦page=%PAGE%}²]],|insignia=²{GetInsigniaThumb¦insignia=%%¦usePilotNoPatch={{{usePilotNoPatch¦}}}}²,|category=align="left"¦²{Localize¦%%}²,|authority=align="center"¦²{division honor¦²{division abbrev¦%%}²}²,|skill=align="center"¦²{YearOrUnknown¦%%}²,|year=align="center"¦²{YearOrUnknown¦%%}²,}}}} | ||
+ | {{#vardefine: tableheader|{{#var:tableheader}}{{#switch:{{#explode:{{#var:selectedcolumns}}|:|{{#var:i}}}}|honorname=,{{Localize|Honor}}|insignia=,{{Localize|Patch}}|category=,{{Localize|Category}}|authority=,{{Localize|Approval}}|skill=,{{Localize|Skill Level}}|year=,{{Localize|Year}}}}}}{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}}}<nowiki /> | ||
+ | <!-- that loops through all arguments with the prefix cat and saves it into a variable --> | ||
+ | {{#vardefine:argIncCat|AY Honors/HonorLanding{{GetLangSuffix}}&AY Honors/Primary}}{{#forargs: cat | key | category |<nowiki />{{#vardefine:argIncCat|{{#var:argIncCat}}{{#if:{{#var:category}}|&{{#var:category}}{{GetLangSuffix}} }} }} }} | ||
{{#dpl: | {{#dpl: | ||
− | |include={ | + | |debug={{{debug|0}}} |
− | |table=class="wikitable sortable",- | + | |include={HonorLanding}{{#var:selectedcolumns}} |
− | + | |table=class="wikitable sortable",-{{#var:tableheader}} | |
− | |tablerow= | + | |tablerow={{#var:tablerow}} |
− | | | + | |category={{#var:argIncCat}} |
− | {{#if:{{{ | + | |notcategory={{#if:{{{excat1|}}}|{{{excat1}}}{{GetLangSuffix}}}} |
− | {{#if:{{{ | + | |notcategory={{#if:{{{excat2|}}}|{{{excat2}}}{{GetLangSuffix}}}} |
− | {{#if:{{{ | + | |notcategory={{#if:{{{excat3|}}}|{{{excat3}}}{{GetLangSuffix}}}} |
− | {{#if:{{{ | + | |notcategory={{#if:{{{excat4|}}}|{{{excat4}}}{{GetLangSuffix}}}} |
− | {{#if:{{{ | + | |notcategory={{#if:{{{excat5|}}}|{{{excat5}}}{{GetLangSuffix}}}} |
− | |notcategory={{{ | + | |notcategory={{#if:{{{excat6|}}}|{{{excat6}}}{{GetLangSuffix}}}} |
− | | | + | |notcategory={{#if:{{{showPiloting|}}}||AY Honors/Piloting{{GetLangSuffix}}}} |
− | |||
− | |notcategory={{{ | ||
− | | | ||
|nottitleregexp=.*/en$ | |nottitleregexp=.*/en$ | ||
|ordermethod=sortkey | |ordermethod=sortkey | ||
− | |||
|namespace= | |namespace= | ||
+ | }} | ||
+ | {{#if:{{{debug|}}}| | ||
+ | *argIncCat = {{#var:argIncCat}} | ||
+ | *key = {{#var:key}} | ||
+ | *category = {{#var:category}} | ||
+ | *tablerow = {{#var:tablerow}} | ||
+ | *tableheader = {{#var:tableheader}} | ||
+ | *selectedcolumns = {{#var:selectedcolumns}} | ||
}} | }} | ||
</includeonly> | </includeonly> | ||
− | <noinclude> | + | <noinclude><nowiki />{{Honor index |
− | {{Honor index | + | |cat1=AY Honors/Arts, Crafts and Hobbies |
+ | |cat2=AY Honors/Skill Level 1 | ||
+ | |excat1=AY Honors/Approved by General Conference | ||
+ | |excat2=AY Honors/Approved by North American Division | ||
+ | |columnselection=:honorname:insignia:authority:skill:year | ||
+ | }}<nowiki />{{Honor index | ||
|cat1=AY Honors/Arts, Crafts and Hobbies | |cat1=AY Honors/Arts, Crafts and Hobbies | ||
− | |excat1=AY Honors/Approved by | + | |cat2=AY Honors/Skill Level 1 |
− | |excat2=AY Honors/Approved by | + | |excat1=AY Honors/Approved by General Conference |
+ | |excat2=AY Honors/Approved by North American Division | ||
}} | }} | ||
− | </noinclude> | + | <templatedata> |
+ | { | ||
+ | "params": { | ||
+ | "columnselection": { | ||
+ | "label": "Shown columns (and order)", | ||
+ | "description": "This defines the shown columns and the order of those. Each column needs to be separated by a \":\" and it needs to be started with a \":\". Possible columns are: honorname, insignia, category, authority, skill, year", | ||
+ | "example": ":honorname:insignia:category:authority:skill:year", | ||
+ | "default": ":honorname:insignia:category:authority:skill:year", | ||
+ | "autovalue": ":honorname:insignia:category:authority:skill:year" | ||
+ | }, | ||
+ | "excat1": { | ||
+ | "label": "First excluded Category", | ||
+ | "description": "The honor isn't allowed to be in that category.", | ||
+ | "example": "AY Honors/Approved by General Conference", | ||
+ | "autovalue": "" | ||
+ | }, | ||
+ | "excat2": { | ||
+ | "label": "Second excluded Category", | ||
+ | "description": "The honor isn't allowed to be in that category.", | ||
+ | "example": "AY Honors/Approved by General Conference" | ||
+ | }, | ||
+ | "excat3": { | ||
+ | "label": "Third excluded Category", | ||
+ | "description": "The honor isn't allowed to be in that category.", | ||
+ | "example": "AY Honors/Approved by General Conference" | ||
+ | }, | ||
+ | "excat4": { | ||
+ | "label": "Fourth excluded Category", | ||
+ | "description": "The honor isn't allowed to be in that category.", | ||
+ | "example": "AY Honors/Approved by General Conference" | ||
+ | }, | ||
+ | "excat5": { | ||
+ | "label": "Fifth excluded Category", | ||
+ | "description": "The honor isn't allowed to be in that category.", | ||
+ | "example": "AY Honors/Approved by General Conference" | ||
+ | }, | ||
+ | "excat6": { | ||
+ | "label": "Sixth excluded Category", | ||
+ | "description": "The honor isn't allowed to be in that category.", | ||
+ | "example": "AY Honors/Approved by General Conference" | ||
+ | }, | ||
+ | "catn": { | ||
+ | "label": "Included Category", | ||
+ | "description": "This category needs to be included. The n needs to be replaced with an upcounting number, that way it is possible to add multiple categories. An honor included in the list needs to have every added category. For example add those arguments: cat1=mycategory1|cat2=mycategory2 and so on.", | ||
+ | "example": "AY Honors/Skill Level 1" | ||
+ | } | ||
+ | }, | ||
+ | "description": "This template creates a table view, containing the honors in this wiki. The columns shown can be modified also it can be defined which categories should be included and which excluded.\n\nIt is very complex so I try to explain what is going on. First in the template we create the needed variables for defining the table (text's of the header, wanted columns, row template). \nAfter we did that magic, we have the magic that enables the template to have a dynamic count of needed (included) categories.\n\nThat is the whole preparation. Now we only let DPL do it's magic and a nice table will be created... hopefully ;) ", | ||
+ | "paramOrder": [ | ||
+ | "columnselection", | ||
+ | "excat1", | ||
+ | "excat2", | ||
+ | "excat3", | ||
+ | "excat4", | ||
+ | "excat5", | ||
+ | "excat6", | ||
+ | "catn" | ||
+ | ] | ||
+ | } | ||
+ | </templatedata>[[Category:UsesLoops]]</noinclude> |
Latest revision as of 01:52, 14 October 2023
Honor | Patch | Approval | Skill Level | Year |
---|---|---|---|---|
Fabric Yo-Yo | 1 | 2012 | ||
Music - Beginners | 1 | Unknown | ||
Papercraft | 1 | 2012 |
Honor | Patch | Category | Approval | Skill Level | Year |
---|---|---|---|---|---|
Fabric Yo-Yo | Arts, Crafts and Hobbies | 1 | 2012 | ||
Music - Beginners | Arts, Crafts and Hobbies | 1 | Unknown | ||
Papercraft | Arts, Crafts and Hobbies | 1 | 2012 |
This template creates a table view, containing the honors in this wiki. The columns shown can be modified also it can be defined which categories should be included and which excluded.
It is very complex so I try to explain what is going on. First in the template we create the needed variables for defining the table (text's of the header, wanted columns, row template). After we did that magic, we have the magic that enables the template to have a dynamic count of needed (included) categories.
That is the whole preparation. Now we only let DPL do it's magic and a nice table will be created... hopefully ;)Parameter | Description | Type | Status | |
---|---|---|---|---|
Shown columns (and order) | columnselection | This defines the shown columns and the order of those. Each column needs to be separated by a ":" and it needs to be started with a ":". Possible columns are: honorname, insignia, category, authority, skill, year
| Unknown | optional |
First excluded Category | excat1 | The honor isn't allowed to be in that category.
| Unknown | optional |
Second excluded Category | excat2 | The honor isn't allowed to be in that category.
| Unknown | optional |
Third excluded Category | excat3 | The honor isn't allowed to be in that category.
| Unknown | optional |
Fourth excluded Category | excat4 | The honor isn't allowed to be in that category.
| Unknown | optional |
Fifth excluded Category | excat5 | The honor isn't allowed to be in that category.
| Unknown | optional |
Sixth excluded Category | excat6 | The honor isn't allowed to be in that category.
| Unknown | optional |
Included Category | catn | This category needs to be included. The n needs to be replaced with an upcounting number, that way it is possible to add multiple categories. An honor included in the list needs to have every added category. For example add those arguments: cat1=mycategory1|cat2=mycategory2 and so on.
| Unknown | optional |