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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

  1. Create a new portal page
  2. Add any element
  3. Go to settings/traits (second tab of the right-side panel)
  4. The codeblock 'Hide if' expects an inner function body Example: return 1 == 1;or return {{currentUser.Id}} == null
  5. Save the page & preview
  6. 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.