From a6bc845e398455d054c0f053dca651d34a10098d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 27 Dec 2017 14:28:37 +0100 Subject: [PATCH] Display hint to the user when using To/Cc/Bcc/vCard buttons and no contact is selected (#129) Also display an information message after attaching vCard in phone mode. --- skins/elastic/templates/compose.html | 1 + skins/elastic/ui.js | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/skins/elastic/templates/compose.html b/skins/elastic/templates/compose.html index 24bd63b10..bbb6522a1 100644 --- a/skins/elastic/templates/compose.html +++ b/skins/elastic/templates/compose.html @@ -1,6 +1,7 @@ +

diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index 35449d53e..3d4d258d9 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -489,13 +489,22 @@ function rcube_elastic_ui() }); } - rcmail.addEventListener('fileappended', function(e) { if (e.attachment.complete) attachmentmenu_append(e.item); }) - .addEventListener('managesieve.insertrow', function(o) { bootstrap_style(o.obj); }) - .addEventListener('add-recipient', function() { - if (mode == 'phone') { - rcmail.display_message(rcmail.gettext('recipientsadded'), 'confirmation'); + var phone_confirmation = function(label) { + if (mode == 'phone') { + rcmail.display_message(rcmail.gettext(label), 'confirmation'); + } + }; + + rcmail.addEventListener('fileappended', function(e) { + if (e.attachment.complete) { + attachmentmenu_append(e.item); + if (e.attachment.mimetype == 'text/vcard' && rcmail.commands['attach-vcard']) { + phone_confirmation('vcard_attachments.vcardattached'); + } } - }); + }) + .addEventListener('managesieve.insertrow', function(o) { bootstrap_style(o.obj); }) + .addEventListener('add-recipient', function() { phone_confirmation('recipientsadded'); }); rcmail.init_pagejumper('.pagenav > input'); @@ -511,6 +520,12 @@ function rcube_elastic_ui() $("a.mode-html, button.attach").prop('disabled', e.active); $('a.button.attach, a.button.responses')[e.active ? 'addClass' : 'removeClass']('disabled'); }); + + $('.sidebar > .footer > a.button').click(function() { + if ($(this).is('.disabled')) { + rcmail.display_message(rcmail.gettext('nocontactselected'), 'warning'); + } + }); } // Append contact menu to all mailto: links