Jump to navigation

Namespace: display

Numbas.display

Members

(static) modal :Object.<function()>

Callback functions for the modals

Type:
Source:

(static) showScoreFeedback

Update a score feedback box

Source:

Methods

(static) die(e)

The Numbas exam has failed so much it can't continue - show an error message and the error

Parameters:
Name Type Description
e Error
Source:

(static) getLocalisedAttribute(elem, name) → {String}

Get the attribute with the given name or, if it doesn't exist, look for localise-. If that exists, localise its value and set the desired attribute, then return it.

Parameters:
Name Type Description
elem Element
name String
Returns:
Type Description
String
Source:

(static) init()

Initialise the display. Called as soon as the page loads.

Source:

(static) localisePage()

Localise strings in page HTML - for tags with an attribute data-localise, run that attribute through R.js to localise it, and replace the tag's HTML with the result

Source:

(static) showAlert(msg, fnOK)

Show an alert dialog

Parameters:
Name Type Description
msg String

message to show the user

fnOK function

callback when OK is clicked

Source:

(static) showConfirm(msg, fnOK, fnCancel)

Show a confirmation dialog box

Parameters:
Name Type Description
msg String

message to show the user

fnOK function

callback if OK is clicked

fnCancel function

callback if cancelled

Source:

(static) showLoadProgress()

Update the progress bar when loading

Source:

(static) typeset(selectoropt, callback)

Make MathJax typeset any maths in the selector

Parameters:
Name Type Attributes Description
selector jQuery | Element <optional>

elements to typeset. If not given, the whole page is typeset

callback function

function to call when typesetting is finished

Source:

Type Definitions

feedback_state

Feedback states for a question or part: "wrong", "correct", "partial" or "none".

Type:
Source:

feedbackable

An object which can produce feedback: Numbas.Question or Numbas.parts.Part.

Type:
Properties:
Name Type Description
answered observable.<Boolean>

has the object been answered?

isDirty observable.<Boolean>

has the student's answer changed?

score observable.<Number>

number of marks awarded

marks observable.<Number>

number of marks available

credit observable.<Number>

proportion of available marks awarded

doesMarking observable.<Boolean>

does the object do any marking?

revealed observable.<Boolean>

have the correct answers been revealed?

Source:

scoreFeedback

A model representing feedback on an item which is marked - a question or a part.

Type:
Properties:
Name Type Description
update observable.<Boolean>

Call update(true) when the score changes. Used to trigger animations.

state observable.<Numbas.display.feedback_state>

The current state of the item, to be shown to the student.

answered observable.<Boolean>

Has the item been answered? False if the student has changed their answer since submitting.

answeredString observable.<String>

Translated text describing how much of the item has been answered: 'unanswered', 'partially answered' or 'answered'

message observable.<String>

Text summarising the state of the item.

iconClass observable.<String>

CSS class for the feedback icon.

iconAttr observable.<Object>

A dictionary of attributes for the feedback icon.

Source:

showScoreFeedback_settings

Type:
Properties:
Name Type Description
showTotalMark Boolean

Show the total marks available?

showActualMark Boolean

Show the student's current score?

showAnswerState Boolean

Show the correct/incorrect state after marking?

Source: