cMultiselect.ftl

 1   <#-- Macro: cMultiselect
 2   
 3   Description: Defines a macro that show a multiselect tag
 4   
 5   Parameters:
 6   @param - class - string - optional - the CSS class of the element, default 'custom-select' 
 7   @param - labelOptionSelection - string - optional - Label for the selection button 
 8   @param - maxSelectedOptions - number - optional - Number of items that can be selected, default 0 (unlimited)
 9   @param - id - string - optional - the ID of the element, default ''
 10   @param - helpMsg - string - optional - Content of the help message for radio, default ''
 11   @param - errorMsg - string - optional - Content of the error message for radio, default ''
 12   @param - params - optional - additional HTML attributes to include in the ckeckbox element default ''
 13   @param - disabled - boolean - optional - Disable element, default false
 14   -->
 15   <#macro cMultiselect class='' labelOptionSelection='#i18n{theme.labelOptionSelection}' maxSelectedOptions=0 id='' helpMsg='' errorMsg='' params='' disabled=false deprecated...>
 16   <@deprecatedWarning args=deprecated />
 17   <#local cId><#if id!=''>${id}<#else>msg-${random()!}</#if></#local>
 18   <#if helpMsg !=''><@cFormHelp cId helpMsg /></#if>
 19   <div class="multiselect ${class}" id="${cId}" data-maxoptions="${maxSelectedOptions}"> 
 20   	<div class="tags-container mt-sm"></div>
 21       <div class="dropdown">
 22           <button class="form-select multi-select <#if disabled>disabled</#if>" type="button" id='btn-${cId}' data-bs-toggle="dropdown" aria-expanded="false"<#if disabled> disabled</#if> params=${params}>
 23               ${labelOptionSelection!}
 24           </button>
 25           <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
 26           	<#nested>
 27           </ul>
 28       </div>
 29   </div>
 30   <#if errorMsg!=''><@cFormError cId errorMsg /></#if>
 31   </#macro>