add support for displaying languages that administrators understand on the support panel

pull/1/head
ansuz 5 years ago
parent eb9edcb6f1
commit 7970f5026b

@ -9,5 +9,7 @@ define(['/common/application_config_internal.js'], function (AppConfig) {
// Example: If you want to remove the survey link in the menu:
// AppConfig.surveyURL = "";
AppConfig.supportLanguages = [ 'en', 'fr' ]; // XXX
return AppConfig;
});

@ -11,6 +11,7 @@ define([
'/common/hyperscript.js',
'/support/ui.js',
'/api/config',
'/customize/application_config.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
@ -27,7 +28,8 @@ define([
Messages,
h,
Support,
ApiConfig
ApiConfig,
AppConfig
)
{
var APP = window.APP = {};
@ -41,6 +43,7 @@ define([
'cp-support-list',
],
'new': [
'cp-support-language',
'cp-support-form',
],
};
@ -132,6 +135,30 @@ define([
return $div;
};
create['language'] = function () {
if (!Array.isArray(AppConfig.supportLanguages)) { return $(h('div')); }
var languages = AppConfig.supportLanguages;
var list = h('li', languages
.map(function (lang) {
return Messages._languages[lang];
})
.filter(Boolean)
.map(function (lang) {
return h('li', lang);
})
);
var preamble = "This server's administrators speak the following languages:"; // XXX
var $div = $(
h('div.cp-support-language', [
preamble,
list,
])
);
return $div;
};
// Create a new tickets
create['form'] = function () {
var key = 'form';

Loading…
Cancel
Save