2022-11-30 13:36:42 +00:00
|
|
|
|
{% extends "base.html.j2" %}
|
|
|
|
|
{% import "materialize/wtf.html.j2" as wtf %}
|
|
|
|
|
|
|
|
|
|
{% 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-13 14:04:44 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s4">
|
|
|
|
|
<h4>Profile Settings</h4>
|
|
|
|
|
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
|
|
|
|
|
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
|
|
|
|
|
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
|
|
|
|
|
Stet clita kasd gubergren, no sea tak</p>
|
|
|
|
|
</div>
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<div class="col s8">
|
|
|
|
|
<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 08:37:36 +00:00
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;">
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<span>User Settings</span>
|
|
|
|
|
<i class="caret material-icons right">keyboard_arrow_right</i>
|
2022-12-13 14:01:04 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<form method="POST" enctype="multipart/form-data">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s6">
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ edit_account_form.hidden_tag() }}
|
|
|
|
|
{{ wtf.render_field(edit_account_form.username, material_icon='person') }}
|
|
|
|
|
{{ wtf.render_field(edit_account_form.email, material_icon='email') }}
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="right-align">
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ wtf.render_field(edit_account_form.submit, material_icon='send') }}
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2022-12-13 14:01:04 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
</li>
|
|
|
|
|
<li>
|
2023-03-15 08:37:36 +00:00
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;"><span>Public Profile</span><i class="material-icons caret right">keyboard_arrow_right</i></div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<form method="POST" enctype="multipart/form-data">
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ edit_profile_form.hidden_tag() }}
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<div class="switch">
|
|
|
|
|
<label>
|
|
|
|
|
private
|
2023-03-23 16:42:51 +00:00
|
|
|
|
<input {% if user.is_public %}checked{% endif %} id="profile-is-public-switch" type="checkbox">
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<span class="lever"></span>
|
|
|
|
|
public
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
<p></p>
|
|
|
|
|
<br>
|
|
|
|
|
<div class="divider"></div>
|
|
|
|
|
<p>Show:</p>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="row">
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<div class="col s3">
|
|
|
|
|
<p>
|
|
|
|
|
<label>
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ edit_profile_form.show_email() }}
|
|
|
|
|
<span>{{ edit_profile_form.show_email.label.text }}</span>
|
2023-03-17 14:56:37 +00:00
|
|
|
|
</label>
|
|
|
|
|
</p>
|
2022-12-05 15:25:54 +00:00
|
|
|
|
</div>
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<div class="col s3">
|
|
|
|
|
<p>
|
|
|
|
|
<label>
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ edit_profile_form.show_last_seen() }}
|
|
|
|
|
<span>{{ edit_profile_form.show_last_seen.label.text }}</span>
|
2023-03-17 14:56:37 +00:00
|
|
|
|
</label>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col s4">
|
|
|
|
|
<p>
|
|
|
|
|
<label>
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ edit_profile_form.show_member_since() }}
|
|
|
|
|
<span>{{ edit_profile_form.show_member_since.label.text }}</span>
|
2023-03-17 14:56:37 +00:00
|
|
|
|
</label>
|
|
|
|
|
</p>
|
2022-12-05 15:25:54 +00:00
|
|
|
|
</div>
|
2022-11-30 13:36:42 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<p></p>
|
|
|
|
|
<br>
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ wtf.render_field(edit_profile_form.full_name, material_icon='badge') }}
|
|
|
|
|
{{ wtf.render_field(edit_profile_form.about_me, material_icon='description', id='about-me-textfield') }}
|
|
|
|
|
{{ wtf.render_field(edit_profile_form.website, material_icon='laptop') }}
|
|
|
|
|
{{ wtf.render_field(edit_profile_form.organization, material_icon='business') }}
|
|
|
|
|
{{ wtf.render_field(edit_profile_form.location, material_icon='location_on') }}
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<p></p>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s12 m2">
|
2023-03-23 16:42:51 +00:00
|
|
|
|
<img src="{{ url_for('users.user_avatar', user_id=user.id) }}" alt="user-image" class="circle responsive-img" id="avatar">
|
2023-03-17 14:56:37 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="col s12 m6">
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ wtf.render_field(edit_profile_form.avatar, accept='image/jpeg, image/png, image/gif', placeholder='Choose an image file', id='avatar-upload') }}
|
2023-03-17 14:56:37 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="col s12 m1">
|
|
|
|
|
<a class="btn-floating red waves-effect waves-light modal-trigger" style="margin-top:15px;" href="#delete-avatar-modal"><i class="material-icons">delete</i></a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<br>
|
|
|
|
|
<p></p>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="right-align">
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ wtf.render_field(edit_profile_form.submit, material_icon='send') }}
|
2023-03-17 14:56:37 +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>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col s4">
|
|
|
|
|
<h4>General Settings</h4>
|
|
|
|
|
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
|
|
|
|
|
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
|
|
|
|
|
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
|
|
|
|
|
Stet clita kasd gubergren, no sea tak</p>
|
|
|
|
|
</div>
|
2023-03-17 14:56:37 +00:00
|
|
|
|
<div class="col s8">
|
|
|
|
|
<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-15 08:18:11 +00:00
|
|
|
|
<span>Notification Settings</span>
|
|
|
|
|
<i class="caret material-icons">keyboard_arrow_right</i>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
</div>
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<form method="POST">
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ edit_notifications_form.hidden_tag() }}
|
|
|
|
|
{{ wtf.render_field(edit_notifications_form.job_status_mail_notification_level, material_icon='notifications') }}
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<div class="right-align">
|
2023-03-23 16:42:51 +00:00
|
|
|
|
{{ wtf.render_field(edit_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>
|
|
|
|
|
<li>
|
2023-03-15 11:46:17 +00:00
|
|
|
|
<div class="collapsible-header" style="justify-content: space-between;">
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<span>Change Password</span>
|
|
|
|
|
<i class="caret material-icons right">keyboard_arrow_right</i>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<form method="POST">
|
|
|
|
|
{{ change_password_form.hidden_tag() }}
|
|
|
|
|
{{ wtf.render_field(change_password_form.password, material_icon='vpn_key') }}
|
|
|
|
|
{{ wtf.render_field(change_password_form.new_password, material_icon='vpn_key') }}
|
|
|
|
|
{{ wtf.render_field(change_password_form.new_password_2, material_icon='vpn_key') }}
|
|
|
|
|
<div class="right-align">
|
|
|
|
|
{{ wtf.render_field(change_password_form.submit, material_icon='send') }}
|
|
|
|
|
</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-15 08:18:11 +00:00
|
|
|
|
<span>Delete Account</span>
|
|
|
|
|
<i class="caret material-icons right">keyboard_arrow_right</i>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="collapsible-body">
|
|
|
|
|
<p>Deleting an account has the following effects:</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>All data associated with your corpora and jobs will be permanently deleted.</li>
|
|
|
|
|
<li>All settings will be permanently deleted.</li>
|
|
|
|
|
</ul>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
<div class="right-align">
|
2023-03-15 08:18:11 +00:00
|
|
|
|
<a class="btn red waves-effect waves-light modal-trigger" href="#delete-user"><i class="material-icons left">delete</i>Delete</a>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
</div>
|
|
|
|
|
</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>
|
|
|
|
|
</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-03-13 12:29:01 +00:00
|
|
|
|
<div class="modal" id="delete-avatar-modal">
|
|
|
|
|
<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>
|
|
|
|
|
</div>
|
2023-03-13 14:04:44 +00:00
|
|
|
|
<div class="modal" id="delete-user">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<h4>Confirm User deletion</h4>
|
2023-03-23 16:42:51 +00:00
|
|
|
|
<p>Do you really want to delete the User <b>{{ user.username }}</b>? All files will be permanently deleted!</p>
|
2023-03-13 14:04:44 +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-user-button">Delete</a>
|
|
|
|
|
</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-03-23 16:42:51 +00:00
|
|
|
|
let deleteButtonElement = document.querySelector('#delete-avatar');
|
|
|
|
|
let avatarElement = document.querySelector('#avatar');
|
|
|
|
|
let avatarUploadElement = document.querySelector('#avatar-upload');
|
2023-03-14 12:32:32 +00:00
|
|
|
|
|
2023-03-23 16:42:51 +00:00
|
|
|
|
avatarUploadElement.addEventListener('change', () => {
|
|
|
|
|
let file = avatarUploadElement.files[0];
|
|
|
|
|
avatarElement.src = URL.createObjectURL(file);
|
2023-03-14 12:32:32 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-03-23 16:42:51 +00:00
|
|
|
|
deleteButtonElement.addEventListener('click', () => {
|
2023-03-17 14:56:37 +00:00
|
|
|
|
Requests.settings.entity.deleteAvatar(currentUserId)
|
2023-03-14 12:32:32 +00:00
|
|
|
|
.then(
|
|
|
|
|
(response) => {
|
2023-03-23 16:42:51 +00:00
|
|
|
|
avatarElement.src = {{ url_for('static', filename='images/user_avatar.png')|tojson }};
|
2023-03-14 12:32:32 +00:00
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
document.querySelector('#delete-user-button').addEventListener('click', (event) => {
|
2023-03-17 14:56:37 +00:00
|
|
|
|
Requests.settings.entity.delete(currentUserId)
|
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-17 14:56:37 +00:00
|
|
|
|
// #region Public Switch
|
|
|
|
|
let profileIsPublicSwitchElement = document.querySelector('#profile-is-public-switch');
|
|
|
|
|
profileIsPublicSwitchElement.addEventListener('change', (event) => {
|
|
|
|
|
let newIsPublic = profileIsPublicSwitchElement.checked;
|
|
|
|
|
Requests.settings.entity.isPublic.update(currentUserId, newIsPublic)
|
|
|
|
|
.catch((response) => {
|
|
|
|
|
profileIsPublicSwitchElement.checked = !newIsPublic;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// #endregion Public Switch
|
2023-03-14 12:32:32 +00:00
|
|
|
|
</script>
|
|
|
|
|
{% endblock scripts %}
|