mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-75423 gradereport_singleview: Remove override and exlude links
The override and exlude links are removed form the table header because a new bulk actions menu will be used (see MDL-75455). Co-authored-by: Shamim Rezaie <shamim@moodle.com>
This commit is contained in:
parent
e21c415fa9
commit
d73ba4386a
@ -177,8 +177,8 @@ class grade extends tablelike implements selectable_items, filterable_items {
|
||||
get_string('grade', 'grades'),
|
||||
get_string('range', 'grades'),
|
||||
get_string('feedback', 'grades'),
|
||||
$this->make_toggle_links('override'),
|
||||
$this->make_toggle_links('exclude')
|
||||
get_string('override', 'gradereport_singleview'),
|
||||
get_string('exclude', 'gradereport_singleview'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -186,52 +186,6 @@ abstract class screen {
|
||||
return $grade;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the HTML element that toggles all the checkboxes on or off.
|
||||
*
|
||||
* @param string $key A unique key for this control - inserted in the classes.
|
||||
* @return string
|
||||
*/
|
||||
public function make_toggle(string $key): string {
|
||||
$attrs = ['href' => '#'];
|
||||
|
||||
// Do proper lang strings for title attributes exist for the given key?
|
||||
$strmanager = \get_string_manager();
|
||||
$titleall = get_string('all');
|
||||
$titlenone = get_string('none');
|
||||
if ($strmanager->string_exists(strtolower($key) . 'all', 'gradereport_singleview')) {
|
||||
$titleall = get_string(strtolower($key) . 'all', 'gradereport_singleview');
|
||||
}
|
||||
if ($strmanager->string_exists(strtolower($key) . 'none', 'gradereport_singleview')) {
|
||||
$titlenone = get_string(strtolower($key) . 'none', 'gradereport_singleview');
|
||||
}
|
||||
|
||||
$all = html_writer::tag('a', get_string('all'), $attrs + [
|
||||
'class' => 'include all ' . $key,
|
||||
'title' => $titleall
|
||||
]);
|
||||
|
||||
$none = html_writer::tag('a', get_string('none'), $attrs + [
|
||||
'class' => 'include none ' . $key,
|
||||
'title' => $titlenone
|
||||
]);
|
||||
|
||||
return html_writer::tag('span', "$all / $none", [
|
||||
'class' => 'inclusion_links'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a toggle link with some text before it.
|
||||
*
|
||||
* @param string $key A unique key for this control - inserted in the classes.
|
||||
* @return string
|
||||
*/
|
||||
public function make_toggle_links(string $key): string {
|
||||
return get_string($key, 'gradereport_singleview') . ' ' .
|
||||
$this->make_toggle($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default heading for the screen.
|
||||
*
|
||||
|
@ -141,8 +141,8 @@ class user extends tablelike implements selectable_items {
|
||||
get_string('grade', 'grades'),
|
||||
get_string('range', 'grades'),
|
||||
get_string('feedback', 'grades'),
|
||||
$this->make_toggle_links('override'),
|
||||
$this->make_toggle_links('exclude')
|
||||
get_string('override', 'gradereport_singleview'),
|
||||
get_string('exclude', 'gradereport_singleview'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -96,41 +96,7 @@ M.gradereport_singleview.init = function(Y) {
|
||||
return;
|
||||
}, 'down:37,38,39,40+ctrl', 'table input, table select, table a');
|
||||
|
||||
// Make toggle links
|
||||
Y.all('.include').each(function(link) {
|
||||
var type = link.getAttribute('class').split(" ")[2];
|
||||
|
||||
var toggle = function(checked) {
|
||||
return function(input) {
|
||||
input.getDOMNode().checked = checked;
|
||||
Y.Event.simulate(input.getDOMNode(), 'change');
|
||||
};
|
||||
};
|
||||
|
||||
link.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var selectall = link.hasClass('all');
|
||||
var self = this;
|
||||
if ((type === 'override') && !selectall) {
|
||||
Y.use('moodle-core-notification-confirm', function() {
|
||||
var confirm = new M.core.confirm({
|
||||
title: M.util.get_string('confirm', 'moodle'),
|
||||
question: M.util.get_string('overridenoneconfirm', 'gradereport_singleview'),
|
||||
});
|
||||
confirm.on('complete-yes', function() {
|
||||
confirm.hide();
|
||||
confirm.destroy();
|
||||
Y.all('input[name^=' + type + ']').each(toggle(link.hasClass('all')));
|
||||
}, self);
|
||||
confirm.show();
|
||||
});
|
||||
} else {
|
||||
Y.all('input[name^=' + type + ']').each(toggle(link.hasClass('all')));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Override Toggle
|
||||
// Override Toggle.
|
||||
Y.all('input[name^=override_]').each(function(input) {
|
||||
input.on('change', function() {
|
||||
var checked = input.getDOMNode().checked;
|
||||
|
Loading…
x
Reference in New Issue
Block a user