MDL-77375 core: Cleanup redundant set_constraint() calls

Also removed the 10rem bottom margin form the quiz editing page. It was
there to make sure that there is enough room for the 'add new question'
dropdown. But it's not needed anymore (hasn't been since long time ago).
This commit is contained in:
Shamim Rezaie 2023-05-22 07:00:17 +10:00
parent 848efb3f13
commit 316d79d038
8 changed files with 0 additions and 29 deletions

View file

@ -137,9 +137,6 @@ class controlmenu implements named_templatable, renderable {
$ownerselector = $displayoptions['ownerselector'] ?? '#module-' . $mod->id; $ownerselector = $displayoptions['ownerselector'] ?? '#module-' . $mod->id;
$menu->set_owner_selector($ownerselector); $menu->set_owner_selector($ownerselector);
$constraint = $displayoptions['constraintselector'] ?? '.course-content';
$menu->set_constraint($constraint);
foreach ($controls as $control) { foreach ($controls as $control) {
if ($control instanceof action_menu_link) { if ($control instanceof action_menu_link) {
$control->add_class('cm-edit-action'); $control->add_class('cm-edit-action');

View file

@ -210,8 +210,6 @@ class core_course_renderer extends plugin_renderer_base {
* ownerselector => A JS/CSS selector that can be used to find an cm node. * ownerselector => A JS/CSS selector that can be used to find an cm node.
* If specified the owning node will be given the class 'action-menu-shown' when the action * If specified the owning node will be given the class 'action-menu-shown' when the action
* menu is being displayed. * menu is being displayed.
* constraintselector => A JS/CSS selector that can be used to find the parent node for which to constrain
* the action menu to when it is being displayed.
* donotenhance => If set to true the action menu that gets displayed won't be enhanced by JS. * donotenhance => If set to true the action menu that gets displayed won't be enhanced by JS.
* @return string * @return string
*/ */
@ -236,15 +234,8 @@ class core_course_renderer extends plugin_renderer_base {
$ownerselector = 'li.activity'; $ownerselector = 'li.activity';
} }
if (isset($displayoptions['constraintselector'])) {
$constraint = $displayoptions['constraintselector'];
} else {
$constraint = '.course-content';
}
$menu = new action_menu(); $menu = new action_menu();
$menu->set_owner_selector($ownerselector); $menu->set_owner_selector($ownerselector);
$menu->set_constraint($constraint);
$menu->set_menu_trigger(get_string('edit')); $menu->set_menu_trigger(get_string('edit'));
foreach ($actions as $action) { foreach ($actions as $action) {

View file

@ -1740,7 +1740,6 @@ class core_renderer extends renderer_base {
* @return string HTML fragment. * @return string HTML fragment.
*/ */
public function block_controls($actions, $blockid = null) { public function block_controls($actions, $blockid = null) {
global $CFG;
if (empty($actions)) { if (empty($actions)) {
return ''; return '';
} }
@ -1748,7 +1747,6 @@ class core_renderer extends renderer_base {
if ($blockid !== null) { if ($blockid !== null) {
$menu->set_owner_selector('#'.$blockid); $menu->set_owner_selector('#'.$blockid);
} }
$menu->set_constraint('.block-region');
$menu->attributes['class'] .= ' block-control-actions commands'; $menu->attributes['class'] .= ' block-control-actions commands';
return $this->render($menu); return $this->render($menu);
} }

View file

@ -449,7 +449,6 @@ class mod_feedback_complete_form extends moodleform {
global $OUTPUT; global $OUTPUT;
$menu = new action_menu(); $menu = new action_menu();
$menu->set_owner_selector('#' . $this->guess_element_id($item, $element)); $menu->set_owner_selector('#' . $this->guess_element_id($item, $element));
$menu->set_constraint('.feedback_form');
$menu->set_menu_trigger(get_string('edit')); $menu->set_menu_trigger(get_string('edit'));
$menu->prioritise = true; $menu->prioritise = true;

View file

@ -608,7 +608,6 @@ class edit_renderer extends \plugin_renderer_base {
return ''; return '';
} }
$menu = new \action_menu(); $menu = new \action_menu();
$menu->set_constraint('.mod-quiz-edit-content');
$trigger = html_writer::tag('span', get_string('add', 'quiz'), ['class' => 'add-menu']); $trigger = html_writer::tag('span', get_string('add', 'quiz'), ['class' => 'add-menu']);
$menu->set_menu_trigger($trigger); $menu->set_menu_trigger($trigger);
// The menu appears within an absolutely positioned element causing width problems. // The menu appears within an absolutely positioned element causing width problems.

View file

@ -1203,11 +1203,6 @@ img.userpicture {
} }
// Quiz module // Quiz module
.path-mod-quiz .mod-quiz-edit-content {
// Force the quiz edit page to always be large enough to prevent scrolling when accessing the menu.
margin-bottom: 10rem;
}
#page-mod-quiz-mod #id_reviewoptionshdr .col-md-3, #page-mod-quiz-mod #id_reviewoptionshdr .col-md-3,
#page-mod-quiz-mod #id_reviewoptionshdr .col-md-9 { #page-mod-quiz-mod #id_reviewoptionshdr .col-md-9 {
width: auto; width: auto;

View file

@ -33771,10 +33771,6 @@ img.userpicture {
display: none; display: none;
} }
} }
.path-mod-quiz .mod-quiz-edit-content {
margin-bottom: 10rem;
}
#page-mod-quiz-mod #id_reviewoptionshdr .col-md-3, #page-mod-quiz-mod #id_reviewoptionshdr .col-md-3,
#page-mod-quiz-mod #id_reviewoptionshdr .col-md-9 { #page-mod-quiz-mod #id_reviewoptionshdr .col-md-9 {
width: auto; width: auto;

View file

@ -33771,10 +33771,6 @@ img.userpicture {
display: none; display: none;
} }
} }
.path-mod-quiz .mod-quiz-edit-content {
margin-bottom: 10rem;
}
#page-mod-quiz-mod #id_reviewoptionshdr .col-md-3, #page-mod-quiz-mod #id_reviewoptionshdr .col-md-3,
#page-mod-quiz-mod #id_reviewoptionshdr .col-md-9 { #page-mod-quiz-mod #id_reviewoptionshdr .col-md-9 {
width: auto; width: auto;