Make it easier to open a ticket

pull/1/head
yflory 4 years ago
parent 687bb36e0e
commit b1bf592265

@ -126,6 +126,7 @@
.cp-support-collapse { .cp-support-collapse {
display: none; display: none;
} }
cursor: pointer;
} }
.cp-support-list-ticket.cp-support-open { .cp-support-list-ticket.cp-support-open {
.cp-support-collapsed { .cp-support-collapsed {

@ -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 makeOpenButton = function ($ticket) {
var button = h('button.btn.btn-primary.cp-support-expand', Messages.admin_support_open); 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); var collapse = h('button.btn.cp-support-collapse', Messages.admin_support_collapse);
$(button).click(function () { $(button).click(function () {
$ticket.toggleClass('cp-support-open', true); $ticket.toggleClass('cp-support-open', true);
}); });
$(collapse).click(function () { addClickHandler($ticket);
$(collapse).click(function (e) {
$ticket.toggleClass('cp-support-open', false); $ticket.toggleClass('cp-support-open', false);
e.stopPropagation();
setTimeout(function () {
addClickHandler($ticket);
});
}); });
$ticket.find('.cp-support-title-buttons').prepend([button, collapse]); $ticket.find('.cp-support-title-buttons').prepend([button, collapse]);
$ticket.append(h('div.cp-support-collapsed')); $ticket.append(h('div.cp-support-collapsed'));
}; };
var updateTicketDetails = function ($ticket) { var updateTicketDetails = function ($ticket) {
console.log($ticket.find('.cp-support-message-from'));
var $first = $ticket.find('.cp-support-message-from').first(); var $first = $ticket.find('.cp-support-message-from').first();
var user = $first.find('span').first().html(); var user = $first.find('span').first().html();
var time = $first.find('.cp-support-message-time').text(); var time = $first.find('.cp-support-message-time').text();

@ -774,7 +774,8 @@ define([
$(originalBtn).show(); $(originalBtn).show();
}; };
$button.click(function () { $button.click(function (e) {
e.stopPropagation();
done(true); done(true);
}); });
@ -792,7 +793,8 @@ define([
to = setTimeout(todo, INTERVAL); 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 we have a validation function, continue only if it's true
if (config.validate && !config.validate()) { return; } if (config.validate && !config.validate()) { return; }
i = 1; i = 1;

Loading…
Cancel
Save