MDL-48970 groups: Fix hover description on groups overview page

If a course exists within multiple groupings then the description
should display when you mouseover any instance of it on the overview
page.
This commit is contained in:
Andrew Hancox
2015-07-01 21:27:40 +01:00
parent d783a8fba7
commit 4d0d11b6d6
2 changed files with 17 additions and 20 deletions
+15 -18
View File
@@ -20,24 +20,21 @@ M.core_group.init_hover_events = function(Y, events) {
return overlay;
})();
// Iterate over the events and attach an event to display the description on
// hover
for (var id in events) {
var node = Y.one('#'+id);
if (node) {
node = node.ancestor();
node.on('mouseenter', function(e, content){
M.core_group.hoveroverlay.set('xy', [this.getX()+(this.get('offsetWidth')/2),this.getY()+this.get('offsetHeight')-5]);
M.core_group.hoveroverlay.set("bodyContent", content);
M.core_group.hoveroverlay.show();
M.core_group.hoveroverlay.get('boundingBox').setStyle('visibility', 'visible');
}, node, events[id]);
node.on('mouseleave', function(e){
M.core_group.hoveroverlay.hide();
M.core_group.hoveroverlay.get('boundingBox').setStyle('visibility', 'hidden');
}, node);
}
}
Y.all('.group_hoverdescription').each(function() {
var node = this.ancestor();
var id = this.getAttribute('data-groupid');
node.on('mouseenter', function(){
M.core_group.hoveroverlay.set('xy', [this.getX()+(this.get('offsetWidth')/2),this.getY()+this.get('offsetHeight')-5]);
M.core_group.hoveroverlay.set("bodyContent", events[id]);
M.core_group.hoveroverlay.show();
M.core_group.hoveroverlay.get('boundingBox').setStyle('visibility', 'visible');
});
node.on('mouseleave', function(){
M.core_group.hoveroverlay.hide();
M.core_group.hoveroverlay.get('boundingBox').setStyle('visibility', 'hidden');
});
});
};
M.core_group.init_index = function(Y, wwwroot, courseid) {
+2 -2
View File
@@ -186,8 +186,8 @@ foreach ($members as $gpgid=>$groupdata) {
if (empty($jsdescription)) {
$line[] = $name;
} else {
$line[] = html_writer::tag('span', $name, array('id'=>'group_'.$gpid));
$hoverevents['group_'.$gpid] = $jsdescription;
$line[] = html_writer::tag('span', $name, array('class' => 'group_hoverdescription', 'data-groupid' => $gpid));
$hoverevents[$gpid] = $jsdescription;
}
$fullnames = array();
foreach ($users as $user) {