renderSettings

Generates a HTML form for a configuration struct T with automatic instant updates using AJAX. The fields can be annotated with the various UDAs found in this module. (setting enums + structs)
Supported types: enum (drop down lists or radio box lists), std.typecons.BitFlags (checkbox lists), bool (checkbox), string types (text, email, url, etc.), numeric types (number), std.datetime.DateTime (datetime-local), std.datetime.Date (date), std.datetime.TimeOfDay (time), vibe.inet.URL (url), string[] (textarea taking each line)

  1. string renderSettings(T value, string formAttributes, string action, string method, string jsAction)
    @safe
    string
    renderSettings
    (
    T
    InputGenerator = DefaultInputGenerator
    string javascript = DefaultJavascriptCode
    )
    (,
    string formAttributes = ""
    ,
    string action = "/settings"
    ,
    string method = "POST"
    ,
    string jsAction = "/api/setting"
    )
  2. string renderSettings(T value, ulong set, string formAttributes, string action, string method, string jsAction)

Parameters

T

the config struct type.

InputGenerator

the input generator to use.

javascript

the javascript code to embed including script tag.

value T

an existing config value to prefill the inputs.

formAttributes string

extra HTML to put into the form.

action string

Path to the form submit HTTP endpoint.

method string

Method to use for the submit HTTP endpoint. Also replaces {method} inside the javascript template.

jsAction string

Path to the javascript form submit HTTP endpoint. Replaces {action} inside the javascript template. If empty then no js will be emitted.

Meta