AppSettingModalController

AppSettingModal Stimulus Controller

Manages the edit modal for app settings, handling:

  • Loading edit form via turbo-frame when edit button is clicked
  • Coordinating with outlet-btn controller for data passing
  • Managing modal state and turbo-frame loading

Features:

  • Dynamic form loading via turbo-frame
  • Integration with outlet-btn for row data
  • Bootstrap modal coordination
  • Loading state management

Values:

  • editUrl: String - Base URL for edit action
  • modalId: String - ID of the modal element (default: editAppSettingModal)
  • frameId: String - ID of the turbo-frame element (default: editAppSettingFrame)

Note: This controller uses direct DOM queries for the modal and frame elements because they are rendered in the modals block which is outside the controller's DOM scope. Stimulus targets only work within the controller's element tree.

Usage:

Constructor

new AppSettingModalController()

Members

frameElement

Get the frame element by ID Uses direct DOM query since frame is outside controller scope

modalElement

Get the modal element by ID Uses direct DOM query since modal is outside controller scope

Methods

connect()

Connect - set up event listeners

disconnect()

Disconnect - clean up event listeners

handleOutletClick(event)

Handle outlet button click event Loads the edit form for the clicked setting

Parameters:
NameTypeDescription
eventCustomEvent

The outlet-button-clicked event

initialize()

Initialize controller

loadEditForm(id)

Load the edit form into the turbo-frame

Parameters:
NameTypeDescription
idstring | number

The app setting ID to edit