Wagtail client-side components
    Preparing search index...

    Adds the ability to make an element dismissible so that it updates it's class and makes an async request. Initialize such elements with a default handler that performs the dismissal. This only initializes elements that are rendered by the server (if they have the data attr), so elements that are rendered by the client (e.g. React) needs to be handled separately.

    <section
    data-controller="w-dismissible"
    data-w-dismissible-dismissed-class="w-dismissible--dismissed"
    data-w-dismissible-id-value="Whats new in Wagtail"
    >
    <button type="button" data-action="w-dismiss#dismissible">Close</button>
    </section>

    Hierarchy

    Index

    Constructors

    • Parameters

      • context: Context

      Returns DismissibleController

    Properties

    context: Context
    dismissedClass: string
    dismissedValue: boolean
    idValue: string
    blessings: (<T>(constructor: Constructor<T>) => any)[]
    classes: string[] = ...
    outlets: string[]
    targets: string[]
    values: {
        dismissed: { default: boolean; type: BooleanConstructor };
        id: { default: string; type: StringConstructor };
    } = ...

    Accessors

    • get application(): Application

      Returns Application

    • get classes(): ClassMap

      Returns ClassMap

    • get data(): DataMap

      Returns DataMap

    • get element(): ElementType

      Returns ElementType

    • get identifier(): string

      Returns string

    • get outlets(): OutletSet

      Returns OutletSet

    • get scope(): Scope

      Returns Scope

    • get targets(): TargetSet

      Returns TargetSet

    • get shouldLoad(): boolean

      Returns boolean

    Methods

    • Returns void

    • Returns void

    • Parameters

      • eventName: string
      • Optional__namedParameters: Partial<
            {
                bubbles: boolean;
                cancelable: boolean;
                detail: Object;
                prefix: string;
                target: Element
                | Window
                | Document;
            },
        >

      Returns CustomEvent<Object>

    • Returns void

    • Send a PATCH request to the server to update the dismissible state for the given ID and update value.

      Parameters

      • Optionalevent: Event & { params?: { value?: string | boolean } }

        The event that triggered the patch, with optional params. The param can technically be any value, but we currently only use booleans and strings.

      Returns void

    • Upon activating the toggle, send an update to the server and add the appropriate class and data attribute optimistically. Each dismissible defines how it uses (or not) these indicators.

      Parameters

      • Optionalevent: Event & { params?: { value?: string | boolean } }

      Returns void

    • Parameters

      • _identifier: string
      • _application: Application

      Returns void