Merge branch 'MDL-47513-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Dan Poltawski 2014-10-23 16:17:49 +01:00 committed by Eloy Lafuente (stronk7)
commit 276af2a44d
10 changed files with 121 additions and 37 deletions

View file

@ -346,6 +346,15 @@ FloatingHeaders.prototype = {
*/ */
firstUserCellWidth: 0, firstUserCellWidth: 0,
/**
* The width of the dock if it is visible.
*
* @property dockWidth
* @type Number
* @protected
*/
dockWidth: 0,
/** /**
* The position of the top of the final user cell. * The position of the top of the final user cell.
* This is used when processing the scroll event as an optimisation. It must be updated when * This is used when processing the scroll event as an optimisation. It must be updated when
@ -446,6 +455,13 @@ FloatingHeaders.prototype = {
this.footerRowPosition = this.tableFooterRow.getY(); this.footerRowPosition = this.tableFooterRow.getY();
} }
// Add the width of the dock if it is visible.
this.dockWidth = 0;
var dock = Y.one('.has_dock #dock');
if (dock) {
this.dockWidth = dock.get(OFFSETWIDTH);
}
var userCellList = Y.all(SELECTORS.USERCELL); var userCellList = Y.all(SELECTORS.USERCELL);
// The left of the user cells matches the left of the headerRow. // The left of the user cells matches the left of the headerRow.
@ -579,7 +595,9 @@ FloatingHeaders.prototype = {
// Listen for window scrolls, resizes, and rotation events. // Listen for window scrolls, resizes, and rotation events.
Y.one(Y.config.win).on('scroll', this._handleScrollEvent, this), Y.one(Y.config.win).on('scroll', this._handleScrollEvent, this),
Y.one(Y.config.win).on('resize', this._handleResizeEvent, this), Y.one(Y.config.win).on('resize', this._handleResizeEvent, this),
Y.one(Y.config.win).on('orientationchange', this._handleResizeEvent, this) Y.one(Y.config.win).on('orientationchange', this._handleResizeEvent, this),
Y.Global.on('dock:shown', this._handleResizeEvent, this),
Y.Global.on('dock:hidden', this._handleResizeEvent, this)
); );
}, },
@ -594,7 +612,7 @@ FloatingHeaders.prototype = {
var userColumn = Y.all(SELECTORS.USERCELL), var userColumn = Y.all(SELECTORS.USERCELL),
// Create a floating table. // Create a floating table.
floatingUserColumn = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater"></div>'), floatingUserColumn = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly"></div>'),
// Get the XY for the floating element. // Get the XY for the floating element.
coordinates = this._getRelativeXY(this.firstUserCell); coordinates = this._getRelativeXY(this.firstUserCell);
@ -641,7 +659,7 @@ FloatingHeaders.prototype = {
this.headerCell = Y.one(SELECTORS.STUDENTHEADER); this.headerCell = Y.one(SELECTORS.STUDENTHEADER);
// Create the floating row and cell. // Create the floating row and cell.
var floatingUserHeaderRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater heading"></div>'), var floatingUserHeaderRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly heading"></div>'),
floatingUserHeaderCell = Y.Node.create('<div></div>'), floatingUserHeaderCell = Y.Node.create('<div></div>'),
nodepos = this._getRelativeXY(this.headerCell)[0], nodepos = this._getRelativeXY(this.headerCell)[0],
coordinates = this._getRelativeXY(this.headerRow), coordinates = this._getRelativeXY(this.headerRow),
@ -821,7 +839,7 @@ FloatingHeaders.prototype = {
} }
// Create the floating row and cell. // Create the floating row and cell.
var floatingRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater"></div>'), var floatingRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly"></div>'),
floatingCell = Y.Node.create('<div></div>'), floatingCell = Y.Node.create('<div></div>'),
coordinates = this._getRelativeXY(origin), coordinates = this._getRelativeXY(origin),
width = this.firstUserCell.getComputedStyle(WIDTH), width = this.firstUserCell.getComputedStyle(WIDTH),
@ -904,14 +922,14 @@ FloatingHeaders.prototype = {
// User column position. // User column position.
if (right_to_left()) { if (right_to_left()) {
floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset; floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset - this.dockWidth;
floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth; floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth;
userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth); userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth);
leftTitleFloats = (floatingUserTriggerPoint - this.firstNonUserCellWidth) < leftTitleFloats = (floatingUserTriggerPoint - this.firstNonUserCellWidth) <
(this.firstNonUserCellLeft + this.firstUserCellWidth); (this.firstNonUserCellLeft + this.firstUserCellWidth);
} else { } else {
floatingUserTriggerPoint = Y.config.win.pageXOffset; floatingUserRelativePoint = Y.config.win.pageXOffset;
floatingUserRelativePoint = floatingUserTriggerPoint; floatingUserTriggerPoint = floatingUserRelativePoint + this.dockWidth;
userFloats = floatingUserTriggerPoint > this.firstUserCellLeft; userFloats = floatingUserTriggerPoint > this.firstUserCellLeft;
leftTitleFloats = floatingUserTriggerPoint > (this.firstNonUserCellLeft - this.firstUserCellWidth); leftTitleFloats = floatingUserTriggerPoint > (this.firstNonUserCellLeft - this.firstUserCellWidth);
} }

View file

@ -346,6 +346,15 @@ FloatingHeaders.prototype = {
*/ */
firstUserCellWidth: 0, firstUserCellWidth: 0,
/**
* The width of the dock if it is visible.
*
* @property dockWidth
* @type Number
* @protected
*/
dockWidth: 0,
/** /**
* The position of the top of the final user cell. * The position of the top of the final user cell.
* This is used when processing the scroll event as an optimisation. It must be updated when * This is used when processing the scroll event as an optimisation. It must be updated when
@ -446,6 +455,13 @@ FloatingHeaders.prototype = {
this.footerRowPosition = this.tableFooterRow.getY(); this.footerRowPosition = this.tableFooterRow.getY();
} }
// Add the width of the dock if it is visible.
this.dockWidth = 0;
var dock = Y.one('.has_dock #dock');
if (dock) {
this.dockWidth = dock.get(OFFSETWIDTH);
}
var userCellList = Y.all(SELECTORS.USERCELL); var userCellList = Y.all(SELECTORS.USERCELL);
// The left of the user cells matches the left of the headerRow. // The left of the user cells matches the left of the headerRow.
@ -579,7 +595,9 @@ FloatingHeaders.prototype = {
// Listen for window scrolls, resizes, and rotation events. // Listen for window scrolls, resizes, and rotation events.
Y.one(Y.config.win).on('scroll', this._handleScrollEvent, this), Y.one(Y.config.win).on('scroll', this._handleScrollEvent, this),
Y.one(Y.config.win).on('resize', this._handleResizeEvent, this), Y.one(Y.config.win).on('resize', this._handleResizeEvent, this),
Y.one(Y.config.win).on('orientationchange', this._handleResizeEvent, this) Y.one(Y.config.win).on('orientationchange', this._handleResizeEvent, this),
Y.Global.on('dock:shown', this._handleResizeEvent, this),
Y.Global.on('dock:hidden', this._handleResizeEvent, this)
); );
}, },
@ -594,7 +612,7 @@ FloatingHeaders.prototype = {
var userColumn = Y.all(SELECTORS.USERCELL), var userColumn = Y.all(SELECTORS.USERCELL),
// Create a floating table. // Create a floating table.
floatingUserColumn = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater"></div>'), floatingUserColumn = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly"></div>'),
// Get the XY for the floating element. // Get the XY for the floating element.
coordinates = this._getRelativeXY(this.firstUserCell); coordinates = this._getRelativeXY(this.firstUserCell);
@ -641,7 +659,7 @@ FloatingHeaders.prototype = {
this.headerCell = Y.one(SELECTORS.STUDENTHEADER); this.headerCell = Y.one(SELECTORS.STUDENTHEADER);
// Create the floating row and cell. // Create the floating row and cell.
var floatingUserHeaderRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater heading"></div>'), var floatingUserHeaderRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly heading"></div>'),
floatingUserHeaderCell = Y.Node.create('<div></div>'), floatingUserHeaderCell = Y.Node.create('<div></div>'),
nodepos = this._getRelativeXY(this.headerCell)[0], nodepos = this._getRelativeXY(this.headerCell)[0],
coordinates = this._getRelativeXY(this.headerRow), coordinates = this._getRelativeXY(this.headerRow),
@ -820,7 +838,7 @@ FloatingHeaders.prototype = {
} }
// Create the floating row and cell. // Create the floating row and cell.
var floatingRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater"></div>'), var floatingRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly"></div>'),
floatingCell = Y.Node.create('<div></div>'), floatingCell = Y.Node.create('<div></div>'),
coordinates = this._getRelativeXY(origin), coordinates = this._getRelativeXY(origin),
width = this.firstUserCell.getComputedStyle(WIDTH), width = this.firstUserCell.getComputedStyle(WIDTH),
@ -903,14 +921,14 @@ FloatingHeaders.prototype = {
// User column position. // User column position.
if (right_to_left()) { if (right_to_left()) {
floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset; floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset - this.dockWidth;
floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth; floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth;
userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth); userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth);
leftTitleFloats = (floatingUserTriggerPoint - this.firstNonUserCellWidth) < leftTitleFloats = (floatingUserTriggerPoint - this.firstNonUserCellWidth) <
(this.firstNonUserCellLeft + this.firstUserCellWidth); (this.firstNonUserCellLeft + this.firstUserCellWidth);
} else { } else {
floatingUserTriggerPoint = Y.config.win.pageXOffset; floatingUserRelativePoint = Y.config.win.pageXOffset;
floatingUserRelativePoint = floatingUserTriggerPoint; floatingUserTriggerPoint = floatingUserRelativePoint + this.dockWidth;
userFloats = floatingUserTriggerPoint > this.firstUserCellLeft; userFloats = floatingUserTriggerPoint > this.firstUserCellLeft;
leftTitleFloats = floatingUserTriggerPoint > (this.firstNonUserCellLeft - this.firstUserCellWidth); leftTitleFloats = floatingUserTriggerPoint > (this.firstNonUserCellLeft - this.firstUserCellWidth);
} }

View file

@ -203,6 +203,15 @@ FloatingHeaders.prototype = {
*/ */
firstUserCellWidth: 0, firstUserCellWidth: 0,
/**
* The width of the dock if it is visible.
*
* @property dockWidth
* @type Number
* @protected
*/
dockWidth: 0,
/** /**
* The position of the top of the final user cell. * The position of the top of the final user cell.
* This is used when processing the scroll event as an optimisation. It must be updated when * This is used when processing the scroll event as an optimisation. It must be updated when
@ -303,6 +312,13 @@ FloatingHeaders.prototype = {
this.footerRowPosition = this.tableFooterRow.getY(); this.footerRowPosition = this.tableFooterRow.getY();
} }
// Add the width of the dock if it is visible.
this.dockWidth = 0;
var dock = Y.one('.has_dock #dock');
if (dock) {
this.dockWidth = dock.get(OFFSETWIDTH);
}
var userCellList = Y.all(SELECTORS.USERCELL); var userCellList = Y.all(SELECTORS.USERCELL);
// The left of the user cells matches the left of the headerRow. // The left of the user cells matches the left of the headerRow.
@ -436,7 +452,9 @@ FloatingHeaders.prototype = {
// Listen for window scrolls, resizes, and rotation events. // Listen for window scrolls, resizes, and rotation events.
Y.one(Y.config.win).on('scroll', this._handleScrollEvent, this), Y.one(Y.config.win).on('scroll', this._handleScrollEvent, this),
Y.one(Y.config.win).on('resize', this._handleResizeEvent, this), Y.one(Y.config.win).on('resize', this._handleResizeEvent, this),
Y.one(Y.config.win).on('orientationchange', this._handleResizeEvent, this) Y.one(Y.config.win).on('orientationchange', this._handleResizeEvent, this),
Y.Global.on('dock:shown', this._handleResizeEvent, this),
Y.Global.on('dock:hidden', this._handleResizeEvent, this)
); );
}, },
@ -451,7 +469,7 @@ FloatingHeaders.prototype = {
var userColumn = Y.all(SELECTORS.USERCELL), var userColumn = Y.all(SELECTORS.USERCELL),
// Create a floating table. // Create a floating table.
floatingUserColumn = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater"></div>'), floatingUserColumn = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly"></div>'),
// Get the XY for the floating element. // Get the XY for the floating element.
coordinates = this._getRelativeXY(this.firstUserCell); coordinates = this._getRelativeXY(this.firstUserCell);
@ -498,7 +516,7 @@ FloatingHeaders.prototype = {
this.headerCell = Y.one(SELECTORS.STUDENTHEADER); this.headerCell = Y.one(SELECTORS.STUDENTHEADER);
// Create the floating row and cell. // Create the floating row and cell.
var floatingUserHeaderRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater heading"></div>'), var floatingUserHeaderRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly heading"></div>'),
floatingUserHeaderCell = Y.Node.create('<div></div>'), floatingUserHeaderCell = Y.Node.create('<div></div>'),
nodepos = this._getRelativeXY(this.headerCell)[0], nodepos = this._getRelativeXY(this.headerCell)[0],
coordinates = this._getRelativeXY(this.headerRow), coordinates = this._getRelativeXY(this.headerRow),
@ -678,7 +696,7 @@ FloatingHeaders.prototype = {
} }
// Create the floating row and cell. // Create the floating row and cell.
var floatingRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater"></div>'), var floatingRow = Y.Node.create('<div aria-hidden="true" role="presentation" class="floater sideonly"></div>'),
floatingCell = Y.Node.create('<div></div>'), floatingCell = Y.Node.create('<div></div>'),
coordinates = this._getRelativeXY(origin), coordinates = this._getRelativeXY(origin),
width = this.firstUserCell.getComputedStyle(WIDTH), width = this.firstUserCell.getComputedStyle(WIDTH),
@ -761,14 +779,14 @@ FloatingHeaders.prototype = {
// User column position. // User column position.
if (right_to_left()) { if (right_to_left()) {
floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset; floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset - this.dockWidth;
floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth; floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth;
userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth); userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth);
leftTitleFloats = (floatingUserTriggerPoint - this.firstNonUserCellWidth) < leftTitleFloats = (floatingUserTriggerPoint - this.firstNonUserCellWidth) <
(this.firstNonUserCellLeft + this.firstUserCellWidth); (this.firstNonUserCellLeft + this.firstUserCellWidth);
} else { } else {
floatingUserTriggerPoint = Y.config.win.pageXOffset; floatingUserRelativePoint = Y.config.win.pageXOffset;
floatingUserRelativePoint = floatingUserTriggerPoint; floatingUserTriggerPoint = floatingUserRelativePoint + this.dockWidth;
userFloats = floatingUserTriggerPoint > this.firstUserCellLeft; userFloats = floatingUserTriggerPoint > this.firstUserCellLeft;
leftTitleFloats = floatingUserTriggerPoint > (this.firstNonUserCellLeft - this.firstUserCellWidth); leftTitleFloats = floatingUserTriggerPoint > (this.firstNonUserCellLeft - this.firstUserCellWidth);
} }

View file

@ -341,12 +341,12 @@ DOCK.prototype = {
* Fires after the dock has been changed from hidden to visible. * Fires after the dock has been changed from hidden to visible.
* @event dock:shown * @event dock:shown
*/ */
this.publish('dock:shown', {prefix:'dock'}); this.publish('dock:shown', {prefix:'dock', broadcast: 2});
/** /**
* Fired after the dock has been changed from visible to hidden. * Fired after the dock has been changed from visible to hidden.
* @event dock:hidden * @event dock:hidden
*/ */
this.publish('dock:hidden', {prefix:'dock'}); this.publish('dock:hidden', {prefix:'dock', broadcast: 2});
/** /**
* Fires when an item is added to the dock. * Fires when an item is added to the dock.
* @event dock:itemadded * @event dock:itemadded
@ -362,7 +362,7 @@ DOCK.prototype = {
* This happens after the itemadded and itemremoved events have been called. * This happens after the itemadded and itemremoved events have been called.
* @event dock:itemschanged * @event dock:itemschanged
*/ */
this.publish('dock:itemschanged', {prefix:'dock'}); this.publish('dock:itemschanged', {prefix:'dock', broadcast: 2});
/** /**
* Fires once when the docks panel is first initialised. * Fires once when the docks panel is first initialised.
* @event dock:panelgenerated * @event dock:panelgenerated

File diff suppressed because one or more lines are too long

View file

@ -339,12 +339,12 @@ DOCK.prototype = {
* Fires after the dock has been changed from hidden to visible. * Fires after the dock has been changed from hidden to visible.
* @event dock:shown * @event dock:shown
*/ */
this.publish('dock:shown', {prefix:'dock'}); this.publish('dock:shown', {prefix:'dock', broadcast: 2});
/** /**
* Fired after the dock has been changed from visible to hidden. * Fired after the dock has been changed from visible to hidden.
* @event dock:hidden * @event dock:hidden
*/ */
this.publish('dock:hidden', {prefix:'dock'}); this.publish('dock:hidden', {prefix:'dock', broadcast: 2});
/** /**
* Fires when an item is added to the dock. * Fires when an item is added to the dock.
* @event dock:itemadded * @event dock:itemadded
@ -360,7 +360,7 @@ DOCK.prototype = {
* This happens after the itemadded and itemremoved events have been called. * This happens after the itemadded and itemremoved events have been called.
* @event dock:itemschanged * @event dock:itemschanged
*/ */
this.publish('dock:itemschanged', {prefix:'dock'}); this.publish('dock:itemschanged', {prefix:'dock', broadcast: 2});
/** /**
* Fires once when the docks panel is first initialised. * Fires once when the docks panel is first initialised.
* @event dock:panelgenerated * @event dock:panelgenerated

View file

@ -339,12 +339,12 @@ DOCK.prototype = {
* Fires after the dock has been changed from hidden to visible. * Fires after the dock has been changed from hidden to visible.
* @event dock:shown * @event dock:shown
*/ */
this.publish('dock:shown', {prefix:'dock'}); this.publish('dock:shown', {prefix:'dock', broadcast: 2});
/** /**
* Fired after the dock has been changed from visible to hidden. * Fired after the dock has been changed from visible to hidden.
* @event dock:hidden * @event dock:hidden
*/ */
this.publish('dock:hidden', {prefix:'dock'}); this.publish('dock:hidden', {prefix:'dock', broadcast: 2});
/** /**
* Fires when an item is added to the dock. * Fires when an item is added to the dock.
* @event dock:itemadded * @event dock:itemadded
@ -360,7 +360,7 @@ DOCK.prototype = {
* This happens after the itemadded and itemremoved events have been called. * This happens after the itemadded and itemremoved events have been called.
* @event dock:itemschanged * @event dock:itemschanged
*/ */
this.publish('dock:itemschanged', {prefix:'dock'}); this.publish('dock:itemschanged', {prefix:'dock', broadcast: 2});
/** /**
* Fires once when the docks panel is first initialised. * Fires once when the docks panel is first initialised.
* @event dock:panelgenerated * @event dock:panelgenerated

View file

@ -460,3 +460,33 @@
} }
} }
} }
.has_dock.path-grade-report-grader {
.gradeparent .sideonly.floating > .cell,
.gradeparent .sideonly.floating > .cell,
.gradeparent .sideonly.floating > .cell {
padding-left: 5 + (@dockWidth + (@dockTitleMargin * 2));
}
&.dir-rtl {
.gradeparent .sideonly.floating > .cell,
.gradeparent .sideonly.floating > .cell,
.gradeparent .sideonly.floating > .cell {
padding-left: 5px;
padding-right: 5 + (@dockWidth + (@dockTitleMargin * 2));
}
}
}
.content-only.path-grade-report-grader {
.gradeparent table {
margin-left: (@dockWidth + (@dockTitleMargin * 2));
}
&.dir-rtl {
.gradeparent table {
margin-left: 0;
margin-right: (@dockWidth + (@dockTitleMargin * 2));
}
}
}

File diff suppressed because one or more lines are too long