Improve 'Open in' context menu entry in the drive

pull/1/head
yflory 3 years ago
parent cf415e9f98
commit 0d12f1d75e

@ -335,14 +335,21 @@ define([
}; };
Messages.fc_openInSheet = "Edit in Sheet"; // XXX Messages.fc_openIn = "Open in {0}"; // XXX
Messages.fc_openInDoc = "Edit in Document"; // XXX // delete fc_openInCode // XXX
Messages.fc_openInPresentation = "Edit in Presentation"; // XXX
var createContextMenu = function (priv) { var createContextMenu = function (priv) {
// XXX PREMIUM // XXX PREMIUM
// XXX "Edit in Document" and "New Document" (and presentation) // XXX "Edit in Document" and "New Document" (and presentation)
var premiumP = Util.checkPremiumApp('presentation', AppConfig.premiumTypes, priv.plan, priv.loggedIn); var premiumP = Util.checkPremiumApp('presentation', AppConfig.premiumTypes, priv.plan, priv.loggedIn);
var premiumD = Util.checkPremiumApp('doc', AppConfig.premiumTypes, priv.plan, priv.loggedIn); var premiumD = Util.checkPremiumApp('doc', AppConfig.premiumTypes, priv.plan, priv.loggedIn);
var getOpenIn = function (app) {
var icon = AppConfig.applicationsIcon[app];
var cls = icon.indexOf('cptools') === 0 ? 'cptools '+icon : 'fa '+icon;
var html = '<i class="'+cls+'"></i>' + Messages.type[app];
console.error(html);
console.error(Messages._getKey('fc_openIn', [html]));
return Messages._getKey('fc_openIn', [html]);
};
var menu = h('div.cp-contextmenu.dropdown.cp-unselectable', [ var menu = h('div.cp-contextmenu.dropdown.cp-unselectable', [
h('ul.dropdown-menu', { h('ul.dropdown-menu', {
'role': 'menu', 'role': 'menu',
@ -362,22 +369,22 @@ define([
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faReadOnly, 'data-icon': faReadOnly,
}, h('span.cp-text', Messages.fc_open_ro))), }, h('span.cp-text', Messages.fc_open_ro))),
h('li', h('a.cp-app-drive-context-openincode.dropdown-item', { h('li', UI.setHTML(h('a.cp-app-drive-context-openincode.dropdown-item', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faOpenInCode, 'data-icon': 'fa-arrows',
}, Messages.fc_openInCode)), }), getOpenIn('code'))),
h('li', h('a.cp-app-drive-context-openinsheet.dropdown-item', { h('li', UI.setHTML(h('a.cp-app-drive-context-openinsheet.dropdown-item', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faOpenInSheet, 'data-icon': 'fa-arrows',
}, Messages.fc_openInSheet)), }), getOpenIn('sheet'))),
premiumD === -1 ? undefined : h('li', h('a.cp-app-drive-context-openindoc.dropdown-item' + (premiumD === 0 ? '.cp-app-disabled' : ''), { premiumD === -1 ? undefined : h('li', UI.setHTML(h('a.cp-app-drive-context-openindoc.dropdown-item' + (premiumD === 0 ? '.cp-app-disabled' : ''), {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faOpenInDoc, 'data-icon': 'fa-arrows',
}, Messages.fc_openInDoc)), }), getOpenIn('doc'))),
premiumP === -1 ? undefined : h('li', h('a.cp-app-drive-context-openinpresentation.dropdown-item' + (premiumP === 0 ? '.cp-app-disabled' : ''), { premiumP === -1 ? undefined : h('li', UI.setHTML(h('a.cp-app-drive-context-openinpresentation.dropdown-item' + (premiumP === 0 ? '.cp-app-disabled' : ''), {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': faOpenInPresentation, 'data-icon': 'fa-arrows',
}, Messages.fc_openInPresentation)), }), getOpenIn('presentation'))),
h('li', h('a.cp-app-drive-context-savelocal.dropdown-item', { h('li', h('a.cp-app-drive-context-savelocal.dropdown-item', {
'tabindex': '-1', 'tabindex': '-1',
'data-icon': 'fa-cloud-upload', 'data-icon': 'fa-cloud-upload',

Loading…
Cancel
Save