Namespace: helpers

Granite.author.ui. helpers

Contains convenience functions to generate UI elements

Idea is to provide convenience "intention-based" functions to generate commonly-used UI elements
and hide their implementation details (markup).

Source:
ui/ui.helpers.js

Members


<static, readonly> self.NOTIFICATION_TYPES :string

Type of available notification style

Type:
  • string
Properties:
Name Type Default Description
ERROR string error

Error notification.

NOTICE string warning

Notice notification.

SUCCESS string success

Success notification.

HELP string help

Help notification.

INFO string info

Info notification.

WARNING string warning

Warning prompt

Source:
ui/ui.helpers.js

<static, readonly> self.PROMPT_TYPES :string

Type of available prompt style

Type:
  • string
Properties:
Name Type Default Description
DEFAULT string default

Default prompt

ERROR string error

Error prompt

NOTICE string warning

Notice prompt

SUCCESS string success

Success prompt

HELP string help

Help prompt

INFO string info

Info prompt

WARNING string warning

Warning prompt

Source:
ui/ui.helpers.js

Methods


clearWait()

Removes the wait indicator

Source:
ui/ui.helpers.js

notify(config)

Notifies the user

Parameters:
Name Type Description
config Object

Notification configuration

Properties
Name Type Description
heading String

Notification heading

content String

Notification content

type String

Notification type, see Granite.author.ui.helpers.NOTIFICATION_TYPES

Source:
ui/ui.helpers.js

prompt(config)

Prompts a dialog to the user

Parameters:
Name Type Description
config Object

Prompt configuration

Properties
Name Type Argument Description
title String

Prompt dialog title

message String

Prompt dialog message content

type String

Prompt dialog type, see Granite.author.ui.helpers.PROMPT_TYPES

actions Array.<Object>

The action buttons available to the user

Properties
Name Type Argument Default Description
id String

Action button id

text String

Action button text

handler function <optional>

Action handler

primary Boolean <optional>
false

true styles the action as primary

warning Boolean <optional>
false

true styles the action as a warning

callback function <optional>

The callback function. The action.id and action will be passed as parameters

Source:
ui/ui.helpers.js

wait( [element])

Displays a wait indicator

Parameters:
Name Type Argument Description
element HTMLElement <optional>

Element to append the wait indicator to

Source:
ui/ui.helpers.js