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) makeHTMLFromXML(xml, template, scope, contextDescription) → {Promise}

Make HTML from an XML node and bind it to the given scope and display object. Variables are substituted from the given scope using Numbas.jme.variables.DOMcontentsubvars.

Parameters:
Name Type Description
xml Element
template XMLDocument
scope Numbas.jme.Scope
contextDescription string

Description of the JME context, for error messages.

Returns:
Type Description
Promise
  • Resolves to the produced HTML element after variables have been substituted.
Source:

(static) setJMEScope(element, scope)

Associate a JME scope with the given element.

Parameters:
Name Type Description
element Element
scope Numbas.jme.Scope
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) showStyleModal()

Show the modal with styling options.

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?

plainScore boolean

Show the score without the "Score: " prefix?

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?

reviewShowScore boolean

Show the score once answers have been revealed?

Source: