From b1bf592265fb935aa7879e7506889f66163a5fdc Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 15 Dec 2020 14:15:25 +0100 Subject: [PATCH] Make it easier to open a ticket --- www/admin/app-admin.less | 1 + www/admin/inner.js | 14 ++++++++++++-- www/common/common-interface.js | 6 ++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 1fe7a5699..fe9121090 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -126,6 +126,7 @@ .cp-support-collapse { display: none; } + cursor: pointer; } .cp-support-list-ticket.cp-support-open { .cp-support-collapsed { diff --git a/www/admin/inner.js b/www/admin/inner.js index c73fafa63..bf139a870 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -614,20 +614,30 @@ define([ }; }; + var addClickHandler = function ($ticket) { + $ticket.on('click', function () { + $ticket.toggleClass('cp-support-open', true); + $ticket.off('click'); + }); + }; var makeOpenButton = function ($ticket) { var button = h('button.btn.btn-primary.cp-support-expand', Messages.admin_support_open); var collapse = h('button.btn.cp-support-collapse', Messages.admin_support_collapse); $(button).click(function () { $ticket.toggleClass('cp-support-open', true); }); - $(collapse).click(function () { + addClickHandler($ticket); + $(collapse).click(function (e) { $ticket.toggleClass('cp-support-open', false); + e.stopPropagation(); + setTimeout(function () { + addClickHandler($ticket); + }); }); $ticket.find('.cp-support-title-buttons').prepend([button, collapse]); $ticket.append(h('div.cp-support-collapsed')); }; var updateTicketDetails = function ($ticket) { - console.log($ticket.find('.cp-support-message-from')); var $first = $ticket.find('.cp-support-message-from').first(); var user = $first.find('span').first().html(); var time = $first.find('.cp-support-message-time').text(); diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 3e9d848cd..bb84187b4 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -774,7 +774,8 @@ define([ $(originalBtn).show(); }; - $button.click(function () { + $button.click(function (e) { + e.stopPropagation(); done(true); }); @@ -792,7 +793,8 @@ define([ to = setTimeout(todo, INTERVAL); }; - $(originalBtn).addClass('cp-button-confirm-placeholder').click(function () { + $(originalBtn).addClass('cp-button-confirm-placeholder').click(function (e) { + e.stopPropagation(); // If we have a validation function, continue only if it's true if (config.validate && !config.validate()) { return; } i = 1;