Skip to content

Commit

Permalink
MBS-8690: Show user fullname in tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-csg committed Feb 3, 2024
1 parent 9b283d9 commit bb6988d
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
11 changes: 11 additions & 0 deletions amd/build/tooltip.min.js

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

1 change: 1 addition & 0 deletions amd/build/tooltip.min.js.map

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

38 changes: 38 additions & 0 deletions amd/src/tooltip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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/>.

import $ from 'jquery';

/**
* Show tooltip on click.
*
* @module mod_kanban/tooltip
* @copyright 2023-2024, ISB Bayern
* @author Stefan Hanauska <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Show the tooltip for two seconds after click.
* @param {*} id Id of the element
*/
export const addTooltipClickListener = function(id) {
document.getElementById(id).addEventListener('click', function() {
$('#' + id).tooltip('show');
setTimeout(function() {
$('#' + id).tooltip('hide');
}, 2000);
});
};
9 changes: 7 additions & 2 deletions templates/user.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"userpicture": ""
}
}}
<div id="mod_kanban_assignee-{{cardid}}-{{id}}" class="mod_kanban_assigned_user btn btn-icon icon-no-margin p-0" data-id="{{cardid}}" data-userid="{{id}}" title="{{fullname}}">
<div id="mod_kanban_assignee-{{cardid}}-{{id}}" class="mod_kanban_assigned_user btn btn-icon icon-no-margin p-0" data-id="{{cardid}}" data-userid="{{id}}" title="{{fullname}}" data-toggle="tooltip" data-placement="top">
{{{userpicture}}}
</div>
</div>
{{#js}}
require(['mod_kanban/tooltip'], function(tooltip) {
tooltip.addTooltipClickListener('mod_kanban_assignee-{{cardid}}-{{id}}');
});
{{/js}}

0 comments on commit bb6988d

Please sign in to comment.