Skip to content

Update for Moodle 5.0: Fix deprecated dropdown menu, variable interpolation, and AMOS view styles #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025

Conversation

durenadev
Copy link

This patch prepares the plugin for Moodle 5.0 by addressing several compatibility issues:

  • Replaces deprecated dropdown_menu usage with the updated output API.
    • Applied in renderer.php to show correctly the dropdown menu at BS5
  • Fixes legacy variable interpolation to comply with modern PHP syntax.
    • Fixed in the classes due to the PHP 8.2 required upgrade.
  • Updates styles for the AMOS view to match core UI changes in Moodle 5.0.
    • In this case, I only add CSS code at the end, but I do not know why the PR shows a change at the first line, where I maintain the previous code.

#page-local-amos-view #amosfilter label+.form-text{margin-top:0;margin-bottom:.25rem}#page-local-amos-view #amosfilter #amosfilter_fcmp,#page-local-amos-view #amosfilter #amosfilter_flng{resize:vertical}#page-local-amos-view #amosfilter #amosfilter_fcmp input[type=checkbox]:checked+label{font-weight:bold}#page-local-amos-view #amosfilter[data-level-showadvanced="0"] [data-level=advanced]:not([data-level-forceshow]){display:none}#page-local-amos-view #amostranslator{opacity:1;transition:opacity .2s}#page-local-amos-view #amostranslator.loading{opacity:0}#page-local-amos-view #amostranslator .amostranslatoritem .amosinfo .icon{margin-right:0}#page-local-amos-view #amostranslator .amostranslatoritem .amosinfo{margin-bottom:.25rem}#page-local-amos-view #amostranslator .amostranslatoritem .amosoriginal,#page-local-amos-view #amostranslator .amostranslatoritem .amostranslation{flex:1 1 auto;min-height:3rem}#page-local-amos-view #amostranslator .amostranslatoritem .amosoriginal,#page-local-amos-view #amostranslator .amostranslatoritem .amostranslation,#page-local-amos-view #amostranslator .amostranslatoritem .amostranslationedit textarea{border:1px solid #ccc;border-radius:4px}#page-local-amos-view #amostranslator .amostranslatoritem .amosoriginal,#page-local-amos-view #amostranslator .amostranslatoritem .amostranslationview{padding:10px;white-space:pre-wrap;word-wrap:break-word}#page-local-amos-view #amostranslator .amostranslatoritem .amostranslationedit{padding:4px}#page-local-amos-view #amostranslator .amostranslatoritem .amostranslationedit textarea{padding:5px}#page-local-amos-view #amostranslator .amostranslatoritem .amostranslationview{cursor:text}#page-local-amos-view #amostranslator .amostranslatoritem .amostranslationview,#page-local-amos-view #amostranslator .amostranslatoritem .amostranslationedit,#page-local-amos-view #amostranslator .amostranslatoritem .amostranslationedit textarea{height:100%;width:100%}#page-local-amos-view #amostranslator .amostranslatoritem.translatable .amostranslation{background-color:#d4edda}#page-local-amos-view #amostranslator .amostranslatoritem.translatable.missing .amostranslation{background-color:#f8d7da}#page-local-amos-view #amostranslator .amostranslatoritem.translatable.outdated .amostranslation{background-color:#fff3cd}#page-local-amos-view #amostranslator .amostranslatoritem.translatable.staged .amostranslation{background-color:#d1ecf1 !important}#page-local-amos-view #amostranslator .amostranslatoritem.translatable.outdated .amostranslation{background-color:#fff3cd}#page-local-amos-view #amostranslator .amostranslatoritem.nontranslatable .amostranslation{background-color:#f7f7f7;font-style:italic;color:#545454}#page-local-amos-view #amostranslator .amostranslatoritem[data-mode=view] .amostranslationedit{display:none !important}#page-local-amos-view #amostranslator .amostranslatoritem[data-mode=edit] .amostranslationview{display:none !important}#page-local-amos-view #amostranslator .amospaginator .paginatoritem.current{font-weight:bold;background-color:#eee}.path-local-amos #amosstagewrapper .stagetool{margin-bottom:10px}.path-local-amos #amosstagewrapper .stagetool.simple{margin-bottom:20px}.path-local-amos #amosstagewrapper .stagetool .stagetool-title{font-size:larger;background:url([[pix:core|t/expanded]]) no-repeat scroll 0 center;padding-left:20px;cursor:pointer;color:#007bff;text-decoration:none}.path-local-amos #amosstagewrapper .stagetool .stagetool-title:hover{color:#0056b3;text-decoration:underline}.path-local-amos #amosstagewrapper .stagetool .collapsed .stagetool-title{background-image:url([[pix:core|t/collapsed]])}.path-local-amos #amosstagewrapper .stagetool .stagetool-content{padding-left:1.3rem}.path-local-amos #amosstagewrapper .stagetool.commit label.checkbox{margin-bottom:5px}.path-local-amos #amosstagewrapper .stagetool.commit label.checkbox input[type=checkbox]{margin-top:4px;margin-right:0}.path-local-amos #amosstagewrapper .stagetool.stageactions .btn{margin:2px}.path-local-amos #amosstagewrapper #amosstagestrings{margin-top:2rem}.path-local-amos #amosstagewrapper #amosstagestrings .amosoriginal,.path-local-amos #amosstagewrapper #amosstagestrings .amostranslation{flex:1 1 auto;min-height:3rem;border:1px solid #ccc;border-radius:4px;padding:10px;white-space:pre-wrap;word-wrap:break-word}.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.uncommittable .amostranslation{background-color:#f7f7f7}.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.committable .amostranslation{background-color:#d4edda}.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.committable.nodiff .amostranslation{background-color:#fff}.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.diff[data-diffmode=chunks] .amostranslation .translation-new,.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.diff[data-diffmode=chunks] .amostranslation .translation-current{display:none}.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.diff[data-diffmode=blocks] .amostranslation .translation-diff{display:none}.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.diff[data-diffmode=chunks] .amostranslation del,.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.diff[data-diffmode=blocks] .amostranslation .translation-current{color:#6b6b6b;text-decoration:line-through double}.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.diff[data-diffmode=chunks] .amostranslation ins,.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem.diff[data-diffmode=blocks] .amostranslation .translation-new{color:green;font-weight:bold;text-decoration:underline dotted}.path-local-amos #amosstagewrapper #amosstagestrings .amosstageitem:not([class~=diff]) [data-action=toggle-diffmode]{display:none}#page-local-amos-credits .maintainers .maintainer{max-width:200px}#page-local-amos-index h2{text-align:left}#page-local-amos-index .amostools{text-align:center;margin-bottom:30px}#page-local-amos-index .amostools .amostool{margin:5px;display:inline-block;background-image:url([[pix:core|t/edit]]);background-repeat:no-repeat;background-position:center 15px;background-size:24px 24px;padding-top:50px}#page-local-amos-index .amostools .amostool-translator{background-image:url([[pix:core|t/editstring]])}#page-local-amos-index .amostools .amostool-stage{background-image:url([[pix:core|i/scheduled]])}#page-local-amos-index .amostools .amostool-stashes{background-image:url([[pix:core|i/repository]])}#page-local-amos-index .amostools .amostool-contributions{background-image:url([[pix:core|i/export]])}#page-local-amos-index .amostools .amostool-log{background-image:url([[pix:core|i/groups]])}#page-local-amos-index .amostools .amostool-credits{background-image:url([[pix:core|i/badge]])}#page-local-amos-contrib .comment-area{max-width:100%}#page-local-amos-contrib .commentswrapper{width:100%;border:none}#page-local-amos-contrib .commentswrapper .comment-ctrl .comment-list li{color:inherit !important;background-color:inherit !important}#page-local-amos-contrib .commentswrapper .amos-comment{font-size:1rem}#page-local-amos-contrib .commentswrapper .amos-comment .comment-comment{border:1px solid #dfdfdf;border-radius:0 0 10px 10px;padding:1em}#page-local-amos-contrib .commentswrapper .amos-comment .comment-comment ul li,#page-local-amos-contrib .commentswrapper .amos-comment .comment-comment li{list-style-type:disc;padding:0}#page-local-amos-contrib .commentswrapper .amos-comment .comment-comment ol li{list-style-type:decimal;padding:0}#page-local-amos-contrib .commentswrapper .amos-comment .comment-comment .comment-delete{right:6px;top:3px}#page-local-amos-contrib .commentswrapper .amos-comment .comment-header{padding:5px;border-top:1px solid #dfdfdf;border-left:1px solid #dfdfdf;border-right:1px solid #dfdfdf;border-radius:10px 10px 0 0;background-color:#fbfbfb;display:block}#page-local-amos-contrib .commentswrapper .amos-comment .comment-userpicture,#page-local-amos-contrib .commentswrapper .amos-comment .comment-userfullname,#page-local-amos-contrib .commentswrapper .amos-comment .comment-time{display:inline-block;margin-right:1em}#page-local-amos-contrib .commentswrapper .amos-comment .comment-time{font-size:.875rem}#page-local-amos-contrib .commentswrapper .amos-comment.highlighted .comment-comment{background-color:#fbfbfb}#page-local-amos-view #region-main{overflow-x:auto}#page-local-amos-view h2{text-align:center}.path-local-amos .logrecord{border:1px solid #ddd;padding:.5em}.path-local-amos .contributionlist{margin:1em auto}.path-local-amos .contributionlist .userpicture{margin-right:5px;vertical-align:middle}.path-local-amos .contributionlist .status0 .id,.path-local-amos .contributionlist .status0 .status,.path-local-amos .contributionwrapper .details .status0 td{background-color:#d2ebff}.path-local-amos .contributionlist .status10 .id,.path-local-amos .contributionlist .status10 .status,.path-local-amos .contributionwrapper .details .status10 td,.path-local-amos .contribactions .singlebutton.review input[type=submit]{background-color:#f3f2aa}.path-local-amos .contributionlist .status20 .id,.path-local-amos .contributionlist .status20 .status,.path-local-amos .contributionwrapper .details .status20 td,.path-local-amos .contribactions .singlebutton.reject input[type=submit]{background-color:#ffd3d9}.path-local-amos .contributionlist .status30 .id,.path-local-amos .contributionlist .status30 .status,.path-local-amos .contributionwrapper .details .status30 td,.path-local-amos .contribactions .singlebutton.accept input[type=submit]{background-color:#e7f1c3}.path-local-amos .contributionwrapper .source{padding-left:60px;position:relative}.path-local-amos .contributionwrapper .source{margin-left:auto;margin-right:auto}.path-local-amos .contributionwrapper .details{max-width:100%;min-width:300px;margin-top:1em;margin-left:auto;margin-right:auto}.path-local-amos .contributionwrapper .source h3,.path-local-amos .contributionwrapper .source div{margin:0px 0px .3em}.path-local-amos .contributionwrapper .source .timecreated{font-style:italic}.path-local-amos .contributionwrapper .source .userpicture{position:absolute;top:10px;left:10px}.path-local-amos .contributionwrapper .details .userpicture{margin-right:5px;vertical-align:middle}.path-local-amos .contribactions{text-align:center;margin-bottom:1em}.path-local-amos .contribactions .singlebutton,.path-local-amos .contribactions .singlebutton form,.path-local-amos .contribactions .singlebutton form div{display:inline}.path-local-amos .contribactions .singlebutton{margin:0px 2px}.path-local-amos .commentswrapper{width:440px;margin-left:auto;margin-right:auto;padding:10px;border:1px solid #eee;background-color:#fff}.path-local-amos .commentswrapper .comment-link{margin-bottom:5px}.path-local-amos .commentswrapper .comment-area{margin:0px auto}
#page-local-amos-view {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is unexpected. IIRC, this styles.css file is actually built from the files in the scss/ directory. However, I will need to recall how it was actually built.

@mudrd8mz mudrd8mz merged commit 3a7d2cc into moodlehq:main May 12, 2025
1 check failed
@mudrd8mz
Copy link
Member

Thank you @durenadev for these fixes. I only added bd1b598 to move the new styles from the generated CSS to the original SCSS file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants