mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
MDL-47959 Number of questions not updated dynamically in new quiz edit page
This commit is contained in:
parent
e3d3e1e652
commit
6375e98cbb
@ -939,6 +939,7 @@ class edit_renderer extends \plugin_renderer_base {
|
||||
'confirmremovequestion',
|
||||
'dragtoafter',
|
||||
'dragtostart',
|
||||
'numquestionsx',
|
||||
'removepagebreak',
|
||||
), 'quiz');
|
||||
|
||||
|
@ -613,6 +613,8 @@ class structure {
|
||||
question_delete_question($slot->questionid);
|
||||
}
|
||||
|
||||
unset($this->questions[$slot->questionid]);
|
||||
|
||||
$this->refresh_page_numbers_and_update_db($quiz);
|
||||
|
||||
$trans->allow_commit();
|
||||
|
@ -134,7 +134,7 @@ switch($requestmethod) {
|
||||
quiz_delete_previews($quiz);
|
||||
quiz_update_sumgrades($quiz);
|
||||
echo json_encode(array('newsummarks' => quiz_format_grade($quiz, $quiz->sumgrades),
|
||||
'deleted' => true));
|
||||
'deleted' => true, 'newnumquestions' => $structure->get_question_count()));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -38,6 +38,8 @@ Feature: Edit quiz page - delete
|
||||
And I should see "Question B" on quiz page "1"
|
||||
And I should see "Question C" on quiz page "2"
|
||||
And I should see "Total of marks: 3.00"
|
||||
And I should see "Questions: 3"
|
||||
And I should see "This quiz is open"
|
||||
|
||||
# Delete last question in last page. Page contains multiple questions
|
||||
When I delete "Question C" in the quiz by clicking the delete icon
|
||||
@ -45,6 +47,7 @@ Feature: Edit quiz page - delete
|
||||
And I should see "Question B" on quiz page "1"
|
||||
And I should not see "Question C" on quiz page "2"
|
||||
And I should see "Total of marks: 2.00"
|
||||
And I should see "Questions: 2"
|
||||
|
||||
# Delete last question in last page. The page contains multiple questions and there are multiple pages.
|
||||
When I click on the "Add" page break icon after question "Question A"
|
||||
|
@ -53,6 +53,7 @@ YUI.add('moodle-mod_quiz-toolboxes', function (Y, NAME) {
|
||||
INSTANCEMAXMARK : 'span.instancemaxmark',
|
||||
MODINDENTDIV : '.mod-indent',
|
||||
MODINDENTOUTER : '.mod-indent-outer',
|
||||
NUMQUESTIONS : '.numberofquestions',
|
||||
PAGECONTENT : 'div#page-content',
|
||||
PAGELI : 'li.page',
|
||||
SECTIONUL : 'ul.section',
|
||||
@ -126,6 +127,9 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
if (responsetext.newsummarks) {
|
||||
Y.one(SELECTOR.SUMMARKS).setHTML(responsetext.newsummarks);
|
||||
}
|
||||
if (responsetext.newnumquestions) {
|
||||
Y.one(SELECTOR.NUMQUESTIONS).setHTML(M.util.get_string('numquestionsx', 'quiz', responsetext.newnumquestions));
|
||||
}
|
||||
if (success_callback) {
|
||||
Y.bind(success_callback, this, responsetext)();
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -53,6 +53,7 @@ YUI.add('moodle-mod_quiz-toolboxes', function (Y, NAME) {
|
||||
INSTANCEMAXMARK : 'span.instancemaxmark',
|
||||
MODINDENTDIV : '.mod-indent',
|
||||
MODINDENTOUTER : '.mod-indent-outer',
|
||||
NUMQUESTIONS : '.numberofquestions',
|
||||
PAGECONTENT : 'div#page-content',
|
||||
PAGELI : 'li.page',
|
||||
SECTIONUL : 'ul.section',
|
||||
@ -126,6 +127,9 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
if (responsetext.newsummarks) {
|
||||
Y.one(SELECTOR.SUMMARKS).setHTML(responsetext.newsummarks);
|
||||
}
|
||||
if (responsetext.newnumquestions) {
|
||||
Y.one(SELECTOR.NUMQUESTIONS).setHTML(M.util.get_string('numquestionsx', 'quiz', responsetext.newnumquestions));
|
||||
}
|
||||
if (success_callback) {
|
||||
Y.bind(success_callback, this, responsetext)();
|
||||
}
|
||||
|
4
mod/quiz/yui/src/toolboxes/js/toolbox.js
vendored
4
mod/quiz/yui/src/toolboxes/js/toolbox.js
vendored
@ -51,6 +51,7 @@
|
||||
INSTANCEMAXMARK : 'span.instancemaxmark',
|
||||
MODINDENTDIV : '.mod-indent',
|
||||
MODINDENTOUTER : '.mod-indent-outer',
|
||||
NUMQUESTIONS : '.numberofquestions',
|
||||
PAGECONTENT : 'div#page-content',
|
||||
PAGELI : 'li.page',
|
||||
SECTIONUL : 'ul.section',
|
||||
@ -124,6 +125,9 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
if (responsetext.newsummarks) {
|
||||
Y.one(SELECTOR.SUMMARKS).setHTML(responsetext.newsummarks);
|
||||
}
|
||||
if (responsetext.newnumquestions) {
|
||||
Y.one(SELECTOR.NUMQUESTIONS).setHTML(M.util.get_string('numquestionsx', 'quiz', responsetext.newnumquestions));
|
||||
}
|
||||
if (success_callback) {
|
||||
Y.bind(success_callback, this, responsetext)();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user