prototype info menu

pull/1/head
ansuz 5 years ago
parent e0f796fba0
commit 704557fb2e

@ -2255,6 +2255,80 @@ define([
return $container; return $container;
}; };
UIElements.displayInfoMenu = function (Common, metadataMgr) {
var padType = metadataMgr.getMetadata().type;
var priv = metadataMgr.getPrivateData();
var origin = priv.origin;
Messages.help_faq = "Review our list of frequently asked questions"; // XXX
var faqLine = h('p',
h('a', {
target: '_blank',
rel: 'noreferrer noopener',
href: origin + '/faq.html',
}, Messages.help_faq)
);
var supportLine;
if (padType === 'support' || !Config.supportMailbox) {
// do nothing
} else if (priv.accountName) {
// registered users can submit support tickets
Messages.help_support = "Submit a support ticket"; // XXX
supportLine = h('p', [
h('a', {
target: '_blank',
rel: 'noreferrer noopener',
href: origin + '/support/',
}, Messages.help_support)
]);
} else {
// register to submit support tickets
Messages.help_supportRegisteredOnly = "Registered users can submit support tickets"; // XXX
var login = h('button', Messages.login_login);
$(login).click(function () {
Common.setLoginRedirect(function () {
Common.gotoURL('/login/');
});
});
var register = h('button', Messages.login_register);
$(register).click(function () {
Common.setLoginRedirect(function () {
Common.gotoURL('/register/');
});
});
supportLine = h('span', [
Messages.help_supportRegisteredOnly,
h('div', [
login,
register,
])
]);
}
var content = h('div', [
// CryptPad version number
h('h6', Pages.versionString),
// First point users to our FAQ
faqLine,
// Link to the support ticket form in case their
// question isn't answered by the FAQ
supportLine,
]);
var buttons = [
{
className: 'primary',
name: Messages.filePicker_close,
onClick: function () {},
keys: [27],
},
];
var modal = UI.dialog.customModal(content, {buttons: buttons });
UI.openCustomModal(modal);
};
UIElements.createUserAdminMenu = function (Common, config) { UIElements.createUserAdminMenu = function (Common, config) {
var metadataMgr = Common.getMetadataMgr(); var metadataMgr = Common.getMetadataMgr();
@ -2366,7 +2440,6 @@ define([
}, },
}); });
} }
options.push({ tag: 'hr' });
// Add administration panel link if the user is an admin // Add administration panel link if the user is an admin
if (priv.edPublic && Array.isArray(Config.adminKeys) && Config.adminKeys.indexOf(priv.edPublic) !== -1) { if (priv.edPublic && Array.isArray(Config.adminKeys) && Config.adminKeys.indexOf(priv.edPublic) !== -1) {
options.push({ options.push({
@ -2382,20 +2455,6 @@ define([
}, },
}); });
} }
if (padType !== 'support' && accountName && Config.supportMailbox) {
options.push({
tag: 'a',
attributes: {'class': 'cp-toolbar-menu-support fa fa-life-ring'},
content: h('span', Messages.supportPage || 'Support'),
action: function () {
if (padType) {
window.open(origin+'/support/');
} else {
window.parent.location = origin+'/support/';
}
},
});
}
options.push({ tag: 'hr' }); options.push({ tag: 'hr' });
if (Config.allowSubscriptions) { if (Config.allowSubscriptions) {
options.push({ options.push({
@ -2435,8 +2494,7 @@ define([
}, },
}); });
} }
if (Pages.versionString) { Messages.user_about = 'About CryptPad'; // XXX
Messages.user_about = Messages.about; // XXX "About CryptPad"
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: { attributes: {
@ -2444,11 +2502,9 @@ define([
}, },
content: h('span', Messages.user_about), content: h('span', Messages.user_about),
action: function () { action: function () {
// XXX UIElements.createHelpButton UIElements.displayInfoMenu(Common, metadataMgr);
UI.alert(Pages.versionString);
}, },
}); });
}
options.push({ tag: 'hr' }); options.push({ tag: 'hr' });
// Add login or logout button depending on the current status // Add login or logout button depending on the current status

Loading…
Cancel
Save