MDL-71644 Quiz: The issues outstanding from MDL-70947.

Issue 1: While essay question's uploading progress, we need to disable submit
buttons to prevent submit form event.

Issue 2: Enable buttons after pressing cancel button on the popup
confirming overwrite file existed.
This commit is contained in:
Thong Bui 2021-05-18 18:15:25 +07:00
parent 0b69b37f04
commit f81cdd42b2
5 changed files with 38 additions and 10 deletions

View file

@ -175,6 +175,12 @@ M.mod_quiz.nav.init = function(Y) {
// Automatically submit the form. We do it this strange way because just
// calling form.submit() does not run the form's submit event handlers.
var submit = form.one('input[name="next"]');
// Navigation when button enable.
if (submit.get('disabled')) {
return;
}
submit.set('name', '');
submit.getDOMNode().click();
};

View file

@ -536,7 +536,9 @@ class mod_quiz_renderer extends plugin_renderer_base {
$output .= html_writer::start_tag('div', array('class' => 'submitbtns'));
if ($page > 0 && $navmethod == 'free') {
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'previous',
'value' => get_string('navigateprevious', 'quiz'), 'class' => 'mod_quiz-prev-nav btn btn-secondary'));
'value' => get_string('navigateprevious', 'quiz'), 'class' => 'mod_quiz-prev-nav btn btn-secondary',
'id' => 'mod_quiz-prev-nav'));
$this->page->requires->js_call_amd('core_form/submit', 'init', ['mod_quiz-prev-nav']);
}
if ($lastpage) {
$nextlabel = get_string('endtest', 'quiz');
@ -544,8 +546,9 @@ class mod_quiz_renderer extends plugin_renderer_base {
$nextlabel = get_string('navigatenext', 'quiz');
}
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'next',
'value' => $nextlabel, 'class' => 'mod_quiz-next-nav btn btn-primary'));
'value' => $nextlabel, 'class' => 'mod_quiz-next-nav btn btn-primary', 'id' => 'mod_quiz-next-nav'));
$output .= html_writer::end_tag('div');
$this->page->requires->js_call_amd('core_form/submit', 'init', ['mod_quiz-next-nav']);
return $output;
}