Jump to navigation

Class: PartDisplay

Numbas.display.PartDisplay

new PartDisplay(p)

Display methods for a generic question part.

Parameters:
Name Type Description
p Numbas.parts.Part

The associated part object.

Source:

Members

(static) answered :observable|boolean

Has the student answered this part?

Type:
Source:

(static) controls :object

Control functions.

Type:
Properties:
Name Type Description
toggleFeedback function

Toggle the display of the marking feedback messages.

submit function

Submit the student's answers for marking.

showSteps function

Show the steps.

hideSteps function

Hide the steps.

Source:

(static) credit :observable|number

Proportion of available marks awarded to the student - i.e. score/marks. Penalties will affect this instead of the raw score, because of things like the steps marking algorithm.

Type:
Source:

(static) doesMarking :observable|boolean

Does this part do any marking?

Type:
Source:
See:

(static) feedbackMessages :observable|Array.<string>

Feedback messages.

Type:
Source:

(static) feedbackShown :observable|boolean

Are the marking feedback messages visible?

Type:
Source:

(static) inputEvents :object

Event bindings.

Type:
Source:

(static) input_title :observable.<string>

Title text for this part's answer input.

Type:
Source:

(static) isDirty :observable|boolean

Has the student changed their answer since the last submission?

Type:
Source:

(static) isNotOnlyPart :observable|boolean

Are there other parts in line with this one? (Used to decide whether to show the submit button and feedback text) True if there's more than one part in the question, or this is a step.

Type:
Source:

(static) locked :observable|boolean

Has this part been locked?

Type:
Source:

(static) locked :observable|boolean

Is this part disabled? True if revealed or locked.

Type:
Source:

(static) madeNextParts :observableArray.<Numbas.display.PartDisplay>

Next parts that have been made.

Type:
Source:

(static) marks :observable|number

The total marks available for this part.

Type:
Source:
See:

(static) name :observable|string

The display name of this part.

Type:
Source:
See:

(static) nextParts :observable

Options for the next part.

Type:
Source:

(static) part :Numbas.parts.Part

The associated part object.

Type:
Source:

(static) partTreeCSS :observable.<object>

CSS classes for the parts tree display.

Type:
Source:

(static) pd.html_promise :Promise

A promise resolving to the part's HTML element.

Type:
  • Promise
Source:
See:

(static) question :Numbas.Question

The question this part belongs to.

Type:
Source:

(static) reachedDeadEnd :observable.<boolean>

Is this part a dead end? True if answered or doesn't do marking, and there are no next parts.

Type:
Source:

(static) revealed :observable|boolean

Have the correct answers been revealed?

Type:
Source:

(static) score :observable|number

The student's current score.

Type:
Source:
See:

(static) scoreFeedback :observable|Numbas.display.scoreFeedback

Display of this parts's current score / answered status.

Type:
Source:

(static) showCorrectAnswer :observable|boolean

Should the correct answer be shown? True if revealed and Numbas.parts.Part#settings.showCorrectAnswer) is true.

Type:
Source:

(static) showFeedbackBox :observable|boolean

Should the box containing part marks and the submit and feedback buttons be shown?

Type:
Source:

(static) showFeedbackIcon :observable|boolean

Should feedback icons be shown for this part?

Type:
Source:

(static) showFeedbackMessages :observable|boolean

Should the feedback messages be shown?

Type:
Source:

(static) showMarks :observable|boolean

Show the marks feedback?

Type:
Source:

(static) showName :observable|boolean

Should the name of this part be displayed?

Type:
Source:

(static) showNextParts :observable.<boolean>

Should the list of next parts be shown?

Type:
Source:

(static) showSubmitPart :observable|boolean

Show the "submit part" button?

Type:
Source:

(static) stepsOpen :observable|boolean

Are the steps currently open?

Type:
Source:
See:

(static) stepsPenaltyMessage :observable|string

Text to describe the state of the steps penalty.

Type:
Source:

(static) stepsShown :observable|boolean

Have the steps ever been shown?

Type:
Source:
See:

(static) toggleFeedbackText :observable|string

Text for the button to toggle the display of the feedback messages.

Type:
Source:

(static) visible :boolean

Should this part be shown?

Type:
Source:

(static) waiting_for_pre_submit :observable|boolean

Is this part waiting for some pre-submit tasks to finish before submitting?

Type:
Source:

(static) warnings :observable|Array.<Object.<string>>

Warnings based on the student's answer.

Type:
Source:

(static) warningsShown :observable|boolean

Should the warning box be shown?

Type:
Source:

(static) whatNextMessage :observable.<string>

Header for the menu of next parts.

Type:
Source:

Methods

setName(name)

Set this part's name.

Parameters:
Name Type Description
name string
Source:

(static) end()

Called when the exam ends.

Source:

(static) hideSteps()

Hide the steps.

Source:

(static) hideWarnings()

Hide the warnings.

Source:

(static) init()

Initialise this part's display.

Source:
See:

(static) lock()

Lock this part.

Source:

(static) removeWarnings()

Remove all previously displayed warnings.

Source:

(abstract, static) restoreAnswer(studentAnswer)

Fill the student's last submitted answer into inputs.

Parameters:
Name Type Description
studentAnswer object
Source:

(static) revealAnswer()

Show the correct answers to this part.

Source:

(static) setWarnings(warnings)

Set the list of warnings.

Parameters:
Name Type Description
warnings Array.<string>
Source:

(static) show()

Called when the part is displayed (basically when question is changed).

Source:
See:

(static) showScore(valid, noUpdate)

Show/update the student's score and answer status on this part.

Parameters:
Name Type Description
valid boolean
noUpdate boolean
Source:

(static) showSteps()

Called when 'show steps' button is pressed, or coming back to a part after steps shown.

Source:

(static) showWarnings()

Show the warnings.

Source:

(static) this.htmlBound()

Called when Knockout has finished binding the HTML for this part to the DOM.

Source:

(abstract, static) updateCorrectAnswer(answer)

Called when the correct answer to the question has changed (particularly when this part uses adaptive marking). The displayed correct answer should update.

Parameters:
Name Type Description
answer *
Source:

(static) updateNextParts()

Update the list of next parts. Called when an instance of a next part is created or removed.

Source:

(static) warning(warning)

Show a warning message about this part.

Parameters:
Name Type Description
warning string
Source: