summaryrefslogtreecommitdiff
path: root/plugins/tasklist
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-01-14 08:27:48 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-01-14 08:27:48 (GMT)
commitb02e2c3b8f9ef6a63eba80f84432b33a00da95d1 (patch)
tree2333ceca52115502683a94330abcb7f86fef514b /plugins/tasklist
parent0a51ccd5a44882e84c0f14cf41e5c0bc790fb469 (diff)
downloadroundcubemail-plugins-kolab-b02e2c3b8f9ef6a63eba80f84432b33a00da95d1.tar.gz
- Store relation to message when creating event from email (#4161)
- Move common functions to libcalendaring - Assign dialog button classes directly
Diffstat (limited to 'plugins/tasklist')
-rw-r--r--plugins/tasklist/tasklist.js50
1 files changed, 12 insertions, 38 deletions
diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index ed1972e..acb7505 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -129,6 +129,7 @@ function rcube_tasklist_ui(settings)
var parse_datetime = this.parse_datetime;
var date2unixtime = this.date2unixtime;
var fromunixtime = this.fromunixtime;
+ var render_message_links = this.render_message_links;
/**
* initialize the tasks UI
@@ -597,6 +598,12 @@ function rcube_tasklist_ui(settings)
return false;
});
+ // register click handler for message delete buttons
+ $('#taskedit-links').on('click', 'li a.delete', function(e) {
+ remove_link(e.target);
+ return false;
+ });
+
// handle global document clicks: close popup menus
$(document.body).click(clear_popups);
@@ -1840,7 +1847,7 @@ function rcube_tasklist_ui(settings)
// build attachments list
$('#task-links').hide();
if ($.isArray(rec.links) && rec.links.length) {
- task_show_links(rec.links || [], $('#task-links').children('.task-text'));
+ render_message_links(rec.links || [], $('#task-links').children('.task-text'), false, 'tasklist');
$('#task-links').show();
}
@@ -2052,7 +2059,7 @@ function rcube_tasklist_ui(settings)
me.set_alarms_edit('#taskedit-alarms', action != 'new' && rec.valarms ? rec.valarms : []);
if ($.isArray(rec.links) && rec.links.length) {
- task_show_links(rec.links, $('#taskedit-links .task-text'), true);
+ render_message_links(rec.links, $('#taskedit-links .task-text'), true, 'tasklist');
$('#taskedit-links').show();
}
else {
@@ -2358,48 +2365,15 @@ function rcube_tasklist_ui(settings)
/**
*
*/
- function task_show_links(links, container, edit)
+ function remove_link(elem)
{
- var dellink, ul = $('<ul>').addClass('attachmentslist');
-
- $.each(links, function(i, link) {
- var li = $('<li>').addClass('link')
- .addClass('message eml')
- .append($('<a>')
- .attr('href', link.mailurl)
- .addClass('messagelink')
- .text(link.subject || link.uri)
- )
- .appendTo(ul);
-
- // add icon to remove the link
- if (edit) {
- $('<a>')
- .attr('href', '#delete')
- .attr('title', rcmail.gettext('removelink','tasklist'))
- .addClass('delete')
- .text(rcmail.gettext('delete'))
- .click({ uri:link.uri }, function(e) {
- remove_link(this, e.data.uri);
- return false;
- })
- .appendTo(li);
- }
- });
-
- container.empty().append(ul);
- }
+ var $elem = $(elem), uri = $elem.attr('data-uri');
- /**
- *
- */
- function remove_link(elem, uri)
- {
// remove the link item matching the given uri
me.selected_task.links = $.grep(me.selected_task.links, function(link) { return link.uri != uri; });
// remove UI list item
- $(elem).hide().closest('li').addClass('deleted');
+ $elem.hide().closest('li').addClass('deleted');
}
/**