Skip to content

Add documentation for new flexible menu item API (al_menu_items_custom_items) - #538

Merged
nonprofittechy merged 2 commits into
mainfrom
copilot/add-menu-item-api-documentation
Sep 9, 2025
Merged

Add documentation for new flexible menu item API (al_menu_items_custom_items)#538
nonprofittechy merged 2 commits into
mainfrom
copilot/add-menu-item-api-documentation

Conversation

Copilot AI commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

This PR adds comprehensive documentation for the new flexible menu item API introduced in PR #726, which allows interview authors to add custom menu items to the dropdown/hamburger menu in Assembly Line interviews.

What's New

The new al_menu_items_custom_items variable enables developers to:

  • Add custom menu items to interview navigation menus
  • Display custom items before default Assembly Line menu items (Start over, Exit, etc.)
  • Create both static and dynamic menu items with show/hide logic
  • Use standard Docassemble menu item format with url, label, and optional hidden keys

Documentation Added

Basic Static Menu Items

Simple configuration using a data block for static menu items:

---
variable name: al_menu_items_custom_items
data:
  - url: https://example.com/help
    label: Help and Support
  - url: https://example.com/about
    label: About this form

Dynamic Menu Items with Show/Hide Logic

Advanced configuration using data from code with conditional visibility:

---
reconsider: True
variable name: al_menu_items_custom_items
data from code:
  - url: |
      "https://example.com/help"
    label: |
       "Help and Support"
  - url: |
      url_action('save_progress')
    label: |
       "Save my progress"
    hidden: not user_logged_in() or (_internal.get('steps') < 2)

Best Practices Included

  • Using reconsider: True for dynamic menu items
  • Avoiding undefined variable triggers with showifdef(), defined(), and hasattr()
  • Progressive disclosure patterns with _internal.get('steps') < 2
  • Context-sensitive help menu examples

The documentation is integrated into the existing "Special variables" page under the "Run-time options" section, maintaining consistency with the existing documentation structure.

![Documentation Screenshot](https://github.com/user-attachments/assets/1fd92453-e871-4901-ac07-4aa01b10e006)

Fixes #369.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: nonprofittechy <7645641+nonprofittechy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add documentation of the new, more flexible menu item API Add documentation for new flexible menu item API (al_menu_items_custom_items) Sep 9, 2025
Copilot AI requested a review from nonprofittechy September 9, 2025 13:46
@nonprofittechy
nonprofittechy marked this pull request as ready for review September 9, 2025 13:59
@nonprofittechy
nonprofittechy merged commit 9b28f2a into main Sep 9, 2025
3 checks passed
@nonprofittechy
nonprofittechy deleted the copilot/add-menu-item-api-documentation branch September 9, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation of the new, more flexible menu item API

2 participants