Support UI

pull/1/head
yflory 6 years ago
parent 2e8e6e6de2
commit 6fe76dd7f8

@ -3,6 +3,18 @@
@ticket-bg: #F7F7F7; @ticket-bg: #F7F7F7;
@msg-bg: #eee; @msg-bg: #eee;
@fromme-bg: #ddd; @fromme-bg: #ddd;
.cp-support-form-container {
[type="text"] {
width: @sidebar_button-width;
margin-bottom: 10px;
}
textarea {
width: 2*@sidebar_button-width;
max-width: 90%;
padding: 10px 15px;
height: 300px;
}
}
.cp-support-container { .cp-support-container {
.cp-support-list-ticket { .cp-support-list-ticket {
display: flex; display: flex;
@ -61,6 +73,10 @@
display: none !important; display: none !important;
} }
} }
button {
margin-left: 2px;
margin-right: 5px;
}
} }
} }
} }

@ -218,7 +218,7 @@ define([
displayed: displayed, displayed: displayed,
sfCommon: common, sfCommon: common,
$container: APP.$toolbar, $container: APP.$toolbar,
pageTitle: Messages.supportPage || 'Support', pageTitle: Messages.supportPage,
metadataMgr: common.getMetadataMgr(), metadataMgr: common.getMetadataMgr(),
}; };
APP.toolbar = Toolbar.create(configTb); APP.toolbar = Toolbar.create(configTb);
@ -239,7 +239,7 @@ define([
createToolbar(); createToolbar();
metadataMgr = common.getMetadataMgr(); metadataMgr = common.getMetadataMgr();
privateData = metadataMgr.getPrivateData(); privateData = metadataMgr.getPrivateData();
common.setTabTitle(Messages.supportPage || 'Support'); common.setTabTitle(Messages.supportPage);
APP.origin = privateData.origin; APP.origin = privateData.origin;
APP.readOnly = privateData.readOnly; APP.readOnly = privateData.readOnly;

@ -2,17 +2,11 @@ define([
'jquery', 'jquery',
'/api/config', '/api/config',
'/common/hyperscript.js', '/common/hyperscript.js',
'/common/common-interface.js',
'/common/common-hash.js', '/common/common-hash.js',
'/common/common-util.js', '/common/common-util.js',
'/customize/messages.js', '/customize/messages.js',
], function ($, ApiConfig, h, Hash, Util, Messages) { ], function ($, ApiConfig, h, UI, Hash, Util, Messages) {
var showError = function (form, msg) {
if (!msg) {
return void $(form).find('.cp-support-form-error').text('').hide();
}
$(form).find('.cp-support-form-error').text(msg).show();
};
var send = function (common, id, type, data, dest) { var send = function (common, id, type, data, dest) {
var supportKey = ApiConfig.supportMailbox; var supportKey = ApiConfig.supportMailbox;
@ -49,14 +43,12 @@ define([
var title = $title.val(); var title = $title.val();
if (!title) { if (!title) {
return void showError(form, Messages.support_formTitleError); return void UI.alert(Messages.support_formTitleError);
} }
var content = $content.val(); var content = $content.val();
if (!content) { if (!content) {
return void showError(form, Messages.support_formContentError); return void UI.alert(form, Messages.support_formContentError);
} }
// Success: hide any error
showError(form, null);
$content.val(''); $content.val('');
$title.val(''); $title.val('');
@ -80,14 +72,15 @@ define([
var content = [ var content = [
h('hr'), h('hr'),
h('div.cp-support-form-error'),
h('label' + (title ? '.cp-hidden' : ''), Messages.support_formTitle),
h('input.cp-support-form-title' + (title ? '.cp-hidden' : ''), { h('input.cp-support-form-title' + (title ? '.cp-hidden' : ''), {
placeholder: Messages.support_formTitle,
type: 'text',
value: title || '' value: title || ''
}), }),
cb ? undefined : h('br'), cb ? undefined : h('br'),
h('label', Messages.support_formMessage), h('textarea.cp-support-form-msg', {
h('textarea.cp-support-form-msg', { }), placeholder: Messages.support_formMessage
}),
h('hr'), h('hr'),
button, button,
cancel cancel
@ -104,7 +97,7 @@ define([
}; };
var makeTicket = function ($div, common, content, onHide) { var makeTicket = function ($div, common, content, onHide) {
var ticketTitle = content.id + ' - ' + content.title; var ticketTitle = content.title + ' (#' + content.id + ')';
var answer = h('button.btn.btn-primary.cp-support-answer', Messages.support_answer); var answer = h('button.btn.btn-primary.cp-support-answer', Messages.support_answer);
var close = h('button.btn.btn-danger.cp-support-close', Messages.support_close); var close = h('button.btn.btn-danger.cp-support-close', Messages.support_close);
var hide = h('button.btn.btn-danger.cp-support-hide', Messages.support_remove); var hide = h('button.btn.btn-danger.cp-support-hide', Messages.support_remove);

Loading…
Cancel
Save