Skip to content

Commit

Permalink
Merge branch 'MDL-31679' of git://github.com/aolley/moodle
Browse files Browse the repository at this point in the history
Conflicts:
	theme/bootstrapbase/style/moodle.css
  • Loading branch information
danpoltawski committed Apr 9, 2014
2 parents c559161 + 19213ef commit a935ccc
Show file tree
Hide file tree
Showing 11 changed files with 284 additions and 2 deletions.
1 change: 1 addition & 0 deletions grade/report/grader/index.php
Expand Up @@ -52,6 +52,7 @@
}

$PAGE->set_url(new moodle_url('/grade/report/grader/index.php', array('id'=>$courseid)));
$PAGE->requires->yui_module('moodle-gradereport_grader-scrollview', 'M.gradereport_grader.scrollview.init');

// basic access checks
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
Expand Down
7 changes: 7 additions & 0 deletions grade/report/grader/styles.css
Expand Up @@ -587,3 +587,10 @@ table#user-grades td.controls,
margin-left: 0.5em;
}

.path-grade-report-grader .yui3-scrollview-scrollbar {
opacity: 1 !important;
}

.path-grade-report-grader .yui3-scrollview-scrollbar-horiz {
bottom: -2px;
}
@@ -0,0 +1,81 @@
YUI.add('moodle-gradereport_grader-scrollview', function (Y, NAME) {

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.


/**
* Scrollview for grader table.
*
* @package gradereport_grader
* @copyright 2013 NetSpot Pty Ltd
* @author Adam Olley <adam.olley@netspot.com.au>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

M.gradereport_grader = M.gradereport_grader || {};
M.gradereport_grader.scrollview = {

/** Selectors. */
SELECTORS: {
CONTAINER: '.gradeparent',
STATIC: '.gradeparent .right_scroller',
GRADETABLE: '#user-grades'
},

container : null,

/**
* Initialise the scrollview code.
*/
init: function() {
this.container = Y.one(this.SELECTORS.CONTAINER);
if (!this.container) {
Y.log('No grade container found.');
return;
}

var topscroll = Y.Node.create('<div class="right_scroller topscroll"><div class="topscrollcontent"></div></div>');

var src = this.SELECTORS.CONTAINER;
if (Y.one(this.SELECTORS.STATIC)) {
src = this.SELECTORS.STATIC;
}

var node = Y.one(src).insert(topscroll, 'before');

if (!Y.one(this.SELECTORS.STATIC)) {
node = Y.one('.topscroll');
}

var _this = this;
Y.on('domready', function () {
var width = Y.one(_this.SELECTORS.GRADETABLE).get('offsetWidth');
Y.one('.topscrollcontent').setStyle('width', width + 'px');
});

Y.one(src).on('scroll', function() {
node.set('scrollLeft', Y.one(src).get('scrollLeft'));
});

node.on('scroll', function() {
Y.one(src).set('scrollLeft', node.get('scrollLeft'));
});

}
};


}, '@VERSION@', {"requires": ["base", "node"]});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,80 @@
YUI.add('moodle-gradereport_grader-scrollview', function (Y, NAME) {

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.


/**
* Scrollview for grader table.
*
* @package gradereport_grader
* @copyright 2013 NetSpot Pty Ltd
* @author Adam Olley <adam.olley@netspot.com.au>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

M.gradereport_grader = M.gradereport_grader || {};
M.gradereport_grader.scrollview = {

/** Selectors. */
SELECTORS: {
CONTAINER: '.gradeparent',
STATIC: '.gradeparent .right_scroller',
GRADETABLE: '#user-grades'
},

container : null,

/**
* Initialise the scrollview code.
*/
init: function() {
this.container = Y.one(this.SELECTORS.CONTAINER);
if (!this.container) {
return;
}

var topscroll = Y.Node.create('<div class="right_scroller topscroll"><div class="topscrollcontent"></div></div>');

var src = this.SELECTORS.CONTAINER;
if (Y.one(this.SELECTORS.STATIC)) {
src = this.SELECTORS.STATIC;
}

var node = Y.one(src).insert(topscroll, 'before');

if (!Y.one(this.SELECTORS.STATIC)) {
node = Y.one('.topscroll');
}

var _this = this;
Y.on('domready', function () {
var width = Y.one(_this.SELECTORS.GRADETABLE).get('offsetWidth');
Y.one('.topscrollcontent').setStyle('width', width + 'px');
});

Y.one(src).on('scroll', function() {
node.set('scrollLeft', Y.one(src).get('scrollLeft'));
});

node.on('scroll', function() {
Y.one(src).set('scrollLeft', node.get('scrollLeft'));
});

}
};


}, '@VERSION@', {"requires": ["base", "node"]});
10 changes: 10 additions & 0 deletions grade/report/grader/yui/src/scrollview/build.json
@@ -0,0 +1,10 @@
{
"name": "moodle-gradereport_grader-scrollview",
"builds": {
"moodle-gradereport_grader-scrollview": {
"jsfiles": [
"scrollview.js"
]
}
}
}
76 changes: 76 additions & 0 deletions grade/report/grader/yui/src/scrollview/js/scrollview.js
@@ -0,0 +1,76 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.


