Moodle 3.1 - how to use previous assignment grading interface?

Re: Moodle 3.1 - how to use previous assignment grading interface?

by Rebecca Trynes -
Number of replies: 7

I know this thread is getting a bit old, but you can add some javascript (jquery in this case) to your theme to make sure the grading panel is the first panel to show up (as opposed to the split screen). It's just a matter of changing which panel is 'active' to begin with:

---------------------------------------------------------------------------------------------------------------

if ($('body#page-mod-assign-grader.pagelayout-embedded')) {
    $('button.collapse-none').removeClass('active');
    $('button.collapse-review-panel').addClass('active');
   
    $('[data-region=review-panel]').addClass('collapsed');
}

---------------------------------------------------------------------------------------------------------------

Average of ratings: Useful (2)
In reply to Rebecca Trynes

Re: Moodle 3.1 - how to use previous assignment grading interface?

by Toshihiro KITA -
Picture of Plugin developers Picture of Translators
Thank you for the javascript code. That is a great help for me. The meaning is the same, but i tried to directly modify the template files and it worked to hide the review panel as default.
(Adding javascript code in Themes looks like a bit of work today according to $THEME->javascripts description in https://docs.moodle.org/dev/Themes_overview#Theme_options_2 .)

How i modifled the files is shown in diff:

# diff  mod/assign/templates/grading_app.mustache.orig  mod/assign/templates/grading_app.mustache
37c37
< <div data-region="review-panel">
---
> <div data-region="review-panel" class="collapsed">

# diff  mod/assign/templates/grading_actions.mustache.orig  mod/assign/templates/grading_actions.mustache
44,45c44,45
<        <button class="btn collapse-review-panel">{{#pix}} layout-expand-right, mod_assign, {{#str}} collapsereviewpanel, mod_assign {{/str}} {{/pix}}</button>
<        <button class="btn collapse-none active">{{#pix}} layout-default, mod_assign, {{#str}} defaultlayout, mod_assign {{/str}} {{/pix}}</button>
---
>        <button class="btn collapse-review-panel active">{{#pix}} layout-expand-right, mod_assign, {{#str}} collapsereviewpanel, mod_assign {{/str}} {{/pix}}</button>
>        <button class="btn collapse-none">{{#pix}} layout-default, mod_assign, {{#str}} defaultlayout, mod_assign {{/str}} {{/pix}}</button>
Average of ratings: Useful (1)
In reply to Rebecca Trynes

Re: Moodle 3.1 - how to use previous assignment grading interface?

by Dan Logan -

Hi Rebecca

Thank you for posting this. Can you tell me which file in your theme you are adding this code to?

Regards

Dan


In reply to Dan Logan

Re: Moodle 3.1 - how to use previous assignment grading interface?

by Rebecca Trynes -

Hi Dan

Sure.

First off, I created a .js file called 'AddClass.js' with this code in it:

require(['jquery'], function($) {

// The new assign grade view has panels - review and grade - automatically set to show both

if ($('body').is('#page-mod-assign-grader.pagelayout-embedded')) {
    $('button.collapse-none').removeClass('active');
    $('button.collapse-review-panel').addClass('active');
   
    $('[data-region=review-panel]').addClass('collapsed');
}

});

I then added a reference to this file in the config.php file of my theme:

$THEME->javascripts_footer = array('AddClass'); //Javascripts to include in footer

Hope that helps!

In reply to Rebecca Trynes

Re: Moodle 3.1 - how to use previous assignment grading interface?

by Dan Logan -

Hi Rebecca

Thank you so much for sharing your knowledge! 

Very cool, I love moodle!

Regards

Dan


In reply to Dan Logan

Re: Moodle 3.1 - how to use previous assignment grading interface?

by Jim Judges -

This is okay if you have access to these files.

Somebody else reported that if you change the grading URL to end with action=grade (instead of "action=grader") this presents the old interface - this could be useful although I am unsure how safe this method is? Ideally the assignment settings would allow this switch, rather than relying on the theme fix described above it would be good to be able to choose "grade" or "grader". AND/OR ideally it would be possible to configure the default display. Currently the default is the annotation screen which is not popular with everyone and not needed in many cases.

In reply to Jim Judges

Re: Moodle 3.1 - how to use previous assignment grading interface?

by Rebecca Trynes -

That is true, yes. You can change it via the url. I believe it's perfectly safe?

Absolutely agree about having those assignment settings: 100%!

Average of ratings: Useful (1)
In reply to Jim Judges

Re: Moodle 3.1 - how to use previous assignment grading interface?

by Cris Fuhrman -

It's possible to use Tamper Monkey to do this, without modifying your Moodle site. TamperMonkey is a plug-in for browsers that can run JavaScript on certain pages (the @match configuration). 

Here's the relevant code (I don't have old versions of Moodle to test this on, but it works for me):

// ==UserScript==
// @name         Moodle collapse review panel in grading
// @namespace    https://profs.etsmtl.ca/cfuhrman/
// @version      0.1
// @description  Save many clicks by collapsing the PDF review panel in grading
// @author       Christopher Fuhrman
// @match        https://*/mod/assign/view.php*action=grader*
// @require      https://code.jquery.com/jquery-latest.js
// @grant        none
// ==/UserScript==

// Note: the "action=grader" in the @match above is the 3.x grading interface, so this won't be invoked on older versions of Moodle

(function() {
    'use strict';

    $('button.collapse-none').removeClass('active');
    $('button.collapse-review-panel').addClass('active');
    $('[data-region=review-panel]').addClass('collapsed');
})();