Make sure publicLink is populated even when nonexistent
This commit is contained in:
parent
6aab9f4ea1
commit
8775d03576
|
@ -56,13 +56,14 @@ export function renderLoginForm() {
|
||||||
export function renderMakePublic() {
|
export function renderMakePublic() {
|
||||||
const editSettingsTab = document.getElementById('editSettingsTab');
|
const editSettingsTab = document.getElementById('editSettingsTab');
|
||||||
const { isPublic } = window.currentDictionary.settings;
|
const { isPublic } = window.currentDictionary.settings;
|
||||||
|
const { externalID } = window.currentDictionary;
|
||||||
const editSettingsTabHTML = `<label>Make Public
|
const editSettingsTabHTML = `<label>Make Public
|
||||||
<input type="checkbox" id="editIsPublic"${isPublic ? ' checked' : ''}><br>
|
<input type="checkbox" id="editIsPublic"${isPublic ? ' checked' : ''}><br>
|
||||||
<small>Checking this box will make this public via a link you can share with others.</small>
|
<small>Checking this box will make this public via a link you can share with others.</small>
|
||||||
</label>
|
</label>
|
||||||
<p id="publicLinkDisplay" style="${!isPublic ? 'display:none;': ''}margin-left:20px;">
|
<p id="publicLinkDisplay" style="${!isPublic ? 'display:none;': ''}margin-left:20px;">
|
||||||
<strong>Public Link:</strong><br>
|
<strong>Public Link:</strong><br>
|
||||||
<input readonly id="publicLink" value="${window.location.href + window.currentDictionary.externalID.toString()}">
|
<input readonly id="publicLink" value="${window.location.href + (externalID ? externalID.toString() : '')}">
|
||||||
<a class="small button" id="publicLinkCopy">Copy</a>
|
<a class="small button" id="publicLinkCopy">Copy</a>
|
||||||
</p>
|
</p>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -100,6 +100,7 @@ export function uploadWholeDictionary(asNew = false) {
|
||||||
dictionary,
|
dictionary,
|
||||||
}, remoteId => {
|
}, remoteId => {
|
||||||
window.currentDictionary.externalID = remoteId;
|
window.currentDictionary.externalID = remoteId;
|
||||||
|
dictionary.getElementById('publicLink').value = window.location.href + remoteId.toString();
|
||||||
saveDictionary(false);
|
saveDictionary(false);
|
||||||
addMessage('Dictionary Uploaded Successfully');
|
addMessage('Dictionary Uploaded Successfully');
|
||||||
renderChangeDictionaryOptions();
|
renderChangeDictionaryOptions();
|
||||||
|
|
Loading…
Reference in New Issue