Conditional elements display
Revision as of 06:56, 10 December 2023 by Admin (talk | contribs) (Created page with "==== Features Added ==== * Added new setting in the builder to enter conditional display formula * Extended the file structure to allow adding new trait types, following a class-based code structure. * Added new custom trait type: codeblock * Assigned a new trait "hide-if" to all components, when the Portal Builder has finished rendering ==== Testing and Validation ==== # Create a new portal page # Add any element # Go to settings/traits (second tab of the right-side...")
Features Added
- Added new setting in the builder to enter conditional display formula
- Extended the file structure to allow adding new trait types, following a class-based code structure.
- Added new custom trait type: codeblock
- Assigned a new trait "hide-if" to all components, when the Portal Builder has finished rendering
Testing and Validation
- Create a new portal page
- Add any element
- Go to settings/traits (second tab of the right-side panel)
- The codeblock 'Hide if' expects an inner function body Example:
return 1 == 1;
orreturn {{currentUser.Id}} == null
- Save the page & preview
- The condition will be evaluated and if the result is 'true', the element will be hidden.
Additional Information
Added validation logic, which handles custom expressions {{xxxx}} by converting them to a value, so that they wouldn't trigger a falsely invalid function body.