Skip to content

Commit

Permalink
Revert " Behat optimisations, addresses #765 (404 backport)"
Browse files Browse the repository at this point in the history
  • Loading branch information
abias authored Dec 7, 2024
1 parent 8098cb4 commit 1b0606e
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 1,549 deletions.
1 change: 0 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Changes

### Unreleased

* 2024-12-06 - Tests: Add several Behat optimisations to bring down the test suite run time, resolves #765.
* 2024-12-06 - Upstream change: Adopt changes from MDL-83759 ('System notification navbar popover is misplaced in Moodle 4.4 and 4.5')
* 2024-12-06 - Upstream change: Adopt changes from MDL-75610 ('Quiz activity name no longer being displayed in quiz landing page when using Safe Exam Browser'), resolves #766.
* 2024-11-19 - Bugfix: Port the activity icon sizes in the nav drawer back to stable versions, resolves #755.
Expand Down
53 changes: 45 additions & 8 deletions classes/form/smartmenu_edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ public function definition() {
$mform->addRule('location', get_string('required'), 'required');

// Add mode as select element.
$modeoptions = smartmenu::get_mode_options();
$modeoptions = [
smartmenu::MODE_SUBMENU => get_string('smartmenusmodesubmenu', 'theme_boost_union'),
smartmenu::MODE_INLINE => get_string('smartmenusmodeinline', 'theme_boost_union'),
];
$mform->addElement('select', 'mode', get_string('smartmenusmenumode', 'theme_boost_union'), $modeoptions);
$mform->setDefault('mode', smartmenu::MODE_SUBMENU);
$mform->setType('mode', PARAM_INT);
Expand All @@ -99,15 +102,24 @@ public function definition() {
$mform->addHelpButton('type', 'smartmenusmenutype', 'theme_boost_union');

// Add show description as select element.
$showdescriptionoptions = smartmenu::get_showdescription_options();
$showdescriptionoptions = [
smartmenu::DESC_NEVER => get_string('smartmenusmenushowdescriptionnever', 'theme_boost_union'),
smartmenu::DESC_ABOVE => get_string('smartmenusmenushowdescriptionabove', 'theme_boost_union'),
smartmenu::DESC_BELOW => get_string('smartmenusmenushowdescriptionbelow', 'theme_boost_union'),
smartmenu::DESC_HELP => get_string('smartmenusmenushowdescriptionhelp', 'theme_boost_union'),
];
$mform->addElement('select', 'showdesc', get_string('smartmenusmenushowdescription', 'theme_boost_union'),
$showdescriptionoptions);
$mform->setDefault('showdesc', smartmenu::DESC_NEVER);
$mform->setType('showdesc', PARAM_INT);
$mform->addHelpButton('showdesc', 'smartmenusmenushowdescription', 'theme_boost_union');

// Add more menu behavior as select element.
$moremenuoptions = smartmenu::get_moremenu_options();
$moremenuoptions = [
smartmenu::MOREMENU_DONOTCHANGE => get_string('dontchange', 'theme_boost_union'),
smartmenu::MOREMENU_INTO => get_string('smartmenusmenumoremenubehaviorforceinto', 'theme_boost_union'),
smartmenu::MOREMENU_OUTSIDE => get_string('smartmenusmenumoremenubehaviorkeepoutside', 'theme_boost_union'),
];
$mform->addElement('select', 'moremenubehavior', get_string('smartmenusmenumoremenubehavior', 'theme_boost_union'),
$moremenuoptions);
$mform->setDefault('moremenubehavior', smartmenu::MOREMENU_DONOTCHANGE);
Expand All @@ -120,15 +132,29 @@ public function definition() {
$mform->setType('cssclass', PARAM_TEXT);

// Add card size as select element.
$cardsizeoptions = smartmenu::get_cardsize_options();
$cardsizeoptions = [
smartmenu::CARDSIZE_TINY => get_string('smartmenusmenucardsizetiny', 'theme_boost_union').' (50px)',
smartmenu::CARDSIZE_SMALL => get_string('smartmenusmenucardsizesmall', 'theme_boost_union').' (100px)',
smartmenu::CARDSIZE_MEDIUM => get_string('smartmenusmenucardsizemedium', 'theme_boost_union').' (150px)',
smartmenu::CARDSIZE_LARGE => get_string('smartmenusmenucardsizelarge', 'theme_boost_union').' (200px)',
];
$mform->addElement('select', 'cardsize', get_string('smartmenusmenucardsize', 'theme_boost_union'), $cardsizeoptions);
$mform->setDefault('cardsize', smartmenu::CARDSIZE_TINY);
$mform->setType('cardsize', PARAM_INT);
$mform->hideIf('cardsize', 'type', 'neq', smartmenu::TYPE_CARD);
$mform->addHelpButton('cardsize', 'smartmenusmenucardsize', 'theme_boost_union');

// Add card form as select element.
$cardformoptions = smartmenu::get_cardform_options();
$cardformoptions = [
smartmenu::CARDFORM_SQUARE =>
get_string('smartmenusmenucardformsquare', 'theme_boost_union').' (1/1)',
smartmenu::CARDFORM_PORTRAIT =>
get_string('smartmenusmenucardformportrait', 'theme_boost_union').' (2/3)',
smartmenu::CARDFORM_LANDSCAPE =>
get_string('smartmenusmenucardformlandscape', 'theme_boost_union').' (3/2)',
smartmenu::CARDFORM_FULLWIDTH =>
get_string('smartmenusmenucardformfullwidth', 'theme_boost_union'),
];
$mform->addElement('select', 'cardform',
get_string('smartmenusmenucardform', 'theme_boost_union'), $cardformoptions);
$mform->setDefault('cardform', smartmenu::CARDFORM_SQUARE);
Expand All @@ -137,7 +163,12 @@ public function definition() {
$mform->addHelpButton('cardform', 'smartmenusmenucardform', 'theme_boost_union');

// Add card overflow behaviour as select element.
$cardoverflowoptions = smartmenu::get_cardoverflowbehaviour_options();
$cardoverflowoptions = [
smartmenu::CARDOVERFLOWBEHAVIOUR_NOWRAP =>
get_string('smartmenusmenucardoverflowbehaviornowrap', 'theme_boost_union'),
smartmenu::CARDOVERFLOWBEHAVIOUR_WRAP =>
get_string('smartmenusmenucardoverflowbehaviorwrap', 'theme_boost_union'),
];
$mform->addElement('select', 'cardoverflowbehavior',
get_string('smartmenusmenucardoverflowbehavior', 'theme_boost_union'), $cardoverflowoptions);
$mform->setDefault('cardoverflowbehaviour', smartmenu::CARDOVERFLOWBEHAVIOUR_NOWRAP);
Expand Down Expand Up @@ -168,7 +199,10 @@ public function definition() {
$mform->addHelpButton('roles', 'smartmenusbyrole', 'theme_boost_union');

// Add context as select element.
$rolecontext = smartmenu::get_rolecontext_options();
$rolecontext = [
smartmenu::ANYCONTEXT => get_string('any'),
smartmenu::SYSTEMCONTEXT => get_string('coresystem'),
];
$mform->addElement('select', 'rolecontext', get_string('smartmenusrolecontext', 'theme_boost_union'), $rolecontext);
$mform->setDefault('rolecontext', smartmenu::ANYCONTEXT);
$mform->setType('rolecontext', PARAM_INT);
Expand Down Expand Up @@ -215,7 +249,10 @@ public function definition() {
$mform->addHelpButton('cohorts', 'smartmenusbycohort', 'theme_boost_union');

// Add operator as select element.
$operatoroptions = smartmenu::get_operator_options();
$operatoroptions = [
smartmenu::ANY => get_string('any'),
smartmenu::ALL => get_string('all'),
];
$mform->addElement('select', 'operator', get_string('smartmenusoperator', 'theme_boost_union'), $operatoroptions);
$mform->setDefault('operator', smartmenu::ANY);
$mform->setType('operator', PARAM_INT);
Expand Down
79 changes: 69 additions & 10 deletions classes/form/smartmenu_item_edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ public function definition() {
$mform->addHelpButton('url', 'smartmenusmenuitemurl', 'theme_boost_union');

// Add mode as select element.
$modeoptions = smartmenu_item::get_mode_options();
$modeoptions = [
smartmenu_item::MODE_INLINE => get_string('smartmenusmodeinline', 'theme_boost_union'),
smartmenu_item::MODE_SUBMENU => get_string('smartmenusmodesubmenu', 'theme_boost_union'),
];
$mform->addElement('select', 'mode', get_string('smartmenusmenuitemmode', 'theme_boost_union'), $modeoptions);
$mform->setDefault('mode', smartmenu_item::MODE_INLINE);
$mform->setType('mode', PARAM_INT);
Expand Down Expand Up @@ -135,7 +138,14 @@ public function definition() {
$mform->addHelpButton('enrolmentrole', 'smartmenusdynamiccoursesenrolmentrole', 'theme_boost_union');

// Add completion status (for the dynamic courses menu item type) as autocomplete element.
$completionstatusoptions = smartmenu_item::get_completionstatus_options();
$completionstatusoptions = [
smartmenu_item::COMPLETION_ENROLLED =>
get_string('smartmenusdynamiccoursescompletionstatusenrolled', 'theme_boost_union'),
smartmenu_item::COMPLETION_INPROGRESS =>
get_string('smartmenusdynamiccoursescompletionstatusinprogress', 'theme_boost_union'),
smartmenu_item::COMPLETION_COMPLETED =>
get_string('smartmenusdynamiccoursescompletionstatuscompleted', 'theme_boost_union'),
];
$completionstatuswidget = $mform->addElement('autocomplete', 'completionstatus',
get_string('smartmenusmenuitemtypedynamiccourses', 'theme_boost_union').': '.
get_string('smartmenusdynamiccoursescompletionstatus', 'theme_boost_union'), $completionstatusoptions);
Expand All @@ -145,7 +155,14 @@ public function definition() {
$mform->addHelpButton('completionstatus', 'smartmenusdynamiccoursescompletionstatus', 'theme_boost_union');

// Add date range (for the dynamic courses menu item type) as autocomplete element.
$daterangeoptions = smartmenu_item::get_daterange_options();
$daterangeoptions = [
smartmenu_item::RANGE_PAST =>
get_string('smartmenusdynamiccoursesdaterangepast', 'theme_boost_union'),
smartmenu_item::RANGE_PRESENT =>
get_string('smartmenusdynamiccoursesdaterangepresent', 'theme_boost_union'),
smartmenu_item::RANGE_FUTURE =>
get_string('smartmenusdynamiccoursesdaterangefuture', 'theme_boost_union'),
];
$daterangewidget = $mform->addElement('autocomplete', 'daterange',
get_string('smartmenusmenuitemtypedynamiccourses', 'theme_boost_union').': '.
get_string('smartmenusdynamiccoursesdaterange', 'theme_boost_union'), $daterangeoptions);
Expand Down Expand Up @@ -179,7 +196,13 @@ public function definition() {
$PAGE->requires->js_call_amd('theme_boost_union/fontawesome-popover', 'init', ['#id_menuicon', $systemcontextid]);

// Add title presentation and select element.
$displayoptions = smartmenu_item::get_display_options();
$displayoptions = [
smartmenu_item::DISPLAY_SHOWTITLEICON =>
get_string('smartmenusmenuitemdisplayoptionsshowtitleicon', 'theme_boost_union'),
smartmenu_item::DISPLAY_HIDETITLE => get_string('smartmenusmenuitemdisplayoptionshidetitle', 'theme_boost_union'),
smartmenu_item::DISPLAY_HIDETITLEMOBILE =>
get_string('smartmenusmenuitemdisplayoptionshidetitlemobile', 'theme_boost_union'),
];
$mform->addElement('select', 'display', get_string('smartmenusmenuitemdisplayoptions', 'theme_boost_union'),
$displayoptions);
$mform->setDefault('display', smartmenu_item::DISPLAY_SHOWTITLEICON);
Expand All @@ -192,7 +215,10 @@ public function definition() {
$mform->addHelpButton('tooltip', 'smartmenusmenuitemtooltip', 'theme_boost_union');

// Add link target as select element.
$targetoptions = smartmenu_item::get_target_options();
$targetoptions = [
smartmenu_item::TARGET_SAME => get_string('smartmenusmenuitemlinktargetsamewindow', 'theme_boost_union'),
smartmenu_item::TARGET_NEW => get_string('smartmenusmenuitemlinktargetnewtab', 'theme_boost_union'),
];
$mform->addElement('select', 'target', get_string('smartmenusmenuitemlinktarget', 'theme_boost_union'),
$targetoptions);
$mform->setDefault('target', smartmenu_item::TARGET_SAME);
Expand Down Expand Up @@ -230,7 +256,24 @@ public function definition() {
$mform->addHelpButton('cssclass', 'smartmenusmenuitemcssclass', 'theme_boost_union');

// Add course list ordering (for the dynamic courses menu item type) as select element.
$listsortoptions = smartmenu_item::get_listsort_options();
$listsortoptions = [
smartmenu_item::LISTSORT_FULLNAME_ASC =>
get_string('smartmenusmenuitemlistsortfullnameasc', 'theme_boost_union'),
smartmenu_item::LISTSORT_FULLNAME_DESC =>
get_string('smartmenusmenuitemlistsortfullnamedesc', 'theme_boost_union'),
smartmenu_item::LISTSORT_SHORTNAME_ASC =>
get_string('smartmenusmenuitemlistsortshortnameasc', 'theme_boost_union'),
smartmenu_item::LISTSORT_SHORTNAME_DESC =>
get_string('smartmenusmenuitemlistsortshortnamedesc', 'theme_boost_union'),
smartmenu_item::LISTSORT_COURSEID_ASC =>
get_string('smartmenusmenuitemlistsortcourseidasc', 'theme_boost_union'),
smartmenu_item::LISTSORT_COURSEID_DESC =>
get_string('smartmenusmenuitemlistsortcourseiddesc', 'theme_boost_union'),
smartmenu_item::LISTSORT_COURSEIDNUMBER_ASC =>
get_string('smartmenusmenuitemlistsortcourseidnumberasc', 'theme_boost_union'),
smartmenu_item::LISTSORT_COURSEIDNUMBER_DESC =>
get_string('smartmenusmenuitemlistsortcourseidnumberdesc', 'theme_boost_union'),
];
$mform->addElement('select', 'listsort',
get_string('smartmenusmenuitemtypedynamiccourses', 'theme_boost_union').': '.
get_string('smartmenusmenuitemlistsort', 'theme_boost_union'), $listsortoptions);
Expand All @@ -240,7 +283,10 @@ public function definition() {
$mform->addHelpButton('listsort', 'smartmenusmenuitemlistsort', 'theme_boost_union');

// Add course name presentation (for the dynamic courses menu item type) as select element.
$displayfieldoptions = smartmenu_item::get_displayfield_options();
$displayfieldoptions = [
smartmenu_item::FIELD_FULLNAME => get_string('smartmenusmenuitemdisplayfieldcoursefullname', 'theme_boost_union'),
smartmenu_item::FIELD_SHORTNAME => get_string('smartmenusmenuitemdisplayfieldcourseshortname', 'theme_boost_union'),
];
$mform->addElement('select', 'displayfield',
get_string('smartmenusmenuitemtypedynamiccourses', 'theme_boost_union').': '.
get_string('smartmenusmenuitemdisplayfield', 'theme_boost_union'), $displayfieldoptions);
Expand Down Expand Up @@ -272,7 +318,14 @@ public function definition() {
$mform->addHelpButton('image', 'smartmenusmenuitemcardimage', 'theme_boost_union');

// Add card text position as select element.
$textpositionoptions = smartmenu_item::get_textposition_options();
$textpositionoptions = [
smartmenu_item::POSITION_BELOW =>
get_string('smartmenusmenuitemtextpositionbelowimage', 'theme_boost_union'),
smartmenu_item::POSITION_OVERLAYTOP =>
get_string('smartmenusmenuitemtextpositionoverlaytop', 'theme_boost_union'),
smartmenu_item::POSITION_OVERLAYBOTTOM =>
get_string('smartmenusmenuitemtextpositionoverlaybottom', 'theme_boost_union'),
];
$mform->addElement('select', 'textposition',
get_string('smartmenusmenuitemtextposition', 'theme_boost_union'), $textpositionoptions);
$mform->setDefault('textposition', smartmenu_item::POSITION_BELOW);
Expand Down Expand Up @@ -315,7 +368,10 @@ public function definition() {
$mform->addHelpButton('roles', 'smartmenusbyrole', 'theme_boost_union');

// Add context as select element.
$rolecontext = smartmenu::get_rolecontext_options();
$rolecontext = [
smartmenu::ANYCONTEXT => get_string('any'),
smartmenu::SYSTEMCONTEXT => get_string('coresystem'),
];
$mform->addElement('select', 'rolecontext', get_string('smartmenusrolecontext', 'theme_boost_union'), $rolecontext);
$mform->setDefault('rolecontext', smartmenu::ANYCONTEXT);
$mform->setType('rolecontext', PARAM_INT);
Expand Down Expand Up @@ -362,7 +418,10 @@ public function definition() {
$mform->addHelpButton('cohorts', 'smartmenusbycohort', 'theme_boost_union');

// Add operator as select element.
$operatoroptions = smartmenu::get_operator_options();
$operatoroptions = [
smartmenu::ANY => get_string('any'),
smartmenu::ALL => get_string('all'),
];
$mform->addElement('select', 'operator', get_string('smartmenusoperator', 'theme_boost_union'), $operatoroptions);
$mform->setDefault('operator', smartmenu::ANY);
$mform->setType('operator', PARAM_INT);
Expand Down
Loading

0 comments on commit 1b0606e

Please sign in to comment.