(Imported by WSPageSync) |
(Imported by WSPageSync) |
||
Line 28: | Line 28: | ||
|Sidebar template= <optional: page> default "Template:{{{Defines class|}}} sidebar" | |Sidebar template= <optional: page> default "Template:{{{Defines class|}}} sidebar" | ||
|Sidebar form= <optional: page> no default | |Sidebar form= <optional: page> no default | ||
+ | |Sub header template= <optional: page> no default | ||
+ | |||
+ | |Parameters= (multiple instance template) | ||
+ | }} | ||
+ | {{Parameter definition | ||
+ | |... | ||
+ | |... | ||
+ | }}{{Parameter definition | ||
+ | |... | ||
+ | |... | ||
+ | }} | ||
}} | }} | ||
</pre> | </pre> | ||
Line 62: | Line 73: | ||
-->{{#vardefine:@base-props-template |{{#if:{{{Base properties template|}}} |{{{Base properties template|}}} |Template:Base properties}} }}<!-- | -->{{#vardefine:@base-props-template |{{#if:{{{Base properties template|}}} |{{{Base properties template|}}} |Template:Base properties}} }}<!-- | ||
-->{{#vardefine:@page-props-template |{{#if:{{{Page properties template|}}} |{{{Page properties template|}}} |Template:{{{Defines class|}}} properties}} }}<!-- | -->{{#vardefine:@page-props-template |{{#if:{{{Page properties template|}}} |{{{Page properties template|}}} |Template:{{{Defines class|}}} properties}} }}<!-- | ||
− | -->{{#vardefine: @sidebar-template | {{#if: {{{Sidebar template|}}} | {{{Sidebar template|}}} | Template:{{{Defines class|}}} sidebar}} }}<!-- | + | -->{{#vardefine:@sidebar-template | {{#if: {{{Sidebar template|}}} | {{{Sidebar template|}}} | Template:{{{Defines class|}}} sidebar}} }}<!-- |
-->{{#vardefine:@pagetitle-format |{{#switch:{{{Pagetitle format|}}} |title=title |#default=next_available}} }}<!-- | -->{{#vardefine:@pagetitle-format |{{#switch:{{{Pagetitle format|}}} |title=title |#default=next_available}} }}<!-- | ||
+ | -->{{{Parameters|}}}<!-- | ||
-->{{#set:Defines class={{{Defines class|}}} | -->{{#set:Defines class={{{Defines class|}}} | ||
|Short description={{{Short description|}}} | |Short description={{{Short description|}}} | ||
Line 79: | Line 91: | ||
|Sidebar template={{#var:@sidebar-template}} | |Sidebar template={{#var:@sidebar-template}} | ||
|Sidebar form={{{Sidebar form|}}} | |Sidebar form={{{Sidebar form|}}} | ||
+ | |Sub header template={{{Sub header template|}}} | ||
+ | |||
+ | |Parameters={{{Parameters|}}} | ||
}}<!-- | }}<!-- | ||
+ | |||
+ | -->{{#ask:[[-Has subobject::{{FULLPAGENAME}}]] [[Parameter definition name::+]] | ||
+ | |?Parameter definition name=Name | ||
+ | |?Parameter definition property name=Property name | ||
+ | |?Parameter definition sorting number=Sorting number | ||
+ | |?Parameter definition required=Required | ||
+ | |?Parameter definition multiple=Multiple | ||
+ | |?Parameter definition formfield type=Formfield type | ||
+ | |?Parameter definition allowed values=Allowed values | ||
+ | |?Parameter definition slot=Slot | ||
+ | |format=complexarray | ||
+ | |name=$defined parameters | ||
+ | |sort=Parameter definition slot, Parameter definition name | ||
+ | }}<!-- | ||
+ | -->{{#vardefine:@has defined parameters |{{#if:{{#casize:$defined parameters}} |yes}} }}<!-- | ||
+ | |||
+ | --><!-- | ||
--><h2>Class</h2> | --><h2>Class</h2> | ||
Line 99: | Line 131: | ||
<h2>Component templates</h2> | <h2>Component templates</h2> | ||
* Sidebar template: [[{{#var: @sidebar-template}}]] | * Sidebar template: [[{{#var: @sidebar-template}}]] | ||
− | {{#if:{{{Sidebar form|}}} |* Sidebar form: [[{{#var:{{{Sidebar | + | {{#if:{{{Sidebar form|}}} |* Sidebar form: [[ {{{Sidebar form|}}}]] }} |
+ | {{#if:{{{Sub header template|}}} |* Sub header template: [[ {{{Sub header template|}}} ]] }} | ||
+ | |||
+ | {{#ifeq:{{#var:@has defined parameters}} |yes |<h2>Defined parameters</h2> | ||
+ | {{{!}} class="wikitable sortable" | ||
+ | ! Name | ||
+ | ! Property | ||
+ | ! Slot | ||
+ | ! Formfield type | ||
+ | ! Allowed values | ||
+ | ! Required | ||
+ | ! Multiple | ||
+ | {{#camap:$defined parameters |$parameter |<tr> | ||
+ | <td>$parameter[Name]</td> | ||
+ | <td>[[Property:{{#if:$parameter[Property name]|$parameter[Property name]|$parameter[Name]}}]]</td> | ||
+ | <td>$parameter[Slot]</td> | ||
+ | <td>$parameter[Formfield type]</td> | ||
+ | <td>$parameter[Allowed values]</td> | ||
+ | <td>{{#ifeq:$parameter[Required] |1|Yes|No}}</td> | ||
+ | <td>{{#ifeq:$parameter[Multiple] |1|Yes|No}}</td> | ||
+ | <tr>|}} | ||
+ | {{!}}} | ||
+ | }} | ||
+ | |||
+ | <h2>Automatically generated template code</h2> | ||
+ | <ul class="nav nav-tabs" > | ||
+ | <li class="nav-item">{{#widget:Link |type=a |href=#template-code-info |class=nav-link active |id=nav-home-tab |datatoggle=tab |text=Info}}</li> | ||
+ | <li class="nav-item">{{#widget:Link |type=a |href=#template-code-page-properties |class=nav-link |id=nav-profile-tab |datatoggle=tab |text=Page properties template }}</li> | ||
+ | <li class="nav-item">{{#widget:Link |type=a |href=#template-code-sidebar |class=nav-link |id=nav-contact-tab |datatoggle=tab |text=Sidebar template }}</li> | ||
+ | </ul><!-- | ||
+ | |||
+ | --><div class="tab-content"> | ||
+ | <div class="tab-pane fade show active" id="template-code-info" >Open one of the tabs to view automatically generated template code. This is meant to be used when creating new templates. | ||
+ | |||
+ | |||
+ | If you are modifying an existing template, it might still be useful to update the parameter definitions and use parts of the generated code, but be careful not to completely overwrite existing templates. Existing templates will likely have had other modifications that are not included in the automatically generated code. | ||
+ | </div> | ||
+ | <div class="tab-pane fade" id="template-code-page-properties" >[[{{#var:@page-props-template}}]] | ||
+ | |||
+ | {{Generate page properties template code |Class={{{Defines class|}}} }}</div> | ||
+ | <div class="tab-pane fade" id="template-code-sidebar" >[[{{#var:@sidebar-template}}]] {{Generate sidebar template code |Class={{{Defines class|}}} }}</div> | ||
+ | </div> | ||
</includeonly> | </includeonly> |
Revision as of 08:34, 20 April 2022
This is the "Class definition" template. It should be called in the following format:
{{Class definition |Defines class= <text> value that is used for Class property in content pages of this type |Pagetitle format= <value options: title, next_available> the wscreate in "Template:Create page form" will be based on this option, default "next_available" |Allowed namespaces= <optional: comma-separted namespaces> namespaces in which pages of this class are allowed to be created, e.g. "(Main), Project, Article" |Short description= <optional: text> layout settings (used to order chameleon components) |Areas= <components> for example 'sidebar main'. Base csp components are: sidebar, sub-header, main |Columns= <size attribute of components> for example: 15em 2fr |Rows= storage templates |Base properties template= <optional: page> default "Template:Base properties" |Page properties template <optional: page> default "Template:{{{Defines class|}}} properties" component templates |Sidebar template= <optional: page> default "Template:{{{Defines class|}}} sidebar" |Sidebar form= <optional: page> no default |Sub header template= <optional: page> no default |Parameters= (multiple instance template) }} {{Parameter definition |... |... }}{{Parameter definition |... |... }} }}
Pagetitle formats:
- title will result in a pagetitle with format
Class/title-entered-by-user
such asOrganization/wikibase-solutions
- next_available will result in a pagetitle with format
Class/incremental_number
such asOrganization/1
Organization/2
Organization/3
etc.
Different Chameleon components can be ordered for different page classes
- Base csp components are: sidebar, sub-header, main
- They are defined in the Chameleon skin XML and the default values are set in layout.css
- You can define different layouts on the Areas parameter, see grid-template-areas for syntax
- You can define sizes for the columns and rows for this layout, see grid-template-columns and grid-template-rows for syntax
Example
The example below creates to rows on all pages with the Article class
The first row holds the Sidebar and the Sub-header components the Sidebar is set to be 15em wide and the Sub-header is set to 1 fraction, the hieght of this row is set to Auto
The second row holds the Main content component it spans over two columns the height of this row is set to 1 fraction
{{Class definition |Defines class=Article |Areas='sidebar sub-header' 'main main' |Columns=15em 2fr |Rows=auto 1fr }}