From 700031b3b70046bfddf5e0f92b789a4edaef3a7f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 16 Jan 2020 15:01:03 +0100 Subject: [PATCH] Elastic: Fix non-working folder subscription checkbox for newly added folders (#7174) --- CHANGELOG | 1 + program/js/app.js | 4 ++++ skins/elastic/ui.js | 14 ++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index badbdd156..bbfe41753 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ CHANGELOG Roundcube Webmail - Elastic: Fix bug where it was possible to switch editor mode when 'htmleditor' was in 'dont_override' (#7143) - Elastic: Fix text selection in recipient inputs (#7129) - Elastic: Fix missing Close button in "more recipients" dialog +- Elastic: Fix non-working folder subscription checkbox for newly added folders (#7174) - Fix so messages in threads with no root aren't displayed separately (#4999) - Fix regression where "Open in new window" action didn't work (#7155) - Fix PHP Warning: array_filter() expects parameter 1 to be array, null given in subscriptions_option plugin (#7165) diff --git a/program/js/app.js b/program/js/app.js index 93d11f9cd..d470fdccf 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -7598,6 +7598,10 @@ function rcube_webmail() if (row.scrollIntoView) row.scrollIntoView(false); + // Let skins to do their magic, e.g. Elastic will fix pretty checkbox + if (!refrow) + this.triggerEvent('clonerow', {row: row, id: id}); + return row; }; diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index da780a190..997a2af88 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -476,6 +476,7 @@ function rcube_elastic_ui() .addEventListener('googiespell_create', rcmail_popup_init) .addEventListener('setquota', update_quota) .addEventListener('enable-command', enable_command_handler) + .addEventListener('clonerow', pretty_checkbox_fix) .addEventListener('init', init); // Add styling for TinyMCE editor popups @@ -3429,6 +3430,19 @@ function rcube_elastic_ui() .parent().append(label); }; + /** + * Fix pretty checkbox input in a cloned element + */ + function pretty_checkbox_fix(params) + { + var id, input = $(params.row).find('input[id^=icochk]'); + + if (input.length) { + id = 'icochk' + (++env.checkboxes); + input.attr('id', id).next('label').attr('for', id); + } + }; + /** * Make select dropdowns pretty * TODO: searching, optgroup, [multiple], iPhone/iPad