mirror of
https://github.com/cosmocode/do.git
synced 2025-08-08 06:35:16 +00:00
Add Icon/Button to show user's open tasks
This shows an icon with the number of open tasks assigned to the user. If the user has open tasks and they click on the icon, they should see a table with all their open tasks. Another click on the icon hides the table. Known Issues: ------------- * If a task is check-off, the number next to the icon is not updated dynamically. SPR-962
This commit is contained in:
34
scripts/userTasksOverlay.js
Normal file
34
scripts/userTasksOverlay.js
Normal file
@ -0,0 +1,34 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var $userTasksButtons = jQuery('a.plugin__do_usertasks');
|
||||
$userTasksButtons.click(function handleUserTasksButtonClick(event) {
|
||||
var $this;
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
if (jQuery('.plugin__do_usertasks_list').length) {
|
||||
jQuery('.plugin__do_usertasks_list').toggle();
|
||||
return;
|
||||
}
|
||||
|
||||
$this = jQuery(this);
|
||||
|
||||
jQuery.get(
|
||||
DOKU_BASE + 'lib/exe/ajax.php',
|
||||
{
|
||||
call: 'plugin_do_userTasksOverlay',
|
||||
},
|
||||
).done(function showUserTasksOverlay(data) {
|
||||
var $wrapper = jQuery('<div class="plugin__do_usertasks_list"></div>');
|
||||
$wrapper.css({'display': 'inline-block', 'position': 'absolute'});
|
||||
$wrapper.append(jQuery(data.html));
|
||||
$wrapper.appendTo('#dokuwiki__header');
|
||||
$wrapper.position({
|
||||
my: 'middle top',
|
||||
at: 'right bottom',
|
||||
of: $this,
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
Reference in New Issue
Block a user