WaiverTemplateController

WaiverTemplate Stimulus Controller

Manages the waiver template source selection interface, allowing users to choose between uploading a PDF file or providing an external URL.

Features:

  • Toggle between file upload and URL input
  • Show/hide appropriate fields based on selection
  • Clear unused fields when switching modes

Values:

  • source: String - Current template source ('upload', 'url', or 'none')

Targets:

  • uploadSection: Container for file upload field
  • urlSection: Container for external URL field
  • fileInput: File input element
  • urlInput: URL text input element

Usage:

Methods

connect()

Initialize controller

fileSelected(event)

Handle file input change - auto-select upload option

Parameters:
NameTypeDescription
eventEvent

Change event from file input

sourceValueChanged()

Handle source value changes

toggleSource(event)

Handle template source selection change

Parameters:
NameTypeDescription
eventEvent

Change event from source select

updateDisplay()

Update the display based on current source value