#cp.web.ui

This extension contains functions which simplify the creation of standard UI events using cp.web.html as the basis. Most functions return a html element which is potentially dynamically updatable. Most values can be set using a value or a function, and if functions are provided, they are re-evaluated every time the element is generated.


#API Overview

Functions - API calls offered directly by the extension

Constructors - API calls which return an object, typically one that offers API methods


#API Documentation

#Functions

Signaturecp.web.ui.heading(params) -> cp.web.html
TypeFunction
DescriptionCreates a cp.web.html element for a heading with a specific level
Parameters
  • params - The parameters table. Details below.
Returns
  • cp.web.html element representing the heading.
Notes
  • The params table has the following fields:
  • ** text - The string (or function) containing the text of the heading.
  • ** level - The heading level (or function) (1-7). Defaults to 3.
  • ** class - The CSS class (or function) for the heading tag.
ExamplesNone
Sourcesrc/extensions/cp/web/ui.lua line 91

Signaturecp.web.ui.img(params) -> cp.web.html
TypeFunction
DescriptionGenerates a cp.web.html img element.
Parameters
  • params - A table or function returning a table with the checkbox data.
Returns
  • A cp.web.html with the select defined.
Notes
  • The params table has the following supported fields:
  • ** src - The source of the image. If this points to a local file, it will be encoded as Base64.
  • ** class - A string, (or function returning a string) with the CSS class for the element.
  • ** width - The width of the image.
  • ** height - The height of the image.
ExamplesNone
Sourcesrc/extensions/cp/web/ui.lua line 326

Signaturecp.web.ui.javascript(script[, context][, naked]) -> cp.web.html
TypeFunction
DescriptionGenerates an HTML script element which will execute the provided JavaScript immediately.
Parameters
  • script - String containing the JavaScript to execute.
  • context - (optional) Table containing any values to inject into the script.
  • naked - (optional) If true, the javascript will be returned without a surrounding