fix category notice display logic

pull/1/head
ansuz 3 years ago
parent 8db8250865
commit 1d93d4c45a

@ -188,7 +188,7 @@ Messages.support_formCategoryError = "Please select a ticket category from the d
abuse: Pages.customURLs.terms, abuse: Pages.customURLs.terms,
}; };
var makeForm = function (ctx, cb, title) { var makeForm = function (ctx, cb, title, hideNotice) {
var button; var button;
if (typeof(cb) === "function") { if (typeof(cb) === "function") {
@ -203,7 +203,11 @@ Messages.support_formCategoryError = "Please select a ticket category from the d
value: '' value: ''
}); });
var catContainer = h('div.cp-dropdown-container' + (title ? '.cp-hidden': '')); var catContainer = h('div.cp-dropdown-container' + (title ? '.cp-hidden': ''));
var notice = h('div.alert.alert-info', Messages.support_warning_prompt); var notice;
if (!(hideNotice || ctx.isAdmin)) {
notice = h('div.alert.alert-info', Messages.support_warning_prompt);
}
var clickHandler = function (ev) { var clickHandler = function (ev) {
ev.preventDefault(); ev.preventDefault();
var $link = $(this); var $link = $(this);
@ -214,6 +218,7 @@ Messages.support_formCategoryError = "Please select a ticket category from the d
makeCategoryDropdown(ctx, catContainer, function (key) { makeCategoryDropdown(ctx, catContainer, function (key) {
$(category).val(key); $(category).val(key);
if (!notice) { return; }
//console.log(key); //console.log(key);
// Msg.support_warning_abuse.support_warning_account.support_warning_bug.support_warning_document.support_warning_drives.support_warning_other // Msg.support_warning_abuse.support_warning_account.support_warning_bug.support_warning_document.support_warning_drives.support_warning_other
var warning = Messages['support_warning_' + key] || ''; var warning = Messages['support_warning_' + key] || '';
@ -373,13 +378,14 @@ Messages.support_formCategoryError = "Please select a ticket category from the d
$(answer).click(function () { $(answer).click(function () {
$ticket.find('.cp-support-form-container').remove(); $ticket.find('.cp-support-form-container').remove();
$(actions).hide(); $(actions).hide();
var hideNotice = true;
var form = makeForm(ctx, function () { var form = makeForm(ctx, function () {
var sent = sendForm(ctx, content.id, form, content.sender); var sent = sendForm(ctx, content.id, form, content.sender);
if (sent) { if (sent) {
$(actions).css('display', ''); $(actions).css('display', '');
$(form).remove(); $(form).remove();
} }
}, content.title); }, content.title, hideNotice);
$ticket.append(form); $ticket.append(form);
}); });
@ -507,8 +513,8 @@ Messages.support_formCategoryError = "Please select a ticket category from the d
ui.sendForm = function (id, form, dest) { ui.sendForm = function (id, form, dest) {
return sendForm(ctx, id, form, dest); return sendForm(ctx, id, form, dest);
}; };
ui.makeForm = function (cb, title) { ui.makeForm = function (cb, title, hideNotice) {
return makeForm(ctx, cb, title); return makeForm(ctx, cb, title, hideNotice);
}; };
ui.makeCategoryDropdown = function (container, onChange, all) { ui.makeCategoryDropdown = function (container, onChange, all) {
return makeCategoryDropdown(ctx, container, onChange, all); return makeCategoryDropdown(ctx, container, onChange, all);

Loading…
Cancel
Save