JavaScript¶
Nuit provides a number of JavaScript hooks to dynamically alter the Nuit elements of your page.
-
nuit.
add_message
(alert_type, message)¶ Inject a message box onto the page.
Parameters: - alert_type (str) – The type of message: one of
debug
,info
,success
,warning
, orerror
. - message (str) – The message to display.
- alert_type (str) – The type of message: one of
-
nuit.
confirmation_box
(options)¶ Display a confirmation box.
Parameters: options (dict) – Optional parameters to customise the confirmation box. -
title
¶ Default: ‘Confirmation required’ The title for the confirmation box.
-
description
¶ Default: ‘<p>Are you sure you wish to perform this action?</p>’ A more detailed description of what the confirmation box is for.
-
size
¶ Default: ‘tiny’ A Foundation attribute for the size of the box: one of
tiny
,small
,medium
,large
,xlarge
. Applied as a class, so you can define your own.
-
yes
¶ Default: ‘Yes’ The text for the confirm button.
-
no
¶ Default: ‘No’ The text for the abort button.
-
on_confirm
¶ A function that gets executed when the user clicks the confirm button.
-
on_abort
¶ A function that gets executed when the user clicks the abort button.
-
Get or set the value of a button bar.
Parameters: - button_bar (obj) – a jQuery object of the button bar.
- value (str) – The value to set the object to. If ommitted, the current value is returned instead.