No edit summary
(Imported by PageSync)
Tag: wsps-content-edit-tag
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
</pre>
</pre>


It genarates CSS for grid layout based on the class of the current page   
It generates 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 |<!--  
-->{{#vardefine:@class|{{#show:{{FULLPAGENAME}}|?Class|link=none}} }}<!-- get the class of current page
-->{{#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:{{#var:@class}}|<!--  
-->{{#widget:Layout <!-- widget creates the css -->
        -->{{#ask:[[Defines class::{{#var:@class}}]]
|rows={{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout rows|_text}}
|?Layout areas=Areas
|columns={{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout columns|_text}}
|?Layout columns=Columns
|areas={{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout areas|_text}}
|?Layout rows=Rows
|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}}<!--
|format=complexarray
    // if Layout areas is filled but does not contain "main", hide main
|name=@layout
    -->{{#if:{{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout areas|_text}}
  }}<!-- get layout settings for the class
       |{{#if:{{#invoke:CspFunctions|gmatch|{{#af_get:{{{$classData}}}|ws-class-props|Csp class properties|1|Layout areas|_text}}|main|,}}
        -->{{#cadefine:@areas|<!-- create array for areas to enable
        ||.cp-main{display:none;}
          -->{{#replace:<!--  remove '
        }}
            -->{{#replace:<!-- remove main
      }}<!--
                -->{{#replace:<!-- replace spaces with ,
  -->}}<!-- end of widget:Layout
                  -->{{#caprint:@layout[0][Areas]}}<!--  
 
                -->|'| }}<!--
-->}}<!-- end of #af_foreach $classData
            -->|main| }}<!--
-->}}<!-- end of #af_foreach $base --></includeonly>
          -->|<nowiki> </nowiki>|,}}<!--
        -->|,}}<!--  
      -->{{#caunique:@areas}}<!-- remove doubles from array
       -->{{#widget:layout <!-- widget creates the css -->
          |rows={{#caprint:@layout[0][Rows]}}
          |columns={{#caprint:@layout[0][Columns]}}
          |areas={{#caprint:@layout[0][Areas]}}
          |display={{#camap:@areas|@@@|.cp-@@@{display:block;}| }} <!-- set display block for component classes-->
        }}<!--  
-->}}{{#caprint:@layout[0][Rows]}} - {{#caprint:@layout[0][Columns]}} - {{#caprint:@layout[0][Areas]}} - {{#camap:@areas|@@@|.cp-@@@{display:block;}| }}
</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=2.0
|Version description=Hide main component when layout areas is filled and does not include main (issue #185)
|Version date=2024-12-20 13:43:53
}}{{Version history item
|Version number=1.3
|Version description=Removed compatibility with pre CSP 1.8 class definitions
|Version date=2023-11-17 09:47:16
}}{{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
|Version date=2022-12-02 07:55:53
|Version date=2022-12-02 07:55:53
}}
}}
}}
}}
}}
}}
ws-class-props
Line 1: Line 1:
{{Application page properties
{{Csp class properties
|Type=CSP Basis Core
|Type=CSP Basis Core
|Origin=CSP Basis
|Origin=CSP Basis
}}
}}

Latest revision as of 08:01, 18 September 2025

This is the "Layout" template. It should be called in the following format:


{{Layout}}

It generates CSS for grid layout based on the class of the current page