(core) Fix warning bug in Save Copy dialog

Summary:
The warning about workspace write access would still be shown if
a user picked a workspace they had write access to, and cleared the
Name field in the Save Copy dialog. This fixes the condition for
showing the warning to not show it in this case, and adds a placeholder
to the Name field when it is blank.

Test Plan: Browser test.

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D3002
pull/12/head
George Gevoian 3 years ago
parent 3edb3a6826
commit 3d085ff2d7

@ -163,7 +163,7 @@ class SaveCopyModal extends Disposable {
return [
cssField(
cssLabel("Name"),
input(this._destName, {onInput: true}, dom.cls(cssInput.className),
input(this._destName, {onInput: true}, {placeholder: 'Enter document name'}, dom.cls(cssInput.className),
// modal dialog grabs focus after 10ms delay; so to focus this input, wait a bit longer
// (see the TODO in app/client/ui2018/modals.ts about weasel.js and focus).
(elem) => { setTimeout(() => { elem.focus(); }, 20); },
@ -204,10 +204,11 @@ class SaveCopyModal extends Disposable {
),
testId('copy-dest-workspace'),
),
wss ? dom.maybe(this._saveDisabled, () =>
cssWarningText("You do not have write access to the selected workspace",
testId('copy-warning')
)
wss ? dom.domComputed(this._destWS, (destWs) =>
destWs && !roles.canEdit(destWs.access) ?
cssWarningText("You do not have write access to the selected workspace",
testId('copy-warning')
) : null
) : null
]
),

Loading…
Cancel
Save