/**
* Scrollview for grader table.
*
* @package gradereport_grader
* @copyright 2013 NetSpot Pty Ltd
* @author Adam Olley <adam.olley@netspot.com.au>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

M.gradereport_grader = M.gradereport_grader || {};
M.gradereport_grader.scrollview = {

/** Selectors. */
SELECTORS: {
CONTAINER: '.gradeparent',
STATIC: '.gradeparent .right_scroller',
GRADETABLE: '#user-grades'
},

container : null,

/**
* Initialise the scrollview code.
*/
init: function() {
this.container = Y.one(this.SELECTORS.CONTAINER);
if (!this.container) {
Y.log('No grade container found.');
return;
}

var topscroll = Y.Node.create('<div class="right_scroller topscroll"><div class="topscrollcontent"></div></div>');

var src = this.SELECTORS.CONTAINER;
if (Y.one(this.SELECTORS.STATIC)) {
src = this.SELECTORS.STATIC;
}

var node = Y.one(src).insert(topscroll, 'before');

if (!Y.one(this.SELECTORS.STATIC)) {
node = Y.one('.topscroll');
}

var _this = this;
Y.on('domready', function () {
var width = Y.one(_this.SELECTORS.GRADETABLE).get('offsetWidth');
Y.one('.topscrollcontent').setStyle('width', width + 'px');
});

Y.one(src).on('scroll', function() {
node.set('scrollLeft', Y.one(src).get('scrollLeft'));
});

node.on('scroll', function() {
Y.one(src).set('scrollLeft', node.get('scrollLeft'));
});

}
};
8 changes: 8 additions & 0 deletions grade/report/grader/yui/src/scrollview/meta/scrollview.json
@@ -0,0 +1,8 @@
{
"moodle-gradereport_grader-scrollview": {
"requires": [
"base",
"node"
]
}
}
8 changes: 8 additions & 0 deletions theme/base/style/grade.css
Expand Up @@ -76,3 +76,11 @@
#page-grade-edit-outcome-course .courseoutcomes td {
text-align:center;
}

#page-grade-report-grader-index .topscrollcontent {
height: 1px;
}

#page-grade-report-grader-index #user-grades {
margin-top: 4px;
}
12 changes: 11 additions & 1 deletion theme/bootstrapbase/less/moodle/grade.less
Expand Up @@ -15,4 +15,14 @@
// Remove the bottom margin to gain height.
margin-bottom: 0;
}
}
}

#page-grade-report-grader-index {
.topscrollcontent {
height: 1px;
}

#user-grades {
margin-top: 4px;
}
}
2 changes: 1 addition & 1 deletion theme/bootstrapbase/style/moodle.css

Large diffs are not rendered by default.

0 comments on commit a935ccc

Please sign in to comment.