First work to bring back Community Update functionality

This commit is contained in:
Patrick Jentsch
2023-10-24 16:11:08 +02:00
parent 965f2854b2
commit f4d3415c11
7 changed files with 154 additions and 155 deletions

View File

@ -8,7 +8,7 @@
<h1 id="title">{{ title }}</h1>
</div>
{# <div class="col s12 l4">
<div class="col s12 l4">
<h4>Profile Settings</h4>
<p>You can edit your public profile here and share it with other nopaque users.
Tell others about your (scientific) background so they can relate and network with you.
@ -112,7 +112,7 @@
</ul>
</div>
<div class="col s12"></div> #}
<div class="col s12"></div>
<div class="col s12 l4">
<h4>General Settings</h4>
@ -181,7 +181,7 @@
{% block modals %}
{{ super() }}
{# <div class="modal" id="delete-avatar-modal">
<div class="modal" id="delete-avatar-modal">
<div class="modal-content">
<h4>Confirm Avatar deletion</h4>
<p>Do you really want to delete <b>{{ user.username }}</b>s avatar?</p>
@ -190,7 +190,7 @@
<a class="btn modal-close waves-effect waves-light">Cancel</a>
<a class="btn modal-close red waves-effect waves-light" id="delete-avatar">Delete</a>
</div>
</div> #}
</div>
<div class="modal" id="delete-user-modal">
<div class="modal-content">
@ -212,7 +212,7 @@
{% block scripts %}
{{ super() }}
<script>
{# let avatarPreviewElement = document.querySelector('#update-avatar-form-avatar-preview');
let avatarPreviewElement = document.querySelector('#update-avatar-form-avatar-preview');
let avatarUploadElement = document.querySelector('#update-avatar-form-avatar');
avatarUploadElement.addEventListener('change', () => {
@ -221,16 +221,16 @@ avatarUploadElement.addEventListener('change', () => {
});
document.querySelector('#delete-avatar').addEventListener('click', () => {
requests.users.entity.avatar.delete({{ user.hashid|tojson }})
Requests.users.entity.avatar.delete({{ user.hashid|tojson }})
.then(
(response) => {
avatarPreviewElement.src = {{ url_for('static', filename='images/user_avatar.png')|tojson }};
}
);
}); #}
});
document.querySelector('#delete-user').addEventListener('click', (event) => {
requests.users.entity.delete({{ user.hashid|tojson }})
Requests.users.entity.delete({{ user.hashid|tojson }})
.then((response) => {window.location.href = '/';});
});
@ -251,11 +251,11 @@ for (let collapsibleElement of document.querySelectorAll('.collapsible.no-autoin
}
// #region Profile Privacy settings
{# let profileIsPublicSwitchElement = document.querySelector('#profile-is-public-switch');
let profileIsPublicSwitchElement = document.querySelector('#profile-is-public-switch');
let profilePrivacySettingCheckboxElements = document.querySelectorAll('.profile-privacy-setting-checkbox');
profileIsPublicSwitchElement.addEventListener('change', (event) => {
let newEnabled = profileIsPublicSwitchElement.checked;
requests.users.entity.settings.profilePrivacy.update({{ user.hashid|tojson }}, 'is-public', newEnabled)
Requests.users.entity.settings.profilePrivacy.update({{ user.hashid|tojson }}, 'is-public', newEnabled)
.then(
(response) => {
for (let profilePrivacySettingCheckboxElement of document.querySelectorAll('.profile-privacy-setting-checkbox')) {
@ -271,12 +271,12 @@ for (let profilePrivacySettingCheckboxElement of profilePrivacySettingCheckboxEl
profilePrivacySettingCheckboxElement.addEventListener('change', (event) => {
let newEnabled = profilePrivacySettingCheckboxElement.checked;
let valueName = profilePrivacySettingCheckboxElement.dataset.profilePrivacySettingName;
requests.users.entity.settings.profilePrivacy.update({{ user.hashid|tojson }}, valueName, newEnabled)
Requests.users.entity.settings.profilePrivacy.update({{ user.hashid|tojson }}, valueName, newEnabled)
.catch((response) => {
profilePrivacySettingCheckboxElement.checked = !newEnabled;
});
});
} #}
}
// #endregion Profile Privacy settings
</script>
{% endblock scripts %}