Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
c10ac8669c | |||
682cdfa95c | |||
0436d6e24a | |||
3e11c63e33 |
1
app.py
1
app.py
@ -331,6 +331,7 @@ def admin():
|
|||||||
photos=photos,
|
photos=photos,
|
||||||
accent_color=config["appearance"]["accent_color"],
|
accent_color=config["appearance"]["accent_color"],
|
||||||
config=config,
|
config=config,
|
||||||
|
nonce=g.csp_nonce,
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/admin/logout")
|
@app.route("/admin/logout")
|
||||||
|
@ -261,7 +261,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script nonce="{{ g.csp_nonce }}">
|
<script nonce="{{ nonce }}">
|
||||||
function makeEditable(element) {
|
function makeEditable(element) {
|
||||||
const value = element.textContent;
|
const value = element.textContent;
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
@ -284,7 +284,8 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function saveChanges(button) {
|
function saveChanges(event) {
|
||||||
|
const button = event.target;
|
||||||
const row = button.closest('tr');
|
const row = button.closest('tr');
|
||||||
const photoId = row.dataset.id;
|
const photoId = row.dataset.id;
|
||||||
const updatedData = {};
|
const updatedData = {};
|
||||||
@ -313,9 +314,9 @@
|
|||||||
alert('An error occurred while saving changes.');
|
alert('An error occurred while saving changes.');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function deletePhoto(event) {
|
||||||
function deletePhoto(button) {
|
|
||||||
if (confirm('Are you sure you want to delete this photo?')) {
|
if (confirm('Are you sure you want to delete this photo?')) {
|
||||||
|
const button = event.target;
|
||||||
const row = button.closest('tr');
|
const row = button.closest('tr');
|
||||||
const photoId = row.dataset.id;
|
const photoId = row.dataset.id;
|
||||||
|
|
||||||
@ -337,9 +338,9 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('delete-btn').addEventListener('click', deletePhoto);
|
document.getElementById('delete-btn').addEventListener('click', (event) => deletePhoto(event));
|
||||||
document.getElementById('save-btn').addEventListener('click', saveChanges);
|
document.getElementById('save-btn').addEventListener('click', (event) => saveChanges(event));
|
||||||
|
|
||||||
document.getElementById('profile_image_upload').addEventListener('change', async (e) => {
|
document.getElementById('profile_image_upload').addEventListener('change', async (e) => {
|
||||||
const file = e.target.files[0];
|
const file = e.target.files[0];
|
||||||
|
Reference in New Issue
Block a user