diff --git a/mod/choice/amd/build/select_all_choices.min.js b/mod/choice/amd/build/select_all_choices.min.js index 6bd9ba8297b..bdbfb171928 100644 --- a/mod/choice/amd/build/select_all_choices.min.js +++ b/mod/choice/amd/build/select_all_choices.min.js @@ -1 +1 @@ -define(["jquery","core/str"],function(a,b){return{init:function(){a(".selectallnone a").on("click",function(c){c.preventDefault();var d=!1,e=a(this).text();b.get_string("selectall","core").done(function(b){e===b&&(d=!0),a("#attemptsform").find("input:checkbox").prop("checked",d)})})}}}); \ No newline at end of file +define(["jquery"],function(a){return{init:function(){a(".selectallnone a").on("click",function(b){b.preventDefault(),a("#attemptsform").find("input:checkbox").prop("checked",a(this).data("selectInfo"))})}}}); \ No newline at end of file diff --git a/mod/choice/amd/src/select_all_choices.js b/mod/choice/amd/src/select_all_choices.js index 4cc2b582f8a..5a4a4fb8c05 100644 --- a/mod/choice/amd/src/select_all_choices.js +++ b/mod/choice/amd/src/select_all_choices.js @@ -21,21 +21,12 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define(['jquery', 'core/str'], function($, str) { +define(['jquery'], function($) { return { init: function () { $('.selectallnone a').on('click', function(e) { e.preventDefault(); - - var flag = false; - var selectedtext = $(this).text(); - - str.get_string('selectall', 'core').done(function(string) { - if (selectedtext === string) { - flag = true; - } - $('#attemptsform').find('input:checkbox').prop('checked', flag); - }); + $('#attemptsform').find('input:checkbox').prop('checked', $(this).data('selectInfo')); }); } }; diff --git a/mod/choice/renderer.php b/mod/choice/renderer.php index 505ef875389..f33d48a0c37 100644 --- a/mod/choice/renderer.php +++ b/mod/choice/renderer.php @@ -267,9 +267,9 @@ class mod_choice_renderer extends plugin_renderer_base { $selecturl = new moodle_url('#'); $actiondata .= html_writer::start_div('selectallnone'); - $actiondata .= html_writer::link($selecturl, get_string('selectall')) . ' / '; + $actiondata .= html_writer::link($selecturl, get_string('selectall'), ['data-select-info' => true]) . ' / '; - $actiondata .= html_writer::link($selecturl, get_string('deselectall')); + $actiondata .= html_writer::link($selecturl, get_string('deselectall'), ['data-select-info' => false]); $actiondata .= html_writer::end_div();