MDL-45314 core_grade: a JS fix for the grader report

This commit is contained in:
Andrew Davis 2014-05-02 10:47:27 +08:00 committed by Marina Glancy
parent e2c3c3e080
commit 08b90682e4
4 changed files with 10 additions and 13 deletions

View File

@ -60,10 +60,9 @@ M.gradereport_grader.scrollview = {
node = Y.one('.topscroll');
}
var _this = this;
Y.on('domready', function () {
M.gradereport_grader.scrollview.resize();
});
this.resize();
}, this);
Y.one(src).on('scroll', function() {
node.set('scrollLeft', Y.one(src).get('scrollLeft'));
@ -76,7 +75,7 @@ M.gradereport_grader.scrollview = {
},
resize: function() {
var width = Y.one(M.gradereport_grader.scrollview.SELECTORS.GRADETABLE).get('offsetWidth');
var width = Y.one(this.SELECTORS.GRADETABLE).get('offsetWidth');
Y.one('.topscrollcontent').setStyle('width', width + 'px');
}
};

View File

@ -1 +1 @@
YUI.add("moodle-gradereport_grader-scrollview",function(e,t){M.gradereport_grader=M.gradereport_grader||{},M.gradereport_grader.scrollview={SELECTORS:{CONTAINER:".gradeparent",STATIC:".gradeparent .right_scroller",GRADETABLE:"#user-grades"},container:null,init:function(){this.container=e.one(this.SELECTORS.CONTAINER);if(!this.container)return;var t=e.Node.create('<div class="right_scroller topscroll"><div class="topscrollcontent"></div></div>'),n=this.SELECTORS.CONTAINER;e.one(this.SELECTORS.STATIC)&&(n=this.SELECTORS.STATIC);var r=e.one(n).insert(t,"before");e.one(this.SELECTORS.STATIC)||(r=e.one(".topscroll"));var i=this;e.on("domready",function(){M.gradereport_grader.scrollview.resize()}),e.one(n).on("scroll",function(){r.set("scrollLeft",e.one(n).get("scrollLeft"))}),r.on("scroll",function(){e.one(n).set("scrollLeft",r.get("scrollLeft"))})},resize:function(){var t=e.one(M.gradereport_grader.scrollview.SELECTORS.GRADETABLE).get("offsetWidth");e.one(".topscrollcontent").setStyle("width",t+"px")}}},"@VERSION@",{requires:["base","node"]});
YUI.add("moodle-gradereport_grader-scrollview",function(e,t){M.gradereport_grader=M.gradereport_grader||{},M.gradereport_grader.scrollview={SELECTORS:{CONTAINER:".gradeparent",STATIC:".gradeparent .right_scroller",GRADETABLE:"#user-grades"},container:null,init:function(){this.container=e.one(this.SELECTORS.CONTAINER);if(!this.container)return;var t=e.Node.create('<div class="right_scroller topscroll"><div class="topscrollcontent"></div></div>'),n=this.SELECTORS.CONTAINER;e.one(this.SELECTORS.STATIC)&&(n=this.SELECTORS.STATIC);var r=e.one(n).insert(t,"before");e.one(this.SELECTORS.STATIC)||(r=e.one(".topscroll")),e.on("domready",function(){this.resize()},this),e.one(n).on("scroll",function(){r.set("scrollLeft",e.one(n).get("scrollLeft"))}),r.on("scroll",function(){e.one(n).set("scrollLeft",r.get("scrollLeft"))})},resize:function(){var t=e.one(this.SELECTORS.GRADETABLE).get("offsetWidth");e.one(".topscrollcontent").setStyle("width",t+"px")}}},"@VERSION@",{requires:["base","node"]});

View File

@ -59,10 +59,9 @@ M.gradereport_grader.scrollview = {
node = Y.one('.topscroll');
}
var _this = this;
Y.on('domready', function () {
M.gradereport_grader.scrollview.resize();
});
this.resize();
}, this);
Y.one(src).on('scroll', function() {
node.set('scrollLeft', Y.one(src).get('scrollLeft'));
@ -75,7 +74,7 @@ M.gradereport_grader.scrollview = {
},
resize: function() {
var width = Y.one(M.gradereport_grader.scrollview.SELECTORS.GRADETABLE).get('offsetWidth');
var width = Y.one(this.SELECTORS.GRADETABLE).get('offsetWidth');
Y.one('.topscrollcontent').setStyle('width', width + 'px');
}
};

View File

@ -58,10 +58,9 @@ M.gradereport_grader.scrollview = {
node = Y.one('.topscroll');
}
var _this = this;
Y.on('domready', function () {
M.gradereport_grader.scrollview.resize();
});
this.resize();
}, this);
Y.one(src).on('scroll', function() {
node.set('scrollLeft', Y.one(src).get('scrollLeft'));
@ -74,7 +73,7 @@ M.gradereport_grader.scrollview = {
},
resize: function() {
var width = Y.one(M.gradereport_grader.scrollview.SELECTORS.GRADETABLE).get('offsetWidth');
var width = Y.one(this.SELECTORS.GRADETABLE).get('offsetWidth');
Y.one('.topscrollcontent').setStyle('width', width + 'px');
}
};