table.ftl

 1   <#-- 
 2   Macro: table
 3   
 4   Description: Generates an HTML table with an optional ID, class, and various other features.
 5   
 6   Parameters:
 7   - id (string, optional): the ID of the table.
 8   - class (string, optional): the class of the table.
 9   - responsive (boolean, optional): whether to make the table responsive.
 10   - condensed (boolean, optional): whether to make the table cells more compact.
 11   - hover (boolean, optional): whether to highlight rows on hover.
 12   - striped (boolean, optional): whether to add stripes to the table rows.
 13   - headBody (boolean, optional): whether to include the <thead> and <tbody> tags.
 14   - bordered (boolean, optional): whether to add borders to the table cells.
 15   - narrow (boolean, optional): whether to make the table cells narrower.
 16   - collapsed (boolean, optional): whether to collapse the table.
 17   - caption (string, optional): the caption for the table.
 18   - params (string, optional): additional parameters to add to the HTML code.
 19   -->
 20   <#macro table id='' class='' responsive=true condensed=true hover=true striped=false headBody=false bordered=false narrow=false collapsed=false caption='' params='' deprecated...>
 21   <@deprecatedWarning args=deprecated />
 22   <#local class = class />
 23   <#if condensed> <#local class += ' table-condensed' /> </#if>
 24   <#if hover>     <#local class += ' table-hover' /> </#if>
 25   <#if striped>   <#local class += ' table-striped'   /> </#if>
 26   <#if bordered>  <#local class += ' table-bordered'  /> </#if>
 27   <#if collapsed> <#local class += ' collapse' /> </#if>
 28   <#if responsive><div class="table-responsive rounded rounded-3 border shadow mb-4"></#if>
 29   <table class="table rounded rounded-3 overflow-hidden border ${class?trim} mb-0" <#if id!=''> id="${id}"</#if><#if params!=''> ${params}</#if>>
 30   <#if caption!=''><caption>${caption}</caption></#if>
 31   <#if headBody><thead></#if>
 32   	<#nested>
 33   <#if headBody></tbody></#if>
 34   </table>
 35   <#if responsive></div></#if>
 36   </#macro>