batch-processing checkbox in custom components
Hi all
I made some custom components on the forum page and blog page to alter the display of the message list.
As i use a custom comonent, the standard "batch-processing-checkbox" component non longer works when i include it in my message list. I guess it's because the context.env.message is not set.
Does anyone know how to make the standard "batch-processing-checkbox" component work? Is there a custom param to pass (ex: <@component id=""batch-processing-checkbox" paramName="paramValue" />)
is there a way to copy the way it works?
Thank you for your help
There's no component for that, you would need to rebuild the logic to check if batchprocessing is enabled or not (rest
/users/id/${user.id}/settings/name/layout.show_batch_checkboxes) and recreate the <input> checkbox element with the correct value (board relative message id and board id, url encoded) and class.
Thank you for your help
here is my implementation to help someone else
step 1 : create a macro to get the state of the checkbox
<#macro batchProcessingCheckbox userId> <#assign isCheckBoxActivated = rest("/users/id/${userId}/settings/name/layout.show_batch_checkboxes").value /> </#macro>
Step 2 : create a macro to display the checkbox
<#macro batchProcessingCheckboxUI relativeMessageId boardId isCheckBoxActivated> <input name="bm" type="checkbox" value="${relativeMessageId}%3A${boardId}" title="Sélectionner " class="BatchProcessing <#if !isCheckBoxActivated?boolean>hide</#if> "> </#macro>
Step 3 : in custom component, just include différent calls
<@batchProcessingCheckbox userId=user.id />
in the #list topics as topic bloc of code, include the ui
<@batchProcessingCheckboxUI relativeMessageId=messageRelativeId boardId=message.board.id isCheckBoxActivated=isCheckBoxActivated />
Finally add a little js script at the end of your component to show/hide checkbox on click on the menu
<@liaAddScript> ;(function($){ $('.hide-batch-checkboxes-link').click(function() { $('.BatchProcessing').addClass('hide'); }); $('.show-batch-checkboxes-link').click(function() { $('.BatchProcessing').removeClass("hide"); }); })(LITHIUM.jQuery); </@liaAddScript>