mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-13 17:40:40 +00:00
Merge branch 'public-corpus' of gitlab.ub.uni-bielefeld.de:sfb1288inf/nopaque into public-corpus
This commit is contained in:
@ -31,8 +31,7 @@
|
||||
<ul class="dropdown-content" id="nav-more-dropdown">
|
||||
<li><a href="{{ url_for('main.user_manual') }}"><i class="material-icons left">help</i>Manual</a></li>
|
||||
{% if current_user.is_authenticated %}
|
||||
<li><a href="{{ url_for('settings.settings') }}"><i class="material-icons left">settings</i>General settings</a></li>
|
||||
<li><a href="{{ url_for('users.edit_profile', user_id=current_user.id) }}"><i class="material-icons left">contact_page</i>Profile settings</a></li>
|
||||
<li><a href="{{ url_for('users.edit_profile', user_id=current_user.id) }}"><i class="material-icons left">settings</i>User settings</a></li>
|
||||
<li class="divider" tabindex="-1"></li>
|
||||
<li><a href="{{ url_for('auth.logout') }}">Log out</a></li>
|
||||
{% else %}
|
||||
|
@ -64,7 +64,8 @@
|
||||
'js/Requests/corpora/corpora.js',
|
||||
'js/Requests/corpora/files.js',
|
||||
'js/Requests/corpora/followers.js',
|
||||
'js/Requests/jobs/jobs.js'
|
||||
'js/Requests/jobs/jobs.js',
|
||||
'js/Requests/users/users.js'
|
||||
%}
|
||||
<script src="{{ ASSET_URL }}"></script>
|
||||
{%- endassets %}
|
||||
|
@ -38,8 +38,7 @@
|
||||
<li class="service-color service-color-border border-darken" data-service="corpus-analysis" style="border-left: 10px solid; margin-top: 5px;"><a href="{{ url_for('services.corpus_analysis') }}"><i class="nopaque-icons service-icons" data-service="corpus-analysis"></i>Corpus Analysis</a></li>
|
||||
<li><div class="divider"></div></li>
|
||||
<li><a class="subheader">Account</a></li>
|
||||
<li><a href="{{ url_for('settings.settings') }}"><i class="material-icons">settings</i>General Settings</a></li>
|
||||
<li><a href="{{ url_for('users.edit_profile', user_id=current_user.id) }}"><i class="material-icons left">contact_page</i>Profile settings</a></li>
|
||||
<li><a href="{{ url_for('users.edit_profile', user_id=current_user.id) }}"><i class="material-icons left">settings</i>User Settings</a></li>
|
||||
<li><a href="{{ url_for('auth.logout') }}">Log out</a></li>
|
||||
{% if current_user.can('ADMINISTRATE') or current_user.can('USE_API') %}
|
||||
<li><div class="divider"></div></li>
|
||||
|
@ -26,16 +26,17 @@ deleteModalDeleteButtonElement.addEventListener('click', (event) => {
|
||||
let inviteUserModalElement = document.querySelector('#invite-user-modal');
|
||||
let inviteUserModalSearchElement = document.querySelector('#invite-user-modal-search');
|
||||
let inviteUserModalInviteButtonElement = document.querySelector('#invite-user-modal-invite-button');
|
||||
const users = {};
|
||||
|
||||
for (let user of {{ users|tojson }}) {
|
||||
users[user.username] = user.avatar ? `/users/${user.id}/avatar` : '/static/images/user_avatar.png';
|
||||
}
|
||||
|
||||
let inviteUserModalSearch = M.Chips.init(
|
||||
inviteUserModalSearchElement,
|
||||
{
|
||||
autocompleteOptions: {
|
||||
data: {
|
||||
'nopaque': '/users/3V8Aqpg74JvxOd9o/avatar',
|
||||
'pjentsch': '/users/3V8Aqpg74JvxOd9o/avatar',
|
||||
'pjentsch2': '/users/3V8Aqpg74JvxOd9o/avatar'
|
||||
}
|
||||
data: users
|
||||
},
|
||||
limit: 3,
|
||||
onChipAdd: (a, chipElement) => {
|
||||
@ -43,7 +44,7 @@ let inviteUserModalSearch = M.Chips.init(
|
||||
chipElement.firstElementChild.click();
|
||||
}
|
||||
},
|
||||
placeholder: 'Enter a username',
|
||||
placeholder: 'Enter username',
|
||||
secondaryPlaceholder: 'Add more users'
|
||||
}
|
||||
);
|
||||
|
@ -1,69 +0,0 @@
|
||||
{% extends "base.html.j2" %}
|
||||
{% import "materialize/wtf.html.j2" as wtf %}
|
||||
|
||||
{% block page_content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<h1 id="title">{{ title }}</h1>
|
||||
</div>
|
||||
<div class="col s12">
|
||||
<form method="POST">
|
||||
{{ edit_notification_settings_form.hidden_tag() }}
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Notification settings</span>
|
||||
{{ wtf.render_field(edit_notification_settings_form.job_status_mail_notification_level, material_icon='notifications') }}
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="right-align">
|
||||
{{ wtf.render_field(edit_notification_settings_form.submit, material_icon='send') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="POST">
|
||||
{{ change_password_form.hidden_tag() }}
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Change Password</span>
|
||||
{{ 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>
|
||||
<div class="card-action">
|
||||
<div class="right-align">
|
||||
{{ wtf.render_field(change_password_form.submit, material_icon='send') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Delete account</span>
|
||||
<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>
|
||||
</div>
|
||||
<div class="card-action right-align">
|
||||
<a class="btn red waves-effect waves-light" id="delete-user"><i class="material-icons left">delete</i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock page_content %}
|
||||
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script>
|
||||
document.querySelector('#delete-user').addEventListener('click', (event) => {
|
||||
Utils.deleteUserRequest(currentUserId)
|
||||
.then((response) => {window.location.href = '/';});
|
||||
});
|
||||
</script>
|
||||
{% endblock scripts %}
|
@ -7,10 +7,11 @@
|
||||
<div class="col s12">
|
||||
<h1 id="title">{{ title }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="col s12">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12 m9 l10">
|
||||
|
||||
<div class="card">
|
||||
<div id="user-settings" class="card section scrollspy">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="card-content">
|
||||
<div class="row">
|
||||
@ -31,7 +32,7 @@
|
||||
|
||||
<form method="POST">
|
||||
{{ edit_privacy_settings_form.hidden_tag() }}
|
||||
<div class="card">
|
||||
<div id="privacy-settings" class="card section scrollspy">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Privacy settings</span>
|
||||
<br>
|
||||
@ -54,7 +55,7 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="card">
|
||||
<div id="public-profile-settings" class="card section scrollspy">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="card-content">
|
||||
{{ edit_public_profile_information_form.hidden_tag() }}
|
||||
@ -79,7 +80,7 @@
|
||||
<div class="row">
|
||||
<div class="col s2">
|
||||
<div class="center-align">
|
||||
<a class="action-button btn-floating red waves-effect waves-light" style="margin-top:15px;" id="delete-avatar"><i class="material-icons">delete</i></a>
|
||||
<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>
|
||||
<div class="col s10">
|
||||
@ -106,49 +107,86 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form method="POST">
|
||||
{{ edit_notification_settings_form.hidden_tag() }}
|
||||
<div id="notification-settings" class="card section scrollspy">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Notification settings</span>
|
||||
{{ wtf.render_field(edit_notification_settings_form.job_status_mail_notification_level, material_icon='notifications') }}
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="right-align">
|
||||
{{ wtf.render_field(edit_notification_settings_form.submit, material_icon='send') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form method="POST">
|
||||
{{ change_password_form.hidden_tag() }}
|
||||
<div id="change-password" class="card section scrollspy">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Change Password</span>
|
||||
{{ 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>
|
||||
<div class="card-action">
|
||||
<div class="right-align">
|
||||
{{ wtf.render_field(change_password_form.submit, material_icon='send') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div id="delete-account" class="card section scrollspy">
|
||||
<div class="card-content">
|
||||
<span class="card-title">Delete account</span>
|
||||
<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>
|
||||
</div>
|
||||
<div class="card-action right-align">
|
||||
<a class="btn red waves-effect waves-light modal-trigger" href="#delete-user"><i class="material-icons left">delete</i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col hide-on-small-only m3 l2">
|
||||
<ul class="section table-of-contents" style="position: fixed !important;">
|
||||
<li><a href="#user-settings">User Settings</a></li>
|
||||
<li><a href="#privacy-settings">Privacy Settings</a></li>
|
||||
<li><a href="#public-profile-settings">Public Profile Settings</a></li>
|
||||
<li><a href="#notification-settings">Notification Settings</a></li>
|
||||
<li><a href="#change-password">Change Password</a></li>
|
||||
<li><a href="#delete-account">Delete Account</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock page_content %}
|
||||
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script>
|
||||
let publicProfile = document.querySelector('#public-profile');
|
||||
let disableButtons = document.querySelectorAll('[data-action="disable"]');
|
||||
let deleteButton = document.querySelector('#delete-avatar');
|
||||
let avatar = document.querySelector('#avatar');
|
||||
let avatarUpload = document.querySelector('#avatar-upload');
|
||||
|
||||
for (let disableButton of disableButtons) {
|
||||
disableButton.disabled = !publicProfile.checked;
|
||||
}
|
||||
|
||||
publicProfile.addEventListener('change', () => {
|
||||
if (publicProfile.checked) {
|
||||
for (let disableButton of disableButtons) {
|
||||
disableButton.disabled = false;
|
||||
}
|
||||
} else {
|
||||
for (let disableButton of disableButtons) {
|
||||
disableButton.checked = false;
|
||||
disableButton.disabled = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
avatarUpload.addEventListener('change', function() {
|
||||
let file = this.files[0];
|
||||
avatar.src = URL.createObjectURL(file);
|
||||
});
|
||||
|
||||
deleteButton.addEventListener('click', () => {
|
||||
Utils.deleteProfileAvatarRequest({{ user.hashid|tojson }})
|
||||
.then(
|
||||
(response) => {
|
||||
avatar.src = "{{ url_for('static', filename='images/user_avatar.png') }}";
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
{% endblock scripts %}
|
||||
{% block modals %}
|
||||
<div class="modal" id="delete-avatar-modal">
|
||||
<div class="modal-content">
|
||||
<h4>Confirm Avatar deletion</h4>
|
||||
<p>Do you really want to delete your Avatar?</p>
|
||||
</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>
|
||||
<div class="modal" id="delete-user">
|
||||
<div class="modal-content">
|
||||
<h4>Confirm User deletion</h4>
|
||||
<p>Do you really want to delete the User <b>{{ current_user.username }}</b>? All files will be permanently deleted!</p>
|
||||
</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>
|
||||
{% endblock modals %}
|
||||
|
41
app/templates/users/edit_profile.js.j2
Normal file
41
app/templates/users/edit_profile.js.j2
Normal file
@ -0,0 +1,41 @@
|
||||
let publicProfile = document.querySelector('#public-profile');
|
||||
let disableButtons = document.querySelectorAll('[data-action="disable"]');
|
||||
let deleteButton = document.querySelector('#delete-avatar');
|
||||
let avatar = document.querySelector('#avatar');
|
||||
let avatarUpload = document.querySelector('#avatar-upload');
|
||||
|
||||
for (let disableButton of disableButtons) {
|
||||
disableButton.disabled = !publicProfile.checked;
|
||||
}
|
||||
|
||||
publicProfile.addEventListener('change', () => {
|
||||
if (publicProfile.checked) {
|
||||
for (let disableButton of disableButtons) {
|
||||
disableButton.disabled = false;
|
||||
}
|
||||
} else {
|
||||
for (let disableButton of disableButtons) {
|
||||
disableButton.checked = false;
|
||||
disableButton.disabled = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
avatarUpload.addEventListener('change', function() {
|
||||
let file = this.files[0];
|
||||
avatar.src = URL.createObjectURL(file);
|
||||
});
|
||||
|
||||
deleteButton.addEventListener('click', () => {
|
||||
Requests.users.entity.deleteAvatar({{ user.hashid|tojson }})
|
||||
.then(
|
||||
(response) => {
|
||||
avatar.src = "{{ url_for('static', filename='images/user_avatar.png') }}";
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
document.querySelector('#delete-user-button').addEventListener('click', (event) => {
|
||||
Requests.users.entity.delete(currentUserId)
|
||||
.then((response) => {window.location.href = '/';});
|
||||
});
|
@ -111,28 +111,3 @@
|
||||
</div>
|
||||
{% endblock page_content %}
|
||||
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script>
|
||||
let publicInformationBadge = document.querySelector('#public-information-badge');
|
||||
if ("{{ user.id }}" == "{{ current_user.hashid }}") {
|
||||
if ("{{ user.is_public }}" == "True") {
|
||||
publicInformationBadge.dataset.badgeCaption = 'Your profile is public';
|
||||
publicInformationBadge.classList.add('green');
|
||||
publicInformationBadge.classList.remove('red');
|
||||
} else {
|
||||
publicInformationBadge.dataset.badgeCaption = 'Your profile is private';
|
||||
publicInformationBadge.classList.add('red');
|
||||
publicInformationBadge.classList.remove('green');
|
||||
}
|
||||
} else {
|
||||
publicInformationBadge.remove();
|
||||
}
|
||||
|
||||
let followedCorpusList = new FollowedCorpusList(document.querySelector('.followed-corpus-list'));
|
||||
followedCorpusList.add({{ followed_corpora|tojson }});
|
||||
let publicCorpusList = new PublicCorpusList(document.querySelector('.public-corpus-list'));
|
||||
publicCorpusList.add({{ own_public_corpora|tojson }});
|
||||
</script>
|
||||
{% endblock scripts %}
|
||||
|
||||
|
19
app/templates/users/profile.js.j2
Normal file
19
app/templates/users/profile.js.j2
Normal file
@ -0,0 +1,19 @@
|
||||
let publicInformationBadge = document.querySelector('#public-information-badge');
|
||||
if ("{{ user.id }}" == "{{ current_user.hashid }}") {
|
||||
if ("{{ user.is_public }}" == "True") {
|
||||
publicInformationBadge.dataset.badgeCaption = 'Your profile is public';
|
||||
publicInformationBadge.classList.add('green');
|
||||
publicInformationBadge.classList.remove('red');
|
||||
} else {
|
||||
publicInformationBadge.dataset.badgeCaption = 'Your profile is private';
|
||||
publicInformationBadge.classList.add('red');
|
||||
publicInformationBadge.classList.remove('green');
|
||||
}
|
||||
} else {
|
||||
publicInformationBadge.remove();
|
||||
}
|
||||
|
||||
let followedCorpusList = new FollowedCorpusList(document.querySelector('.followed-corpus-list'));
|
||||
followedCorpusList.add({{ followed_corpora|tojson }});
|
||||
let publicCorpusList = new PublicCorpusList(document.querySelector('.public-corpus-list'));
|
||||
publicCorpusList.add({{ own_public_corpora|tojson }});
|
Reference in New Issue
Block a user