diff --git a/public/mod/quiz/classes/output/edit_renderer.php b/public/mod/quiz/classes/output/edit_renderer.php index a8cdfff6017..db8896e2f86 100644 --- a/public/mod/quiz/classes/output/edit_renderer.php +++ b/public/mod/quiz/classes/output/edit_renderer.php @@ -1001,9 +1001,21 @@ class edit_renderer extends \plugin_renderer_base { if (!$structure->can_be_edited()) { $disabled = 'disabled'; } - return html_writer::span($this->action_link($url, $image, null, ['title' => $title, - 'class' => 'page_split_join cm-edit-action', 'disabled' => $disabled, 'data-action' => $action]), - 'page_split_join_wrapper'); + return html_writer::span( + $this->action_link( + $url, + $image, + null, + [ + 'title' => $title, + 'aria-label' => $title, + 'class' => 'page_split_join cm-edit-action btn btn-sm icon-no-margin', + 'disabled' => $disabled, + 'data-action' => $action, + ] + ), + 'page_split_join_wrapper' + ); } /** @@ -1021,13 +1033,11 @@ class edit_renderer extends \plugin_renderer_base { ]; if ($structure->is_question_dependent_on_previous_slot($slot)) { $title = get_string('questiondependencyremove', 'quiz', $a); - $image = $this->pix_icon('t/locked', get_string('questiondependsonprevious', 'quiz'), - 'moodle', ['title' => '']); + $image = $this->pix_icon('t/locked', ''); $action = 'removedependency'; } else { $title = get_string('questiondependencyadd', 'quiz', $a); - $image = $this->pix_icon('t/unlocked', get_string('questiondependencyfree', 'quiz'), - 'moodle', ['title' => '']); + $image = $this->pix_icon('t/unlocked', ''); $action = 'adddependency'; } @@ -1040,9 +1050,22 @@ class edit_renderer extends \plugin_renderer_base { if (!$structure->can_question_depend_on_previous_slot($slot)) { $extraclass = ' question_dependency_cannot_depend'; } - return html_writer::span($this->action_link('#', $image, null, ['title' => $title, - 'class' => 'cm-edit-action', 'disabled' => $disabled, 'data-action' => $action]), - 'question_dependency_wrapper' . $extraclass); + return html_writer::span( + $this->action_link( + '#', + $image, + null, + [ + 'title' => $title, + 'aria-label' => $title, + 'class' => 'cm-edit-action btn btn-link btn-sm icon-no-margin', + 'disabled' => $disabled, + 'data-action' => $action, + 'role' => 'button', + ] + ), + 'question_dependency_wrapper' . $extraclass + ); } /** diff --git a/public/mod/quiz/styles.css b/public/mod/quiz/styles.css index 33ab3fe8db2..9aad4c6e943 100644 --- a/public/mod/quiz/styles.css +++ b/public/mod/quiz/styles.css @@ -615,7 +615,7 @@ table.quizreviewsummary td.cell { #page-mod-quiz-edit ul.section { margin: 0; - padding: 0 20px; + padding: 0 38px; } #page-mod-quiz-edit ul.slots { @@ -688,8 +688,11 @@ table.quizreviewsummary td.cell { #page-mod-quiz-edit ul.slots li.section li.activity .page_split_join_wrapper { position: absolute; - left: -20px; - bottom: -11px; + left: -38px; + bottom: -18px; + .icon { + width: auto; + } } #page-mod-quiz-edit ul.slots li.section li.activity .instancemaxmark.decimalplaces_0 { @@ -742,8 +745,8 @@ table.quizreviewsummary td.cell { #page-mod-quiz-edit ul.slots li.section li.activity .question_dependency_wrapper { position: absolute; - top: -1em; - right: -20px; + top: -1.25em; + right: -38px; } #page-mod-quiz-edit ul.slots li.section li.activity .question_dependency_wrapper.question_dependency_cannot_depend { diff --git a/public/mod/quiz/tests/behat/editing_require_previous.feature b/public/mod/quiz/tests/behat/editing_require_previous.feature index 1861fa80395..22bcd903692 100644 --- a/public/mod/quiz/tests/behat/editing_require_previous.feature +++ b/public/mod/quiz/tests/behat/editing_require_previous.feature @@ -51,7 +51,7 @@ Feature: Edit quizzes where some questions require the previous one to have been | TF1 | 1 | 0 | | TF2 | 1 | 1 | And I am on the "Quiz 1" "mod_quiz > Edit" page - Then "This question cannot be attempted until the previous question has been completed." "link" should be visible + Then "Question 2 cannot be attempted until the previous question 1 has been completed" "button" should be visible @javascript Scenario: A question can depend on a random question @@ -66,9 +66,9 @@ Feature: Edit quizzes where some questions require the previous one to have been | Random (Test questions) | 1 | 0 | Test questions | | TF1 | 1 | 1 | | And I am on the "Quiz 1" "mod_quiz > Edit" page - Then "This question cannot be attempted until the previous question has been completed." "link" should be visible + Then "Question 2 cannot be attempted until the previous question 1 has been completed" "button" should be visible - @javascript + @javascript @accessibility Scenario: The second question can be set to depend on the first Given the following "activities" exist: | activity | name | intro | course | idnumber | preferredbehaviour | @@ -84,9 +84,10 @@ Feature: Edit quizzes where some questions require the previous one to have been | TF2 | 1 | 0 | | TF3 | 1 | 0 | And I am on the "Quiz 1" "mod_quiz > Edit" page - When I follow "No restriction on when question 2 can be attempted • Click to change" - Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible - And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible + When I click on "No restriction on when question 2 can be attempted • Click to change" "button" + Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "button" should be visible + And "No restriction on when question 3 can be attempted • Click to change" "button" should be visible + And the "region-main" "region" should meet accessibility standards with "best-practice" extra tests @javascript Scenario: A question that did depend on the previous can be un-linked @@ -104,9 +105,9 @@ Feature: Edit quizzes where some questions require the previous one to have been | TF2 | 1 | 1 | | TF3 | 1 | 1 | And I am on the "Quiz 1" "mod_quiz > Edit" page - When I follow "Question 3 cannot be attempted until the previous question 2 has been completed • Click to change" - Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible - And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible + When I click on "Question 3 cannot be attempted until the previous question 2 has been completed • Click to change" "button" + Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "button" should be visible + And "No restriction on when question 3 can be attempted • Click to change" "button" should be visible @javascript Scenario: Question dependency cannot apply to deferred feedback quizzes so UI is hidden @@ -230,6 +231,6 @@ Feature: Edit quizzes where some questions require the previous one to have been | TF3 | 1 | 1 | And I am on the "Quiz 1" "mod_quiz > Edit" page When I move "TF1" to "After Question 3" in the quiz by clicking the move icon - Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "link" should be visible - And "No restriction on when question 3 can be attempted • Click to change" "link" should be visible + Then "Question 2 cannot be attempted until the previous question 1 has been completed • Click to change" "button" should be visible + And "No restriction on when question 3 can be attempted • Click to change" "button" should be visible And "be attempted" "link" in the "TF2" "list_item" should not be visible diff --git a/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js b/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js index 77bb876564f..5c79980c446 100644 --- a/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js +++ b/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js @@ -384,8 +384,8 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { // Replace move icons var move = resourcesnode.one('a.' + CSS.EDITINGMOVE); if (move) { - var resourcedraghandle = this.get_drag_handle(M.util.get_string('move', 'moodle'), - CSS.EDITINGMOVE, CSS.ICONCLASS, true); + var dragHandleClass = 'btn px-1 icon-no-margin ' + CSS.EDITINGMOVE; + var resourcedraghandle = this.get_drag_handle(M.util.get_string('move', 'moodle'), dragHandleClass, CSS.ICONCLASS); move.replace(resourcedraghandle); } }, this); diff --git a/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js b/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js index 47197659f29..70d5b88def8 100644 --- a/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js +++ b/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-mod_quiz-dragdrop",function(g,e){var o,u=".actions",t="activity",p="mod-quiz-edit-content",r="editing_move",s="iconsmall",c="jumpmenu",n="left",h="movedown",_="moveup",m="page-content",d="right",f="slots",a="section-handle",v="slots",l="sectiondraggable",z="li.page",q="li.slot",i=function(){i.superclass.constructor.apply(this,arguments)};g.extend(i,M.core.dragdrop,{sectionlistselector:null,initializer:function(){if(this.groups=[l],this.samenodeclass="section",this.parentnodeclass="slots",g.Node.one("."+c))return!1;var e;this.sectionlistselector="li.section",this.sectionlistselector&&(this.sectionlistselector="."+p+" "+this.sectionlistselector,this.setup_for_section(this.sectionlistselector),(e=new g.DD.Delegate({container:"."+p,nodes:"."+l,target:!0,handles:["."+n],dragConfig:{groups:this.groups}})).dd.plug(g.Plugin.DDProxy,{moveOnEnd:!1}),e.dd.plug(g.Plugin.DDConstrained,{constrain:"#"+m,stickY:!0}),e.dd.plug(g.Plugin.DDWinScroll))},setup_for_section:function(e){g.Node.all(e).each(function(e){var o,t,i,s=g.Moodle.core_course.util.section.getId(e);0'),t=g.Node.create('');t.setStyle("margin",0),t.setContent(e.get("node").get("innerHTML")),o.appendChild(t),e.get("dragNode").setContent(o),e.get("dragNode").addClass(p)},drag_dropmiss:function(e){this.drop_hit(e)},get_section_index:function(e){var o="."+p+" li.section",o=g.all(o);return o.indexOf(e)-o.indexOf(g.one("#section-0"))},drop_hit:function(d){var r,a,e,n,o,t=d.drag,c=t.get("node"),i=g.Moodle.core_course.util.section.getId(c),l=i,s=this.get_section_index(c),u=s;if(i!==s){for(o in ug.Moodle.core_course.util.section.getId(r.item(i))&&(n=r.item(i-1).get("id"),r.item(i-1).set("id",r.item(i).get("id")),r.item(i).set("id",n),M.mod_quiz.edit.swap_sections(g,i-1,i),s=!0)}while(u-=1,s);window.setTimeout(function(){a.hide()},250)},failure:function(e,o){this.ajax_failure(o),a.hide()}},context:this})}}},{NAME:"mod_quiz-dragdrop-section",ATTRS:{courseid:{value:null},quizid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.init_section_dragdrop=function(e){new i(e)},g.extend(o=function(){o.superclass.constructor.apply(this,arguments)},M.core.dragdrop,{initializer:function(){var e;this.groups=["resource"],this.samenodeclass=t,this.parentnodeclass=f,this.samenodelabel={identifier:"dragtoafter",component:"quiz"},this.parentnodelabel={identifier:"dragtostart",component:"quiz"},this.setup_for_section(),e="li."+t,(e=new g.DD.Delegate({container:"."+p,nodes:e,target:!0,handles:["."+r],dragConfig:{groups:this.groups}})).dd.plug(g.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),e.dd.plug(g.Plugin.DDConstrained,{constrain:"#"+v}),e.dd.plug(g.Plugin.DDWinScroll),M.mod_quiz.quizbase.register_module(this),M.mod_quiz.dragres=this},setup_for_section:function(){g.Node.all(".mod-quiz-edit-content ul.slots ul.section").each(function(e){e.setAttribute("data-draggroups",this.groups.join(" ")),new g.DD.Drop({node:e,groups:this.groups,padding:"20 0 20 0"}),this.setup_for_resource("li.activity")},this)},setup_for_resource:function(e){g.Node.all(e).each(function(e){var o,e=e.one("a."+r);e&&(o=this.get_drag_handle(M.util.get_string("move","moodle"),r,s,!0),e.replace(o))},this)},drag_start:function(e){e=e.target;e.get("dragNode").setContent(e.get("node").get("innerHTML")),e.get("dragNode").all(".icon").setStyle("vertical-align","baseline")},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(e){var o,t=e.drag,i=t.get("node"),e=i.one(u),s=M.util.add_spinner(g,e),n={},d=this.get("config").pageparams;for(o in d)n[o]=d[o];n.sesskey=M.cfg.sesskey,n.courseid=this.get("courseid"),n.quizid=this.get("quizid"),n["class"]="resource",n.field="move",n.id=Number(g.Moodle.mod_quiz.util.slot.getId(i)),n.sectionId=g.Moodle.core_course.util.section.getId(i.ancestor("li.section",!0)),(e=i.previous(q))&&(n.previousid=Number(g.Moodle.mod_quiz.util.slot.getId(e))),(e=i.previous(z))&&(n.page=Number(g.Moodle.mod_quiz.util.page.getId(e))),e=M.cfg.wwwroot+this.get("ajaxurl"),g.io(e,{method:"POST",data:n,on:{start:function(){this.lock_drag_handle(t,r),s.show()},success:function(e,o){o=g.JSON.parse(o.responseText),o={element:i,visible:o.visible};M.mod_quiz.quizbase.invoke_function("set_visibility_resource_ui",o),this.unlock_drag_handle(t,r),window.setTimeout(function(){s.hide()},250),M.mod_quiz.resource_toolbox.reorganise_edit_page()},failure:function(e,o){this.ajax_failure(o),this.unlock_drag_handle(t,a),s.hide(),window.location.reload(!0)}},context:this})},global_drop_over:function(e){var o,t,i;e.drop&&e.drop.inGroup(this.groups)&&(o=e.drag.get("node"),t=e.drop.get("node"),this.lastdroptarget=e.drop,t.hasClass(this.samenodeclass)?(i=this.goingup?"before":"after",t.insert(o,i)):!t.hasClass(this.parentnodeclass)&&!t.test('[data-droptarget="1"]')||t.contains(o)||(this.goingup?t.append(o):t.prepend(o)),this.drop_over(e))}},{NAME:"mod_quiz-dragdrop-resource",ATTRS:{courseid:{value:null},quizid:{value:null},ajaxurl:{value:0},config:{value:0}}}), -M.mod_quiz=M.mod_quiz||{},M.mod_quiz.init_resource_dragdrop=function(e){new o(e)}},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification","moodle-mod_quiz-quizbase","moodle-mod_quiz-util-base","moodle-mod_quiz-util-page","moodle-mod_quiz-util-slot","moodle-course-util"]}); \ No newline at end of file +YUI.add("moodle-mod_quiz-dragdrop",function(g,e){var o,u=".actions",t="activity",p="mod-quiz-edit-content",r="editing_move",s="iconsmall",c="jumpmenu",n="left",h="movedown",_="moveup",m="page-content",d="right",f="slots",a="section-handle",v="slots",l="sectiondraggable",z="li.page",q="li.slot",i=function(){i.superclass.constructor.apply(this,arguments)};g.extend(i,M.core.dragdrop,{sectionlistselector:null,initializer:function(){if(this.groups=[l],this.samenodeclass="section",this.parentnodeclass="slots",g.Node.one("."+c))return!1;var e;this.sectionlistselector="li.section",this.sectionlistselector&&(this.sectionlistselector="."+p+" "+this.sectionlistselector,this.setup_for_section(this.sectionlistselector),(e=new g.DD.Delegate({container:"."+p,nodes:"."+l,target:!0,handles:["."+n],dragConfig:{groups:this.groups}})).dd.plug(g.Plugin.DDProxy,{moveOnEnd:!1}),e.dd.plug(g.Plugin.DDConstrained,{constrain:"#"+m,stickY:!0}),e.dd.plug(g.Plugin.DDWinScroll))},setup_for_section:function(e){g.Node.all(e).each(function(e){var o,t,i,s=g.Moodle.core_course.util.section.getId(e);0'),t=g.Node.create('
    ');t.setStyle("margin",0),t.setContent(e.get("node").get("innerHTML")),o.appendChild(t),e.get("dragNode").setContent(o),e.get("dragNode").addClass(p)},drag_dropmiss:function(e){this.drop_hit(e)},get_section_index:function(e){var o="."+p+" li.section",o=g.all(o);return o.indexOf(e)-o.indexOf(g.one("#section-0"))},drop_hit:function(d){var r,a,e,n,o,t=d.drag,c=t.get("node"),i=g.Moodle.core_course.util.section.getId(c),l=i,s=this.get_section_index(c),u=s;if(i!==s){for(o in ug.Moodle.core_course.util.section.getId(r.item(i))&&(n=r.item(i-1).get("id"),r.item(i-1).set("id",r.item(i).get("id")),r.item(i).set("id",n),M.mod_quiz.edit.swap_sections(g,i-1,i),s=!0)}while(u-=1,s);window.setTimeout(function(){a.hide()},250)},failure:function(e,o){this.ajax_failure(o),a.hide()}},context:this})}}},{NAME:"mod_quiz-dragdrop-section",ATTRS:{courseid:{value:null},quizid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.init_section_dragdrop=function(e){new i(e)},g.extend(o=function(){o.superclass.constructor.apply(this,arguments)},M.core.dragdrop,{initializer:function(){var e;this.groups=["resource"],this.samenodeclass=t,this.parentnodeclass=f,this.samenodelabel={identifier:"dragtoafter",component:"quiz"},this.parentnodelabel={identifier:"dragtostart",component:"quiz"},this.setup_for_section(),e="li."+t,(e=new g.DD.Delegate({container:"."+p,nodes:e,target:!0,handles:["."+r],dragConfig:{groups:this.groups}})).dd.plug(g.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),e.dd.plug(g.Plugin.DDConstrained,{constrain:"#"+v}),e.dd.plug(g.Plugin.DDWinScroll),M.mod_quiz.quizbase.register_module(this),M.mod_quiz.dragres=this},setup_for_section:function(){g.Node.all(".mod-quiz-edit-content ul.slots ul.section").each(function(e){e.setAttribute("data-draggroups",this.groups.join(" ")),new g.DD.Drop({node:e,groups:this.groups,padding:"20 0 20 0"}),this.setup_for_resource("li.activity")},this)},setup_for_resource:function(e){g.Node.all(e).each(function(e){var o,e=e.one("a."+r);e&&(o="btn px-1 icon-no-margin "+r,o=this.get_drag_handle(M.util.get_string("move","moodle"),o,s),e.replace(o))},this)},drag_start:function(e){e=e.target;e.get("dragNode").setContent(e.get("node").get("innerHTML")),e.get("dragNode").all(".icon").setStyle("vertical-align","baseline")},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(e){var o,t=e.drag,i=t.get("node"),e=i.one(u),s=M.util.add_spinner(g,e),n={},d=this.get("config").pageparams;for(o in d)n[o]=d[o];n.sesskey=M.cfg.sesskey,n.courseid=this.get("courseid"),n.quizid=this.get("quizid"),n["class"]="resource",n.field="move",n.id=Number(g.Moodle.mod_quiz.util.slot.getId(i)),n.sectionId=g.Moodle.core_course.util.section.getId(i.ancestor("li.section",!0)),(e=i.previous(q))&&(n.previousid=Number(g.Moodle.mod_quiz.util.slot.getId(e))),(e=i.previous(z))&&(n.page=Number(g.Moodle.mod_quiz.util.page.getId(e))),e=M.cfg.wwwroot+this.get("ajaxurl"),g.io(e,{method:"POST",data:n,on:{start:function(){this.lock_drag_handle(t,r),s.show()},success:function(e,o){o=g.JSON.parse(o.responseText),o={element:i,visible:o.visible};M.mod_quiz.quizbase.invoke_function("set_visibility_resource_ui",o),this.unlock_drag_handle(t,r),window.setTimeout(function(){s.hide()},250),M.mod_quiz.resource_toolbox.reorganise_edit_page()},failure:function(e,o){this.ajax_failure(o),this.unlock_drag_handle(t,a),s.hide(),window.location.reload(!0)}},context:this})},global_drop_over:function(e){var o,t,i;e.drop&&e.drop.inGroup(this.groups)&&(o=e.drag.get("node"),t=e.drop.get("node"),this.lastdroptarget=e.drop,t.hasClass(this.samenodeclass)?(i=this.goingup?"before":"after",t.insert(o,i)):!t.hasClass(this.parentnodeclass)&&!t.test('[data-droptarget="1"]')||t.contains(o)||(this.goingup?t.append(o):t.prepend(o)),this.drop_over(e))}},{NAME:"mod_quiz-dragdrop-resource",ATTRS:{courseid:{value:null},quizid:{value:null},ajaxurl:{ +value:0},config:{value:0}}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.init_resource_dragdrop=function(e){new o(e)}},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification","moodle-mod_quiz-quizbase","moodle-mod_quiz-util-base","moodle-mod_quiz-util-page","moodle-mod_quiz-util-slot","moodle-course-util"]}); \ No newline at end of file diff --git a/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js b/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js index d9f7a67875b..31cb2d0d747 100644 --- a/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js +++ b/public/mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js @@ -378,8 +378,8 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { // Replace move icons var move = resourcesnode.one('a.' + CSS.EDITINGMOVE); if (move) { - var resourcedraghandle = this.get_drag_handle(M.util.get_string('move', 'moodle'), - CSS.EDITINGMOVE, CSS.ICONCLASS, true); + var dragHandleClass = 'btn px-1 icon-no-margin ' + CSS.EDITINGMOVE; + var resourcedraghandle = this.get_drag_handle(M.util.get_string('move', 'moodle'), dragHandleClass, CSS.ICONCLASS); move.replace(resourcedraghandle); } }, this); diff --git a/public/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-debug.js b/public/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-debug.js index 5653cef9c9e..0eecf257c1f 100644 --- a/public/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-debug.js +++ b/public/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-debug.js @@ -345,11 +345,10 @@ Y.Moodle.mod_quiz.util.slot = { // Update the link and image titles pagebreaklink.set('title', M.util.get_string(action, 'quiz')); + pagebreaklink.set('aria-label', M.util.get_string(action, 'quiz')); pagebreaklink.setData('action', action); // Update the image title. var icon = pagebreaklink.one(this.SELECTORS.ICON); - icon.set('title', M.util.get_string(action, 'quiz')); - icon.set('alt', M.util.get_string(action, 'quiz')); // Update the image src. icon.set('src', M.util.image_url(iconname)); @@ -417,27 +416,27 @@ Y.Moodle.mod_quiz.util.slot = { requiresprevious = link.getData('action') === 'removedependency'; } + var iconname = ''; if (requiresprevious) { link.set('title', M.util.get_string('questiondependencyremove', 'quiz', a)); + link.set('aria-label', M.util.get_string('questiondependencyremove', 'quiz', a)); link.setData('action', 'removedependency'); - window.require(['core/templates'], function(Templates) { - Templates.renderPix('t/locked', 'core', M.util.get_string('questiondependsonprevious', 'quiz')).then( - function(html) { - icon.replace(html); - } - ); - }); + iconname = 't/locked'; } else { link.set('title', M.util.get_string('questiondependencyadd', 'quiz', a)); + link.set('aria-label', M.util.get_string('questiondependencyadd', 'quiz', a)); link.setData('action', 'adddependency'); - window.require(['core/templates'], function(Templates) { - Templates.renderPix('t/unlocked', 'core', M.util.get_string('questiondependencyfree', 'quiz')).then( + iconname = 't/unlocked'; + } + window.require(['core/templates', 'core/notification'], function(Templates, Notification) { + Templates.renderPix(iconname, 'core', '') + .then( function(html) { icon.replace(html); + return; } - ); - }); - } + ).catch(Notification.exception); + }); } }; diff --git a/public/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-min.js b/public/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-min.js index b062aafe066..9630a0909ab 100644 --- a/public/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-min.js +++ b/public/mod/quiz/yui/build/moodle-mod_quiz-util-slot/moodle-mod_quiz-util-slot-min.js @@ -1 +1 @@ -YUI.add("moodle-mod_quiz-util-slot",function(u,e){u.namespace("Moodle.mod_quiz.util.slot"),u.Moodle.mod_quiz.util.slot={CSS:{SLOT:"slot",QUESTIONTYPEDESCRIPTION:"qtype_description",CANNOT_DEPEND:"question_dependency_cannot_depend"},CONSTANTS:{SLOTIDPREFIX:"slot-",QUESTION:M.util.get_string("question","moodle")},SELECTORS:{SLOT:"li.slot",INSTANCENAME:".instancename",NUMBER:"span.slotnumber",PAGECONTENT:"div#page-content",PAGEBREAK:"span.page_split_join_wrapper",ICON:".icon",QUESTIONTYPEDESCRIPTION:".qtype_description",SECTIONUL:"ul.section",DEPENDENCY_WRAPPER:".question_dependency_wrapper",DEPENDENCY_LINK:".question_dependency_wrapper .cm-edit-action",DEPENDENCY_ICON:".question_dependency_wrapper .icon"},getSlotFromComponent:function(e){return u.one(e).ancestor(this.SELECTORS.SLOT,!0)},getId:function(e){e=e.get("id").replace(this.CONSTANTS.SLOTIDPREFIX,"");return!("number"!=typeof(e=parseInt(e,10))||!isFinite(e))&&e},getName:function(e){e=e.one(this.SELECTORS.INSTANCENAME);return e?e.get("firstChild").get("data"):null},getNumber:function(e){if(!e)return!1;e=e.one(this.SELECTORS.NUMBER).get("text").replace(this.CONSTANTS.QUESTION,"");return!("number"!=typeof(e=parseInt(e,10))||!isFinite(e))&&e},setNumber:function(e,t){e.one(this.SELECTORS.NUMBER).setHTML(''+this.CONSTANTS.QUESTION+" "+t)},getSlots:function(){return u.all(this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL+" "+this.SELECTORS.SLOT)},getNumberedSlots:function(){var e=this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL;return e+=" "+this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")",u.all(e)},getPrevious:function(e){return e.previous(this.SELECTORS.SLOT)},getPreviousNumbered:function(e){var t,i,n=e.previous(this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")");if(n)return n;for(t=e.ancestor("li.section").previous("li.section");t;){if(0<(i=t.all(this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")")).size())return i.item(i.size()-1);t=t.previous("li.section")}return!1},reorderSlots:function(){this.getSlots().each(function(e){var t,i;u.Moodle.mod_quiz.util.page.getPageFromSlot(e)||(t=e.next(u.Moodle.mod_quiz.util.page.SELECTORS.PAGE),e.swap(t)),t=this.getPreviousNumbered(e),i=0,e.hasClass(this.CSS.QUESTIONTYPEDESCRIPTION)||(t&&(i=this.getNumber(t)),this.setNumber(e,i+1))},this)},updateOneSlotSections:function(){u.all(".mod-quiz-edit-content ul.slots li.section").each(function(e){1'+this.CONSTANTS.QUESTION+" "+t)},getSlots:function(){return u.all(this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL+" "+this.SELECTORS.SLOT)},getNumberedSlots:function(){var e=this.SELECTORS.PAGECONTENT+" "+this.SELECTORS.SECTIONUL;return e+=" "+this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")",u.all(e)},getPrevious:function(e){return e.previous(this.SELECTORS.SLOT)},getPreviousNumbered:function(e){var t,i,n=e.previous(this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")");if(n)return n;for(t=e.ancestor("li.section").previous("li.section");t;){if(0<(i=t.all(this.SELECTORS.SLOT+":not("+this.SELECTORS.QUESTIONTYPEDESCRIPTION+")")).size())return i.item(i.size()-1);t=t.previous("li.section")}return!1},reorderSlots:function(){this.getSlots().each(function(e){var t,i;u.Moodle.mod_quiz.util.page.getPageFromSlot(e)||(t=e.next(u.Moodle.mod_quiz.util.page.SELECTORS.PAGE),e.swap(t)),t=this.getPreviousNumbered(e),i=0,e.hasClass(this.CSS.QUESTIONTYPEDESCRIPTION)||(t&&(i=this.getNumber(t)),this.setNumber(e,i+1))},this)},updateOneSlotSections:function(){u.all(".mod-quiz-edit-content ul.slots li.section").each(function(e){1