From 3cdd4dde73314465f9e1dc002008ad15a1041e01 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 14 Jun 2021 13:42:33 +0200 Subject: [PATCH] Improve contetx menu in drive for forms --- www/common/drive-ui.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index b65e8ccf5..b8b734a8c 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -351,7 +351,7 @@ define([ h('li', h('a.cp-app-drive-context-openro.dropdown-item', { 'tabindex': '-1', 'data-icon': faReadOnly, - }, Messages.fc_open_ro)), + }, h('span.cp-text', Messages.fc_open_ro))), h('li', h('a.cp-app-drive-context-openincode.dropdown-item', { 'tabindex': '-1', 'data-icon': faOpenInCode, @@ -1646,6 +1646,20 @@ define([ } paths = getSelectedPaths($element); + + // Forms: change "Open (read-only)" to "Open (as participant)" + Messages.fc_open_formro = "Open (as participant)"; // XXX + $('.cp-app-drive-context-openro .cp-text').text(Messages.fc_open_ro); + if (paths.length === 1) { + var metadata = manager.getFileData(manager.find(paths[0].path)); + if (metadata.roHref) { + var parsed = Hash.parsePadUrl(metadata.roHref); + if (parsed.type === "form") { + $('.cp-app-drive-context-openro .cp-text').text(Messages.fc_open_formro); + } + } + } + } $contextMenu.attr('data-menu-type', type);