(Imported by PageSync) Tag: Metadata slot edit |
(Imported by PageSync) Tag: wsps-content-edit-tag |
||
(One intermediate revision by one other user not shown) | |||
Line 9: | Line 9: | ||
It genarates CSS for grid layout based on the class of the current page | It genarates CSS for grid layout based on the class of the current page | ||
− | </noinclude><includeonly><!-- | + | </noinclude><includeonly>{{#af_foreach:{{#invoke:CspFunctions|afExportSlots|slots=ws-base-props}}||$base |<!-- |
+ | -->{{#af_foreach:{{#invoke:CspFunctions|afExportSlots|slots=ws-base-props,ws-class-props|page={{#invoke:CspFunctions|ClassToClassDefinitionPage|{{#af_get:{{{$base}}}|ws-base-props|Base properties|1|Class|_text}} }} }} ||$classData |<!-- | ||
+ | -->{{#if:{{#af_get:{{{$classData}}}|ws-base-props|Base properties|1|Class|_text}}<!-- | ||
+ | |||
+ | #################################### | ||
+ | ### New version using slot data ### | ||
+ | #################################### | ||
+ | -->|{{#widget:Layout <!-- widget creates the css --> | ||
+ | |rows={{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout rows|_text}} | ||
+ | |columns={{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout columns|_text}} | ||
+ | |areas={{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout areas|_text}} | ||
+ | |display={{#af_join:{{#af_map:{{#af_unique:{{#af_split:{{#invoke:CspFunctions|gmatch|{{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout areas|_text}}|([^ \'"]+)|_@_}}|_@_}} }}|$item|{{#ifeq:{{{$item}}}|main||.cp-{{{$item}}}{display:block;} }} }}|\n}}<!-- | ||
+ | -->}}<!-- end of widget:Layout | ||
+ | |||
+ | #################################### | ||
+ | ### Old version using properties ### | ||
+ | #################################### | ||
+ | -->|<!-- | ||
-->{{#vardefine:@class|{{#show:{{FULLPAGENAME}}|?Class|link=none}} }}<!-- get the class of current page | -->{{#vardefine:@class|{{#show:{{FULLPAGENAME}}|?Class|link=none}} }}<!-- get the class of current page | ||
-->{{#if:{{#var:@class}}|<!-- | -->{{#if:{{#var:@class}}|<!-- | ||
Line 35: | Line 52: | ||
|display={{#camap:@areas|@@@|.cp-@@@{display:block;}| }} <!-- set display block for component classes--> | |display={{#camap:@areas|@@@|.cp-@@@{display:block;}| }} <!-- set display block for component classes--> | ||
}}<!-- | }}<!-- | ||
− | -->}} | + | -->}}<!-- |
− | </includeonly> | + | -->}}<!-- end of #if (check for class in $classData |
+ | -->}}<!-- end of #af_foreach $classData | ||
+ | -->}}<!-- end of #af_foreach $base --></includeonly> | ||
ws-base-props | |||
---|---|---|---|
Line 3: | Line 3: | ||
|Title=Template:Layout | |Title=Template:Layout | ||
|Version history={{Version history item | |Version history={{Version history item | ||
+ | |Version number=1.2 | ||
+ | |Version description=Replaced #regexall with Lua function | ||
+ | |Version date=2023-8-18 12:39:26 | ||
+ | }}{{Version history item | ||
+ | |Version number=1.1 | ||
+ | |Version description=Updated to use slotdata instead of SMW properties | ||
+ | |Version date=2023-6-02 12:15:15 | ||
+ | }}{{Version history item | ||
|Version number=1.0 | |Version number=1.0 | ||
|Version description=Initial version | |Version description=Initial version | ||
ws-class-props | |||
Line 1: | Line 1: | ||
− | {{ | + | {{Csp class properties |
|Type=CSP Basis Core | |Type=CSP Basis Core | ||
|Origin=CSP Basis | |Origin=CSP Basis | ||
}} | }} |
Latest revision as of 10:37, 15 July 2025
This is the "Layout" template. It should be called in the following format:
{{Layout}}
It genarates CSS for grid layout based on the class of the current page