2022-11-30 13:36:42 +00:00
|
|
|
|
{% extends "base.html.j2" %}
|
2024-05-04 12:41:40 +00:00
|
|
|
|
{% import "wtf.html.j2" as wtf %}
|
2022-11-30 13:36:42 +00:00
|
|
|
|
|
|
|
|
|
{% block page_content %}
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="section container">
|
2022-11-30 13:36:42 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s12">
|
2022-12-05 08:40:02 +00:00
|
|
|
|
<h1 id="title">{{ title }}</h1>
|
|
|
|
|
</div>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
|
2023-10-24 14:11:08 +00:00
|
|
|
|
<div class="col s12 l4">
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<h4>Profile Settings</h4>
|
2024-11-19 14:28:43 +00:00
|
|
|
|
<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.
|
2023-04-12 14:49:04 +00:00
|
|
|
|
You can also set what should not be visible.</p>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</div>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<div class="col s12 l8">
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<br>
|
2023-03-23 16:42:51 +00:00
|
|
|
|
<ul class="collapsible no-autoinit settings-collapsible">
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<li>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;">
|
2023-04-11 13:03:12 +00:00
|
|
|
|
<span>Privacy</span>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<i class="material-icons caret">keyboard_arrow_right</i>
|
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="collapsible-body">
|
2024-05-03 13:08:57 +00:00
|
|
|
|
<div class="clearfix">
|
2023-04-11 13:03:12 +00:00
|
|
|
|
<p class="left"><i class="material-icons">public</i></p>
|
2024-05-03 13:08:57 +00:00
|
|
|
|
<p class="left ml-1">
|
2023-04-11 13:03:12 +00:00
|
|
|
|
Public status<br>
|
|
|
|
|
<span class="light">Choose whether your profile is visible to other users.</span>
|
|
|
|
|
</p>
|
|
|
|
|
<div class="switch right">
|
|
|
|
|
<label>
|
|
|
|
|
<input {% if user.is_public %}checked{% endif %} id="profile-is-public-switch" type="checkbox">
|
|
|
|
|
<span class="lever"></span>
|
|
|
|
|
</label>
|
2023-03-27 08:22:43 +00:00
|
|
|
|
</div>
|
2023-04-11 13:03:12 +00:00
|
|
|
|
</div>
|
2024-05-03 13:08:57 +00:00
|
|
|
|
<div class="clearfix">
|
2023-04-11 13:03:12 +00:00
|
|
|
|
<p class="left"><i class="material-icons">badge</i></p>
|
2024-05-03 13:08:57 +00:00
|
|
|
|
<p class="left ml-1">
|
2023-04-11 13:03:12 +00:00
|
|
|
|
Public data<br>
|
|
|
|
|
<span class="light">Choose which data is visible on your profile.</span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row" style="margin-left: 24px;">
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<div class="col s12 l3">
|
|
|
|
|
<label>
|
|
|
|
|
<input {% if user.has_profile_privacy_setting('SHOW_EMAIL') %}checked{% endif %} class="profile-privacy-setting-checkbox" data-profile-privacy-setting-name="SHOW_EMAIL" {% if not user.is_public %}disabled{% endif %} type="checkbox">
|
|
|
|
|
<span>Email</span>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col s12 l3">
|
|
|
|
|
<label>
|
|
|
|
|
<input {% if user.has_profile_privacy_setting('SHOW_LAST_SEEN') %}checked{% endif %} class="profile-privacy-setting-checkbox" data-profile-privacy-setting-name="SHOW_LAST_SEEN" {% if not user.is_public %}disabled{% endif %} type="checkbox">
|
|
|
|
|
<span>Last seen</span>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col s12 l3">
|
|
|
|
|
<label>
|
|
|
|
|
<input {% if user.has_profile_privacy_setting('SHOW_MEMBER_SINCE') %}checked{% endif %} class="profile-privacy-setting-checkbox" data-profile-privacy-setting-name="SHOW_MEMBER_SINCE" {% if not user.is_public %}disabled{% endif %} type="checkbox">
|
|
|
|
|
<span>Member since</span>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;">
|
2023-04-11 13:03:12 +00:00
|
|
|
|
<span>Information</span>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<i class="material-icons caret">keyboard_arrow_right</i>
|
|
|
|
|
</div>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<form method="POST">
|
|
|
|
|
{{ update_profile_information_form.hidden_tag() }}
|
|
|
|
|
{{ wtf.render_field(update_profile_information_form.full_name, material_icon='badge') }}
|
|
|
|
|
{{ wtf.render_field(update_profile_information_form.about_me, material_icon='description', id='about-me-textfield') }}
|
|
|
|
|
{{ wtf.render_field(update_profile_information_form.website, material_icon='laptop') }}
|
|
|
|
|
{{ wtf.render_field(update_profile_information_form.organization, material_icon='business') }}
|
|
|
|
|
{{ wtf.render_field(update_profile_information_form.location, material_icon='location_on') }}
|
|
|
|
|
<div class="right-align">
|
|
|
|
|
{{ wtf.render_field(update_profile_information_form.submit, material_icon='send') }}
|
2024-11-19 14:28:43 +00:00
|
|
|
|
</div>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;">
|
|
|
|
|
<span>Avatar</span>
|
|
|
|
|
<i class="material-icons caret">keyboard_arrow_right</i>
|
|
|
|
|
</div>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<form method="POST" enctype="multipart/form-data">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
{{ update_avatar_form.hidden_tag() }}
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<div class="row">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<div class="col s12 l2">
|
|
|
|
|
<img src="{{ url_for('users.user_avatar', user_id=user.id) }}" alt="Avatar" class="circle responsive-img" id="update-avatar-form-avatar-preview">
|
2023-03-17 14:56:37 +00:00
|
|
|
|
</div>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<div class="col s12 l10">
|
|
|
|
|
<br class="hide-on-med-and-down">
|
|
|
|
|
{{ wtf.render_field(update_avatar_form.avatar, accept='image/jpeg, image/png, image/gif', placeholder='Choose a JPEG or PNG file') }}
|
2023-03-17 14:56:37 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="right-align">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<a class="btn red waves-effect waves-light modal-trigger" href="#delete-avatar-modal"><i class="material-icons left">delete</i>Delete</a>
|
|
|
|
|
{{ wtf.render_field(update_avatar_form.submit, material_icon='send') }}
|
2024-11-19 14:28:43 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</form>
|
2022-11-30 13:36:42 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
|
2023-10-24 14:11:08 +00:00
|
|
|
|
<div class="col s12"></div>
|
2023-04-04 06:44:25 +00:00
|
|
|
|
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<div class="col s12 l4">
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<h4>General Settings</h4>
|
2024-11-19 14:28:43 +00:00
|
|
|
|
<p>Make general changes to your profile here. You can change your password,
|
2023-04-12 14:49:04 +00:00
|
|
|
|
username or email address, delete your profile and customize your notifications.</p>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</div>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<div class="col s12 l8">
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<br>
|
2023-03-23 16:42:51 +00:00
|
|
|
|
<ul class="collapsible no-autoinit settings-collapsible">
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<li>
|
2023-03-15 11:46:17 +00:00
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;">
|
2023-03-27 08:22:43 +00:00
|
|
|
|
<span>Account</span>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<i class="caret material-icons">keyboard_arrow_right</i>
|
2023-03-27 08:22:43 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="collapsible-body">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<form method="POST">
|
|
|
|
|
{{ update_account_information_form.hidden_tag() }}
|
|
|
|
|
{{ wtf.render_field(update_account_information_form.username, material_icon='person') }}
|
|
|
|
|
{{ wtf.render_field(update_account_information_form.email, material_icon='email') }}
|
2023-03-27 08:22:43 +00:00
|
|
|
|
<div class="right-align">
|
2023-04-04 07:14:32 +00:00
|
|
|
|
<a class="btn red waves-effect waves-light modal-trigger" href="#delete-user-modal"><i class="material-icons left">delete</i>Delete</a>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
{{ wtf.render_field(update_account_information_form.submit, material_icon='send') }}
|
2023-03-27 08:22:43 +00:00
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<span>Change Password</span>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<i class="caret material-icons">keyboard_arrow_right</i>
|
2024-11-19 14:28:43 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<form method="POST">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
{{ update_password_form.hidden_tag() }}
|
|
|
|
|
{{ wtf.render_field(update_password_form.password, material_icon='vpn_key') }}
|
|
|
|
|
{{ wtf.render_field(update_password_form.new_password, material_icon='vpn_key') }}
|
|
|
|
|
{{ wtf.render_field(update_password_form.new_password_2, material_icon='vpn_key') }}
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="right-align">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
{{ wtf.render_field(update_password_form.submit, material_icon='send') }}
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</li>
|
|
|
|
|
<li>
|
2023-03-15 11:46:17 +00:00
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<span>Notifications</span>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
<i class="caret material-icons">keyboard_arrow_right</i>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<form method="POST">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
{{ update_notifications_form.hidden_tag() }}
|
|
|
|
|
{{ wtf.render_field(update_notifications_form.job_status_mail_notification_level, material_icon='notifications') }}
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="right-align">
|
2023-03-29 12:32:35 +00:00
|
|
|
|
{{ wtf.render_field(update_notifications_form.submit, material_icon='send') }}
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</li>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
</ul>
|
2022-11-30 13:36:42 +00:00
|
|
|
|
</div>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
|
|
|
|
|
{% block admin_settings %}{% endblock admin_settings %}
|
2022-11-30 13:36:42 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endblock page_content %}
|
2022-12-13 14:01:04 +00:00
|
|
|
|
|
2023-03-13 12:29:01 +00:00
|
|
|
|
{% block modals %}
|
2023-03-20 15:00:25 +00:00
|
|
|
|
{{ super() }}
|
2023-10-24 14:11:08 +00:00
|
|
|
|
<div class="modal" id="delete-avatar-modal">
|
2023-03-13 12:29:01 +00:00
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<h4>Confirm Avatar deletion</h4>
|
2023-03-23 16:42:51 +00:00
|
|
|
|
<p>Do you really want to delete <b>{{ user.username }}</b>’s avatar?</p>
|
2023-03-13 12:29:01 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<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>
|
2023-10-24 14:11:08 +00:00
|
|
|
|
</div>
|
2023-03-27 11:56:24 +00:00
|
|
|
|
|
2023-04-04 07:14:32 +00:00
|
|
|
|
<div class="modal" id="delete-user-modal">
|
2023-03-13 14:04:44 +00:00
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<h4>Confirm User deletion</h4>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<p>Do you really want to delete the User <b>{{ user.username }}</b>?</p>
|
|
|
|
|
<p>Deleting an account has the following effects:</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>All data (Jobs, Corpora, ...) associated with the account will be permanently deleted.</li>
|
|
|
|
|
<li>All settings will be permanently deleted.</li>
|
|
|
|
|
</ul>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<a class="btn modal-close waves-effect waves-light">Cancel</a>
|
2023-03-29 12:32:35 +00:00
|
|
|
|
<a class="btn modal-close red waves-effect waves-light" id="delete-user">Delete</a>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-03-13 12:29:01 +00:00
|
|
|
|
{% endblock modals %}
|
2023-03-14 12:32:32 +00:00
|
|
|
|
|
|
|
|
|
{% block scripts %}
|
|
|
|
|
{{ super() }}
|
|
|
|
|
<script>
|
2023-10-24 14:11:08 +00:00
|
|
|
|
let avatarPreviewElement = document.querySelector('#update-avatar-form-avatar-preview');
|
2023-03-29 12:32:35 +00:00
|
|
|
|
let avatarUploadElement = document.querySelector('#update-avatar-form-avatar');
|
2023-03-14 12:32:32 +00:00
|
|
|
|
|
2023-03-23 16:42:51 +00:00
|
|
|
|
avatarUploadElement.addEventListener('change', () => {
|
|
|
|
|
let file = avatarUploadElement.files[0];
|
2023-03-29 12:32:35 +00:00
|
|
|
|
avatarPreviewElement.src = URL.createObjectURL(file);
|
2023-03-14 12:32:32 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-04-04 07:14:32 +00:00
|
|
|
|
document.querySelector('#delete-avatar').addEventListener('click', () => {
|
2023-11-09 13:29:01 +00:00
|
|
|
|
nopaque.requests.users.entity.avatar.delete({{ user.hashid|tojson }})
|
2023-03-14 12:32:32 +00:00
|
|
|
|
.then(
|
|
|
|
|
(response) => {
|
2023-03-29 12:32:35 +00:00
|
|
|
|
avatarPreviewElement.src = {{ url_for('static', filename='images/user_avatar.png')|tojson }};
|
2023-03-14 12:32:32 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
2023-10-24 14:11:08 +00:00
|
|
|
|
});
|
2023-03-14 12:32:32 +00:00
|
|
|
|
|
2023-03-29 12:32:35 +00:00
|
|
|
|
document.querySelector('#delete-user').addEventListener('click', (event) => {
|
2023-11-09 13:29:01 +00:00
|
|
|
|
nopaque.requests.users.entity.delete({{ user.hashid|tojson }})
|
2023-03-14 12:32:32 +00:00
|
|
|
|
.then((response) => {window.location.href = '/';});
|
|
|
|
|
});
|
2023-03-15 11:46:17 +00:00
|
|
|
|
|
2023-03-23 16:42:51 +00:00
|
|
|
|
for (let collapsibleElement of document.querySelectorAll('.collapsible.no-autoinit.settings-collapsible')) {
|
2023-03-15 11:46:17 +00:00
|
|
|
|
M.Collapsible.init(
|
2023-03-23 16:42:51 +00:00
|
|
|
|
collapsibleElement,
|
2023-03-15 11:46:17 +00:00
|
|
|
|
{
|
2023-03-23 16:42:51 +00:00
|
|
|
|
onOpenStart: (collapsibleItemElement) => {
|
|
|
|
|
let caret = collapsibleItemElement.querySelector('.caret');
|
2023-03-15 11:46:17 +00:00
|
|
|
|
caret.innerHTML = 'keyboard_arrow_down';
|
|
|
|
|
},
|
2023-03-23 16:42:51 +00:00
|
|
|
|
onCloseStart: (collapsibleItemElement) => {
|
|
|
|
|
let caret = collapsibleItemElement.querySelector('.caret');
|
2023-03-15 11:46:17 +00:00
|
|
|
|
caret.innerHTML = 'keyboard_arrow_right';
|
|
|
|
|
}
|
2023-03-23 16:42:51 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-03-15 11:46:17 +00:00
|
|
|
|
|
2023-03-27 11:56:24 +00:00
|
|
|
|
// #region Profile Privacy settings
|
2023-10-24 14:11:08 +00:00
|
|
|
|
let profileIsPublicSwitchElement = document.querySelector('#profile-is-public-switch');
|
2023-03-27 11:56:24 +00:00
|
|
|
|
let profilePrivacySettingCheckboxElements = document.querySelectorAll('.profile-privacy-setting-checkbox');
|
2023-03-17 14:56:37 +00:00
|
|
|
|
profileIsPublicSwitchElement.addEventListener('change', (event) => {
|
2023-04-03 13:25:55 +00:00
|
|
|
|
let newEnabled = profileIsPublicSwitchElement.checked;
|
2023-11-09 13:29:01 +00:00
|
|
|
|
nopaque.requests.users.entity.settings.profilePrivacy.update({{ user.hashid|tojson }}, 'is-public', newEnabled)
|
2023-03-27 11:56:24 +00:00
|
|
|
|
.then(
|
|
|
|
|
(response) => {
|
|
|
|
|
for (let profilePrivacySettingCheckboxElement of document.querySelectorAll('.profile-privacy-setting-checkbox')) {
|
2023-04-03 13:25:55 +00:00
|
|
|
|
profilePrivacySettingCheckboxElement.disabled = !newEnabled;
|
2023-03-27 11:56:24 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
(response) => {
|
2023-04-03 13:25:55 +00:00
|
|
|
|
profileIsPublicSwitchElement.checked = !newEnabled;
|
2023-03-27 11:56:24 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
2023-03-17 14:56:37 +00:00
|
|
|
|
});
|
2023-03-27 11:56:24 +00:00
|
|
|
|
for (let profilePrivacySettingCheckboxElement of profilePrivacySettingCheckboxElements) {
|
|
|
|
|
profilePrivacySettingCheckboxElement.addEventListener('change', (event) => {
|
|
|
|
|
let newEnabled = profilePrivacySettingCheckboxElement.checked;
|
|
|
|
|
let valueName = profilePrivacySettingCheckboxElement.dataset.profilePrivacySettingName;
|
2023-11-09 13:29:01 +00:00
|
|
|
|
nopaque.requests.users.entity.settings.profilePrivacy.update({{ user.hashid|tojson }}, valueName, newEnabled)
|
2023-03-27 11:56:24 +00:00
|
|
|
|
.catch((response) => {
|
|
|
|
|
profilePrivacySettingCheckboxElement.checked = !newEnabled;
|
|
|
|
|
});
|
|
|
|
|
});
|
2023-10-24 14:11:08 +00:00
|
|
|
|
}
|
2023-03-27 11:56:24 +00:00
|
|
|
|
// #endregion Profile Privacy settings
|
2023-03-14 12:32:32 +00:00
|
|
|
|
</script>
|
|
|
|
|
{% endblock scripts %}
|