Difference between revisions of "Template:Honor infobox"

From Pathfinder Wiki
(fix missing translation for pilot author and state (both don't need to be translated...))
 
(113 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
This template creates an infobox for an honor.
 
This template creates an infobox for an honor.
==TODO==
 
*Color the dumbells based on the skill parameter.
 
*Fix broken things
 
*separate out the data collection/specification from presentation templates?
 
*Add the honor to categories based on template parameters, etc.
 
  
 +
==Mechanics==
 +
The mechanics are just opaque magic (sorry).
  
==Example==
+
==Example== <!--T:3-->
{{Honor infobox2
+
<div class="toccolours">
|honorname=Aboriginal Lore
+
<nowiki><div style="max-width: 300px"></nowiki>
|skill=1
+
:<nowiki>{{</nowiki>Honor infobox<br/>
 +
::|honorlandingpage=AY Honors/Camping Skills IV<br/>
 +
::|skill=2<br/>
 +
::|year=2001<br/>
 +
::|category=Recreation<br/>
 +
::|authority=General Conference<br/>
 +
::|insignia=Camping_Skills_IV.png<br/>
 +
::|insignia_source=foo<br/>
 +
::|master1=Wilderness<br/>
 +
:}}
 +
<nowiki></div></nowiki>
 +
</div>
 +
<div style="max-width: 300px">
 +
{{Honor infobox
 +
|honorlandingpage=AY Honors/Camping Skills IV
 +
|skill=2
 
|year=2001
 
|year=2001
|category=Arts and Crafts
+
|category=Recreation
 
|authority=General Conference
 
|authority=General Conference
|insignia=Aboriginallore.png
+
|insignia=Camping_Skills_IV.png
 +
|insignia_source=foo
 +
|master1=Wilderness
 
}}
 
}}
</noinclude>
 
<includeonly>
 
__NOTOC__
 
<div class="container">
 
<div class="row">
 
<div class="col-md-3 order-md-last">
 
{| style="text-align: center; box-shadow: 5px 5px 10px rgba(0,0,0, .3); border-radius: 10px; margin-bottom: 0;"
 
|-
 
|colspan="2" style="font-size:1.6rem; font-weight: bold;"|{{{honorname}}}
 
|-
 
|colspan="2" style="padding: .5rem 2rem;" |[[File:{{{insignia}}}|100px]]
 
|-
 
|colspan="2" style="padding: 0 0 .5rem 0; font-size: 1.5rem;" |<span style="color: orange;">{{#fas:dumbbell}}</span> <span style="color: orange;">{{#fas:dumbbell}}</span> <span style="color: lightgrey;">{{#fas:dumbbell}}</span>
 
|-
 
!colspan="2" style="text-align: center; font-size: 1rem; font-weight: bold;" |Part of
 
|-
 
|colspan="2" | {{{category}}}
 
|-
 
! style="text-align: center; font-size: 1rem; font-weight: bold;" |Approval authority
 
! style="text-align: center; font-size: 1rem; font-weight: bold;" |Year of Introduction
 
|-
 
|{{{authority}}}
 
|{{{year}}}
 
|}
 
 
</div>
 
</div>
<div class="col-md-9">
+
<!--T:4-->
<ul class="nav nav-tabs" id="myTab" role="tablist">
+
[[Category:UsesLoops]]</noinclude>
  <li class="nav-item" role="presentation">
+
<includeonly><!-- Get the List of Master Honors -->{{#vardefine:localCategory|{{{category|{{GetHonorMetaData|language=/en}}}}}}}{{#vardefine:master|{{GetMasterCategoryList|category={{#var:localCategory}}|master1={{{master1|{{GetHonorMetaData|language=/en|parameter=master1}}}}}|master2={{{master2|{{GetHonorMetaData|language=/en|parameter=master2}}}}}}}}}<!-- create the string-variables holding the content for the see more section -->{{#vardefine:i|0}}{{#vardefine:locSeeAlsoLess|}}{{#vardefine:locSeeAlsoMore|}}<!-- get all interesting links for see also into one variable separated by | -->{{#vardefine:locSeeAlsoAll|{{#var:master}}{{GetHonorSeeAlso}}}}{{#if:{{#explode: {{#var:locSeeAlsoAll}}|%{{!}}%|{{#var:i}} }} | {{#vardefine:locSeeAlsoLess|{{#explode: {{#var:locSeeAlsoAll}}|%{{!}}%|{{#var:i}} }} }}{{#vardefine: i | {{#expr: {{#var: i }} + 1 }} }}{{#while: | {{#explode: {{#var:locSeeAlsoAll}}|%{{!}}%|{{#var:i}} }} | {{#ifexpr: {{#var:i}}<3|<!--yes-->{{#vardefine:locSeeAlsoLess|{{#var:locSeeAlsoLess}}<br>{{#explode: {{#var:locSeeAlsoAll}}|%{{!}}%|{{#var:i}} }} }}|<!--no-->{{#vardefine:locSeeAlsoMore|{{#var:locSeeAlsoMore}}{{#ifexpr:{{#var:i}}>3|<br>}}{{#explode: {{#var:locSeeAlsoAll}}|%{{!}}%|{{#var:i}} }} }} }}{{#vardefine: i | {{#expr: {{#var: i }} + 1 }} }} }} }}<!-- get the patch -->{{#vardefine:localInsignia|{{{insignia|{{GetHonorMetaData|language=/en|parameter=insignia|dontTranslate=true}}}}}}}{{#vardefine:honorstate|{{{state|{{GetHonorMetaData|dontTranslate=true|parameter=state}}}}}}}{{#vardefine:patch|{{#if:{{#var:localInsignia}}|{{#switch:{{#var:localInsignia}}
    <htmltag tagname="a" href="#overview" class="nav-link active" id="overview-tab" data-toggle="tab" role="tab" aria-controls="overview" aria-selected="true">{{:Tab Name/Overview{{GetLangSuffix}}}}</htmltag>
+
|No Patch.png
  </li>
+
|No_Patch.png={{Localize|{{#ifeq:{{#var:honorstate}}|piloting|Pilot No Patch|No Patch}}|Images}}
  <li class="nav-item" role="presentation">
+
|{{#var:localInsignia}}
    <htmltag tagname="a" href="#requirements" class="nav-link" id="requirements-tab" data-toggle="tab" role="tab" aria-controls="requirements" aria-selected="false">{{:Tab Name/Requirements{{GetLangSuffix}}}}</htmltag>
+
}}|{{Localize|{{#ifeq:{{#var:honorstate}}|piloting|Pilot No Patch|No Patch}}|Images}}}}}}<!--
  </li>
+
check if Not availabel at AdventSource should be shown
  <li class="nav-item" role="presentation">
+
-->{{#vardefine:locPilotAuthor|{{#ifeq:{{#var:honorstate}}|piloting|{{{pilotAuthor|{{GetHonorMetaData|dontTranslate=true|parameter=pilotAuthor}}}}}}}|}}{{#vardefine:showNotAdventSrc|{{#ifeq:{{#var:honorstate}}|piloting|true|{{#if:{{{insignia_source|{{GetHonorMetaData|language=/en|parameter=insignia_source}}}}}|true|false}}}}}}
    <htmltag tagname="a" href="#answerkey" class="nav-link" id="answerkey-tab" data-toggle="tab" role="tab" aria-controls="answerkey" aria-selected="false">{{:Tab Name/Answer Key{{GetLangSuffix}}}}</htmltag>
+
<templatestyles src="Honor infobox/style.css" /><div class="mw-parser-output">
  </li>
+
{{Infobox
  <li class="nav-item" role="presentation">
+
|bodyclass=honor-infobox
    <htmltag tagname="a" href="#lessonplans" class="nav-link" id="lessonplans-tab" data-toggle="tab" role="tab" aria-controls="lessonplans" aria-selected="false">{{:Tab Name/Lesson Plans{{GetLangSuffix}}}}</htmltag>
+
|above={{#ifeq:{{#var:honorstate}}|piloting|{{Localize|NAD Pilot for}}|{{GetHonorName|page={{{honorlandingpage|}}}}}}}
  </li>
+
|subheader={{#ifeq:{{#var:honorstate}}|piloting|{{GetHonorName|page={{{honorlandingpage|}}}}}}}
  <li class="nav-item" role="presentation">
+
|subheader2=[[AY Honors/{{#var:localCategory}}{{GetLangSuffix}}|{{Localize|{{#var:localCategory}}}}]]
    <htmltag tagname="a" href="#worksheet" class="nav-link" id="worksheet-tab" data-toggle="tab" role="tab" aria-controls="worksheet" aria-selected="false">{{:Tab Name/Worksheet{{GetLangSuffix}}}}</htmltag>
+
|image={{#ifeq:{{#var:showNotAdventSrc}}|true|{{Superimpose
  </li>
+
      | base = {{#var:patch}}
</ul>
+
      | base_width = 100%
<div class="tab-content" id="myTabContent">
+
      | base_max_width = 150px
<div class="tab-pane fade show active" id="overview" role="tabpanel" aria-labelledby="overview-tab">
+
      | float = {{Localize|Not available at AdventSource|Images}}
{{:{{#titleparts:{{{page|{{PAGENAME}}}}}|2|1}}/Overview{{GetLangSuffix}}}}
+
      | float_width = 170px
{{:Tab Name/Challenging Part{{GetLangSuffix}}}}
+
      | align=center
</div>
+
      | x = 0
<div class="tab-pane fade show" id="requirements" role="tabpanel" aria-labelledby="requirements-tab">
+
      | y = 30
[[{{#titleparts:{{PAGENAME}}|2|1}}/Requirements{{GetLangSuffix}}{{:Tag Name/Printable Requirements{{GetLangSuffix}}}}]]
+
    }}
  {{#lst:{{#titleparts:{{PAGENAME}}|2|1}}/Requirements{{GetLangSuffix}}|Body}}
+
  |{{Superimpose
</div>
+
      | base = {{#var:patch}}
<div class="tab-pane fade" id="answerkey" role="tabpanel" aria-labelledby="answerkey-tab">
+
      | base_width = 100%
 
+
      | base_max_width = 150px
[[{{#titleparts:{{PAGENAME}}|2|1}}/Answer Key{{GetLangSuffix}}|<translate><!--T:26--> Printable Answer Key</translate>]] - [{{fullurl:{{#titleparts:{{PAGENAME}}|2|1}}/Answer Key{{GetLangSuffix}}|action=edit}} {{:Tab Name/Edit Answer Key{{GetLangSuffix}}}}]
+
      | align=center
 +
    }}
 +
}}
 +
|col1_label1={{Localize|Skill Level}}
 +
|col1_data1={{Honor infobox/echoSkillLevel | skill={{{skill|{{GetHonorMetaData|parameter=skill}}}}}}}
  
{{#lst:{{#titleparts:{{PAGENAME}}|2|1}}/Answer Key{{GetLangSuffix}}|Body}}
+
|col1_label2={{#ifeq:{{#var:honorstate}}|piloting||{{Localize|Approval authority}}}}
</div>
+
|col1_data2={{#ifeq:{{#var:honorstate}}|piloting||{{#if:{{{authority|}}}|{{Localize|{{{authority}}}|Authorities}}|{{GetHonorMetaData|parameter=authority}}}}}}
<div class="tab-pane fade" id="lessonplans" role="tabpanel" aria-labelledby="lessonplans-tab">
+
|col2_label2={{#ifeq:{{#var:honorstate}}|piloting||{{Localize|Year of Introduction}}}}
{{#lst:{{#titleparts:{{PAGENAME}}|2|1}}/Lesson Plans{{GetLangSuffix}}|Body}}
+
|col2_data2={{#ifeq:{{#var:honorstate}}|piloting||{{#vardefine:localYear|{{{year|{{GetHonorMetaData|language=/en|parameter=year}}}}}}}{{#iferror:{{#expr:1+{{#var:localYear|X}} }}|{{Localize|Unknown}}|{{#var:localYear}} }} }}
</div>
+
|rowclass3=honor-infobox-seeAlso
<div class="tab-pane fade" id="worksheet" role="tabpanel" aria-labelledby="worksheet-tab">
+
|col1_label3={{Localize|See also}}
{{#lst:{{#titleparts:{{PAGENAME}}|2|1}}/Worksheet{{GetLangSuffix}}|Body}}
+
|col1_data3={{#var:locSeeAlsoLess}}{{#if: {{#var:locSeeAlsoMore}}|
</div>
+
<div id="infobox-see-also" class="mw-collapsible mw-collapsed" data-expandtext="{{Localize|More}}" data-collapsetext="{{Localize|Less}}"><br>
</div> <!-- close tabs-content div -->
+
{{#var:locSeeAlsoMore}}
</div> <!-- close column div -->
+
</div>}}
</div> <!-- close row div -->
+
|col1_noDefaultStyle4=true
</div> <!-- close container div -->
+
|col1_data4={{#ifeq:{{#var:honorstate}}|piloting|<htmltag tagname="a" class="btn btn-accent" href="https://form.jotform.com/220234764665155?honorProposal={{#invoke:String|urlencode|{{#titleparts:{{PAGENAME}}|1|2}}}}" target="_blank">{{Localize|Give Feedback}}</htmltag>|}}
<includeonly>
+
|col1_class4=honor-infobox-button
 +
|col1_noDefaultStyle5=true
 +
|col1_data5={{#if:{{#var:locPilotAuthor}}|<htmltag tagname="a" class="btn btn-accent" href="{{fullurl:Special:EmailUser/{{#var:locPilotAuthor}}}}" target="_blank">{{Localize|Contact Pilot Author}}</htmltag>|}}
 +
|col1_class5=honor-infobox-button
 +
|col1_noDefaultStyle10=true
 +
|col1_data10={{#ifsysop:<div class="dropdown"><htmltag tagname="button" class="btn btn-accent dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{Localize|Downloads}}</htmltag><div class="dropdown-menu" aria-labelledby="dropdownMenuButton"><htmltag tagname="a" href="{{fullurl:{{#titleparts:{{PAGENAME}}|2|1}}/Requirements{{GetLangSuffix}}|action=mpdf}}" class="dropdown-item">{{Localize|Requirements}}
 +
</htmltag><htmltag tagname="a" href="{{fullurl:{{#titleparts:{{PAGENAME}}|2|1}}/Answer Key{{GetLangSuffix}}|action=mpdf}}" class="dropdown-item">{{Localize|Answer Key}}</htmltag></div></div>|}}
 +
|col1_class10=honor-infobox-button
 +
}}
 +
</div>{{#invoke:Utilities|logger|{{Localize|{{#var:localCategory}}}}}}
 +
</includeonly>

Latest revision as of 20:55, 28 April 2022

This template creates an infobox for an honor.

Mechanics

The mechanics are just opaque magic (sorry).

Example

<div style="max-width: 300px">

{{Honor infobox
|honorlandingpage=AY Honors/Camping Skills IV
|skill=2
|year=2001
|category=Recreation
|authority=General Conference
|insignia=Camping_Skills_IV.png
|insignia_source=foo
|master1=Wilderness
}}

</div>


Camping Skills IV
Recreation
Skill Level
123
Approval authority
General Conference
Year of Introduction
2001
See also