Only render MakePublic if logged in
This commit is contained in:
parent
b1140eebb7
commit
6b46eaa148
|
@ -286,10 +286,6 @@
|
||||||
<input type="checkbox" id="editSortByDefinition"><br>
|
<input type="checkbox" id="editSortByDefinition"><br>
|
||||||
<small>Checking this box will sort the words in alphabetical order based on the Definition instead of the Word.</small>
|
<small>Checking this box will sort the words in alphabetical order based on the Definition instead of the Word.</small>
|
||||||
</label>
|
</label>
|
||||||
<label>Make Public
|
|
||||||
<input type="checkbox" id="editIsPublic"><br>
|
|
||||||
<small>Checking this box will make this public via a link you can share with others.</small>
|
|
||||||
</label>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="editActionsTab" style="display:none;">
|
<section id="editActionsTab" style="display:none;">
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { request } from "./helpers";
|
||||||
import { saveToken } from "./utilities";
|
import { saveToken } from "./utilities";
|
||||||
import { addMessage } from "../utilities";
|
import { addMessage } from "../utilities";
|
||||||
import { setupLogoutButton } from "./setupListeners";
|
import { setupLogoutButton } from "./setupListeners";
|
||||||
import { renderAccountSettings, renderAccountActions } from "./render";
|
import { renderAccountSettings, renderAccountActions, renderMakePublic } from "./render";
|
||||||
import { uploadWholeDictionary, syncDictionary } from "./sync";
|
import { uploadWholeDictionary, syncDictionary } from "./sync";
|
||||||
import { setCookie } from "../StackOverflow/cookie";
|
import { setCookie } from "../StackOverflow/cookie";
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ export function triggerLoginChanges() {
|
||||||
loginButton.parentElement.removeChild(loginButton);
|
loginButton.parentElement.removeChild(loginButton);
|
||||||
setupLogoutButton(logoutButton);
|
setupLogoutButton(logoutButton);
|
||||||
|
|
||||||
|
renderMakePublic();
|
||||||
renderAccountSettings();
|
renderAccountSettings();
|
||||||
renderAccountActions();
|
renderAccountActions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,16 @@ export function renderLoginForm() {
|
||||||
setupLoginModal(loginModal);
|
setupLoginModal(loginModal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function renderMakePublic() {
|
||||||
|
const editSettingsTab = document.getElementById('editSettingsTab');
|
||||||
|
const editSettingsTabHTML = `<label>Make Public
|
||||||
|
<input type="checkbox" id="editIsPublic"><br>
|
||||||
|
<small>Checking this box will make this public via a link you can share with others.</small>
|
||||||
|
</label>
|
||||||
|
`;
|
||||||
|
editSettingsTab.innerHTML += editSettingsTabHTML;
|
||||||
|
}
|
||||||
|
|
||||||
export function renderAccountSettings() {
|
export function renderAccountSettings() {
|
||||||
const accountSettingsColumn = document.getElementById('accountSettings');
|
const accountSettingsColumn = document.getElementById('accountSettings');
|
||||||
const accountSettingsHTML = `<h3>Account Settings</h3>
|
const accountSettingsHTML = `<h3>Account Settings</h3>
|
||||||
|
|
|
@ -35,7 +35,9 @@ export function openEditModal() {
|
||||||
document.getElementById('editCaseSensitive').checked = caseSensitive;
|
document.getElementById('editCaseSensitive').checked = caseSensitive;
|
||||||
if (allowDuplicates) document.getElementById('editCaseSensitive').disabled = true;
|
if (allowDuplicates) document.getElementById('editCaseSensitive').disabled = true;
|
||||||
document.getElementById('editSortByDefinition').checked = sortByDefinition;
|
document.getElementById('editSortByDefinition').checked = sortByDefinition;
|
||||||
|
if (hasToken()) {
|
||||||
document.getElementById('editIsPublic').checked = isPublic;
|
document.getElementById('editIsPublic').checked = isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById('editModal').style.display = '';
|
document.getElementById('editModal').style.display = '';
|
||||||
}
|
}
|
||||||
|
@ -61,7 +63,11 @@ export function saveEditModal() {
|
||||||
window.currentDictionary.settings.caseSensitive = document.getElementById('editCaseSensitive').checked;
|
window.currentDictionary.settings.caseSensitive = document.getElementById('editCaseSensitive').checked;
|
||||||
const needsReSort = window.currentDictionary.settings.sortByDefinition !== document.getElementById('editSortByDefinition').checked;
|
const needsReSort = window.currentDictionary.settings.sortByDefinition !== document.getElementById('editSortByDefinition').checked;
|
||||||
window.currentDictionary.settings.sortByDefinition = document.getElementById('editSortByDefinition').checked;
|
window.currentDictionary.settings.sortByDefinition = document.getElementById('editSortByDefinition').checked;
|
||||||
|
if (hasToken()) {
|
||||||
window.currentDictionary.settings.isPublic = document.getElementById('editIsPublic').checked;
|
window.currentDictionary.settings.isPublic = document.getElementById('editIsPublic').checked;
|
||||||
|
} else {
|
||||||
|
window.currentDictionary.settings.isPublic = false;
|
||||||
|
}
|
||||||
|
|
||||||
addMessage('Saved ' + window.currentDictionary.specification + ' Successfully');
|
addMessage('Saved ' + window.currentDictionary.specification + ' Successfully');
|
||||||
saveDictionary();
|
saveDictionary();
|
||||||
|
|
Loading…
Reference in New Issue