# 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

  • heading
  • img
  • javascript
  • password
  • select
  • style
  • template
  • textbox

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

  • button
  • checkbox

# API Documentation

# Functions

# heading

Signature cp.web.ui.heading(params) -> cp.web.html
Type Function
Description Creates 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.
Examples None
Source src/extensions/cp/web/ui.lua line 91

# img

Signature cp.web.ui.img(params) -> cp.web.html
Type Function
Description Generates 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.
Examples None
Source src/extensions/cp/web/ui.lua line 326

# javascript

Signature cp.web.ui.javascript(script[, context][, naked]) -> cp.web.html
Type Function
Description Generates 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