mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-52954 assign: Rebuild the assignment single grade page.
This commit is contained in:
parent
2a3647bae5
commit
bb690849c9
86 changed files with 4593 additions and 279 deletions
2
lib/amd/build/form-autocomplete.min.js
vendored
2
lib/amd/build/form-autocomplete.min.js
vendored
File diff suppressed because one or more lines are too long
1
lib/amd/build/tooltip.min.js
vendored
Normal file
1
lib/amd/build/tooltip.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
define(["jquery"],function(a){var b=function(b){this._regionSelector=b,a(this._regionSelector).each(function(b,c){var d=a(c).attr("aria-describedby");if(d){var e=document.getElementById(d);if(e){var f="tooltip"==a(e).attr("role");f&&(a(e).hide(),a(c).attr("tabindex","0")),a(c).on("focus",this._handleFocus.bind(this)),a(c).on("mouseover",this._handleMouseOver.bind(this)),a(c).on("mouseout",this._handleMouseOut.bind(this)),a(c).on("blur",this._handleBlur.bind(this)),a(c).on("keydown",this._handleKeyDown.bind(this))}}}.bind(this))};return b.prototype._regionSelector=null,b.prototype._showTooltip=function(b){var c=a(b.target),d=c.attr("aria-describedby");if(d){var e=a(document.getElementById(d));if(e.show(),e.attr("aria-hidden","false"),!e.is(".tooltip")){var f=a('<div class="tooltip-inner"></div>');f.append(e.contents()),e.append(f),e.addClass("tooltip"),e.addClass("bottom"),e.append('<div class="tooltip-arrow"></div>')}var g=c.offset();g.top+=c.height()+10,a(e).offset(g)}},b.prototype._hideTooltip=function(b){var c=a(b.target),d=c.attr("aria-describedby");if(d){var e=document.getElementById(d);a(e).hide(),a(e).attr("aria-hidden","true")}},b.prototype._handleFocus=function(a){this._showTooltip(a)},b.prototype._handleKeyDown=function(a){27==a.which&&this._hideTooltip(a)},b.prototype._handleMouseOver=function(a){this._showTooltip(a)},b.prototype._handleMouseOut=function(b){var c=a(b.target);c.is(":focus")||this._hideTooltip(b)},b.prototype._handleBlur=function(a){this._hideTooltip(a)},b});
|
|
@ -775,8 +775,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
|||
throttleTimeout = window.setTimeout(handler.bind(this, e), 300);
|
||||
};
|
||||
// Trigger an ajax update after the text field value changes.
|
||||
inputElement.on("input keypress", throttledHandler);
|
||||
|
||||
inputElement.on("input", throttledHandler);
|
||||
var arrowElement = $(document.getElementById(state.downArrowId));
|
||||
arrowElement.on("click", handler);
|
||||
});
|
||||
|
|
133
lib/amd/src/tooltip.js
Normal file
133
lib/amd/src/tooltip.js
Normal file
|
@ -0,0 +1,133 @@
|
|||
define(['jquery'], function($) {
|
||||
|
||||
/**
|
||||
* Tooltip class.
|
||||
*
|
||||
* @param {String} selector The css selector for the node(s) to enhance with tooltips.
|
||||
*/
|
||||
var Tooltip = function(selector) {
|
||||
// Tooltip code matches: http://www.w3.org/WAI/PF/aria-practices/#tooltip
|
||||
this._regionSelector = selector;
|
||||
|
||||
// For each node matching the selector - find an aria-describedby attribute pointing to an role="tooltip" element.
|
||||
|
||||
$(this._regionSelector).each(function(index, element) {
|
||||
var tooltipId = $(element).attr('aria-describedby');
|
||||
if (tooltipId) {
|
||||
var tooltipele = document.getElementById(tooltipId);
|
||||
if (tooltipele) {
|
||||
var correctRole = $(tooltipele).attr('role') == 'tooltip';
|
||||
|
||||
if (correctRole) {
|
||||
$(tooltipele).hide();
|
||||
// Ensure the trigger for the tooltip is keyboard focusable.
|
||||
$(element).attr('tabindex', '0');
|
||||
}
|
||||
|
||||
// Attach listeners.
|
||||
$(element).on('focus', this._handleFocus.bind(this));
|
||||
$(element).on('mouseover', this._handleMouseOver.bind(this));
|
||||
$(element).on('mouseout', this._handleMouseOut.bind(this));
|
||||
$(element).on('blur', this._handleBlur.bind(this));
|
||||
$(element).on('keydown', this._handleKeyDown.bind(this));
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/** @type {String} Selector for the page region containing the user navigation. */
|
||||
Tooltip.prototype._regionSelector = null;
|
||||
|
||||
/**
|
||||
* Find the tooltip referred to by this element and show it.
|
||||
*
|
||||
* @param {Event} e
|
||||
*/
|
||||
Tooltip.prototype._showTooltip = function(e) {
|
||||
var triggerElement = $(e.target);
|
||||
var tooltipId = triggerElement.attr('aria-describedby');
|
||||
if (tooltipId) {
|
||||
var tooltipele = $(document.getElementById(tooltipId));
|
||||
|
||||
tooltipele.show();
|
||||
tooltipele.attr('aria-hidden', 'false');
|
||||
|
||||
if (!tooltipele.is('.tooltip')) {
|
||||
// Change the markup to a bootstrap tooltip.
|
||||
var inner = $('<div class="tooltip-inner"></div>');
|
||||
inner.append(tooltipele.contents());
|
||||
tooltipele.append(inner);
|
||||
tooltipele.addClass('tooltip');
|
||||
tooltipele.addClass('bottom');
|
||||
tooltipele.append('<div class="tooltip-arrow"></div>');
|
||||
}
|
||||
var pos = triggerElement.offset();
|
||||
pos.top += triggerElement.height() + 10;
|
||||
$(tooltipele).offset(pos);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Find the tooltip referred to by this element and hide it.
|
||||
*
|
||||
* @param {Event} e
|
||||
*/
|
||||
Tooltip.prototype._hideTooltip = function(e) {
|
||||
var triggerElement = $(e.target);
|
||||
var tooltipId = triggerElement.attr('aria-describedby');
|
||||
if (tooltipId) {
|
||||
var tooltipele = document.getElementById(tooltipId);
|
||||
|
||||
$(tooltipele).hide();
|
||||
$(tooltipele).attr('aria-hidden', 'true');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Listener for focus events.
|
||||
* @param {Event} e
|
||||
*/
|
||||
Tooltip.prototype._handleFocus = function(e) {
|
||||
this._showTooltip(e);
|
||||
};
|
||||
|
||||
/**
|
||||
* Listener for keydown events.
|
||||
* @param {Event} e
|
||||
*/
|
||||
Tooltip.prototype._handleKeyDown = function(e) {
|
||||
if (e.which == 27) {
|
||||
this._hideTooltip(e);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Listener for mouseover events.
|
||||
* @param {Event} e
|
||||
*/
|
||||
Tooltip.prototype._handleMouseOver = function(e) {
|
||||
this._showTooltip(e);
|
||||
};
|
||||
|
||||
/**
|
||||
* Listener for mouseout events.
|
||||
* @param {Event} e
|
||||
*/
|
||||
Tooltip.prototype._handleMouseOut = function(e) {
|
||||
var triggerElement = $(e.target);
|
||||
|
||||
if (!triggerElement.is(":focus")) {
|
||||
this._hideTooltip(e);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Listener for blur events.
|
||||
* @param {Event} e
|
||||
*/
|
||||
Tooltip.prototype._handleBlur = function(e) {
|
||||
this._hideTooltip(e);
|
||||
};
|
||||
|
||||
return Tooltip;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue