mod_quiz/edit_multiple_grades

Description:
  • JavaScript for managing multiple grade items for a quiz.

Source:
License:
  • http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

JavaScript for managing multiple grade items for a quiz.

Members

(static, constant) init

Description:
  • Entry point.

Source:

Entry point.

(inner, constant) SELECTORS :Object

Description:
  • selectors used in this code.

Source:

selectors used in this code.

Type:
  • Object

Methods

(inner) autoSetupGradeItems(quizId) → {Promise}

Description:
  • Call the Ajax service to setup one grade item for each quiz section.

Source:
Parameters:
Name Type Description
quizId Number

id of the quiz to update.

Returns:

Promise that resolves to the context required to re-render the page.

Type
Promise

(inner) callServiceAndReturnRenderingData(methodCall) → {Promise.<Object>}

Description:
  • Make a web service call, and also call mod_quiz_get_edit_grading_page_data to get the date to re-render the page.

Source:
Parameters:
Name Type Description
methodCall Object

a web service call to pass to fetchMany. Must include methodCall.args.quizid.

Returns:

a promise that resolves to the template context required to re-render the page.

Type
Promise.<Object>

(inner) callServicesAndReturnRenderingData(methodCalls) → {Promise.<Object>}

Description:
  • Make a web service call, and also call mod_quiz_get_edit_grading_page_data to get the date to re-render the page.

Source:
Parameters:
Name Type Description
methodCalls Array.<Object>

web service calls to pass to fetchMany. Must include methodCalls[0].args.quizid.

Returns:

a promise that resolves to the template context required to re-render the page.

Type
Promise.<Object>

(inner) createGradeItem(quizId) → {Promise.<Object>}

Description:
  • Call the Ajax service to create a quiz grade item.

Source:
Parameters:
Name Type Description
quizId Number

id of the quiz to update.

Returns:

a promise that resolves to the template context required to re-render the page.

Type
Promise.<Object>

(inner) deleteGradeItem(quizId, gradeItemId) → {Promise}

Description:
  • Call the Ajax service to delete a quiz grade item.

Source:
Parameters:
Name Type Description
quizId Number

id of the quiz to update.

gradeItemId Number

id of the grade item to delete.

Returns:

Promise that resolves to the context required to re-render the page.

Type
Promise

(inner) handleAddGradeItemClick(e)

Description:
  • Handle clicks on the 'Add grade item' button.

Source:
Parameters:
Name Type Description
e Event

click event.

(inner) handleAutoSetup(e)

Description:
  • Handle clicks on the reset button - show a confirmation.

Source:
Parameters:
Name Type Description
e Event

click event.

(inner) handleButtonClick(e)

Description:
  • Handle clicks on the buttons.

Source:
Parameters:
Name Type Description
e Event

click event.

(inner) handleGradeItemClick(e)

Description:
  • Handle clicks in the table the shows the grade items.

Source:
Parameters:
Name Type Description
e Event

click event.

(inner) handleGradeItemDelete(e)

Description:
  • Handle click events on the delete icon.

Source:
Parameters:
Name Type Description
e Event

click event.

(inner) handleGradeItemEditStart(e)

Description:
  • Handle click events on the start rename icon.

Source:
Parameters:
Name Type Description
e Event

click event.

(inner) handleGradeItemFocusOut(e)

Description:
  • Handle focus out of the editable.

Source:
Parameters:
Name Type Description
e Event

event.

(inner) handleGradeItemKeyDown(e)

Description:
  • Handle key down in the editable.

Source:
Parameters:
Name Type Description
e Event

key event.

(inner) handleGradeItemKeyUp(e)

Description:
  • Handle key up in the editable.

Source:
Parameters:
Name Type Description
e Event

key event.

(inner) handleResetAllClick(e)

Description:
  • Handle clicks on the reset button - show a confirmation.

Source:
Parameters:
Name Type Description
e Event

click event.

(inner) handleSlotGradeItemChanged(e)

Description:
  • Handle when the selected grade item for a slot is changed.

Source:
Parameters:
Name Type Description
e Event

event.

(inner) reRenderPage(editGradingPageData) → {Promise.<void>}

Description:
  • Replace the contents of the page with the page re-rendered from the provided data, once that promise resolves.

Source:
Parameters:
Name Type Description
editGradingPageData Object

the template context data required to re-render the page.

Returns:

a promise that will resolve when the page is updated.

Type
Promise.<void>

(inner) reallyResetAll(button)

Description:
  • Really reset all if the confirmation is OKed.

Source:
Parameters:
Name Type Description
button HTMLElement

the reset button.

(inner) registerEventListeners()

Description:
  • Replace the container with a new version.

Source:

(inner) stopEditingGadeItem(editableSpan)

Source:
Parameters:
Name Type Description
editableSpan HTMLElement

the editable to turn off.

(inner) updateGradeItem(quizId, gradeItemId, newName) → {Promise}

Description:
  • Call the Ajax service to update a quiz grade item.

Source:
Parameters:
Name Type Description
quizId Number

id of the quiz to update.

gradeItemId Number

id of the grade item to update.

newName String

the new name to set.

Returns:

Promise that resolves to the context required to re-render the page.

Type
Promise

(inner) updateSlotGradeItem(quizId, slotId, gradeItemId) → {Promise}

Description:
  • Call the Ajax service to update the quiz grade item used by a slot.

Source:
Parameters:
Name Type Description
quizId Number

id of the quiz to update.

slotId Number

id of the slot to update.

gradeItemId Number | null

new grade item ot set, or null to un-set.

Returns:

Promise that resolves to the context required to re-render the page.

Type
Promise