MDL-75423 gradereport_singleview: Replace grade analysis icon with menu

This commit is contained in:
Shamim Rezaie 2022-10-20 14:20:01 +11:00 committed by Mihail Geshoski
parent 2890172ee5
commit 36f6390692
6 changed files with 65 additions and 11 deletions

View File

@ -1716,6 +1716,35 @@ class grade_structure {
['title' => $title, 'aria-label' => $title]);
}
/**
* Returns an action menu for the grade.
*
* @param grade_grade $grade A grade_grade object
* @return string
*/
public function get_grade_action_menu(grade_grade $grade) {
global $OUTPUT;
$menuitems = [];
$url = $this->get_grade_analysis_url($grade);
if ($url) {
$title = get_string('gradeanalysis', 'core_grades');
$menuitems[] = new action_menu_link_secondary($url, null, $title);
}
if ($menuitems) {
$menu = new action_menu($menuitems);
$icon = $OUTPUT->pix_icon('i/dropdown', get_string('actions'));
$menu->set_menu_trigger($icon, 'btn btn-icon icon-size-2 bg-secondary d-flex align-items-center justify-content-center');
$menu->set_menu_left();
return $OUTPUT->render($menu);
} else {
return '';
}
}
/**
* Returns the grade eid - the grade may not exist yet.
*

View File

@ -145,7 +145,7 @@ abstract class tablelike extends screen {
$html = new $classname($grade, $tab);
if ($field == 'finalgrade' and !empty($this->structure)) {
$html .= $this->structure->get_grade_analysis_icon($grade);
$html .= $this->structure->get_grade_action_menu($grade);
}
// Singleview users without proper permissions should be presented

View File

@ -35,10 +35,6 @@
text-align: center;
}
.path-grade-report-singleview input[name^="finalgrade"] {
width: 50px;
}
.path-grade-report-singleview .reporttable tbody th,
.path-grade-report-singleview .reporttable tbody td.range {
white-space: nowrap;

View File

@ -515,8 +515,19 @@
/**
* Single view.
*/
.path-grade-report-singleview input[name^="finalgrade"] {
width: 80px;
.path-grade-report-singleview .reporttable {
input[name^="finalgrade"] {
width: 80px;
display: inline-block;
}
.action-menu {
display: inline-block;
margin-left: 0.5rem;
float: right;
}
.dropdown-toggle::after {
display: none;
}
}
.searchresultitemscontainer {

View File

@ -19702,8 +19702,17 @@ p.arrow_button {
/**
* Single view.
*/
.path-grade-report-singleview input[name^="finalgrade"] {
width: 80px; }
.path-grade-report-singleview .reporttable input[name^="finalgrade"] {
width: 80px;
display: inline-block; }
.path-grade-report-singleview .reporttable .action-menu {
display: inline-block;
margin-left: 0.5rem;
float: right; }
.path-grade-report-singleview .reporttable .dropdown-toggle::after {
display: none; }
.searchresultitemscontainer {
max-height: 150px;

View File

@ -19702,8 +19702,17 @@ p.arrow_button {
/**
* Single view.
*/
.path-grade-report-singleview input[name^="finalgrade"] {
width: 80px; }
.path-grade-report-singleview .reporttable input[name^="finalgrade"] {
width: 80px;
display: inline-block; }
.path-grade-report-singleview .reporttable .action-menu {
display: inline-block;
margin-left: 0.5rem;
float: right; }
.path-grade-report-singleview .reporttable .dropdown-toggle::after {
display: none; }
.searchresultitemscontainer {
max-height: 150px;