mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-07-27 06:11:34 +00:00
Reviewed User package and invite user optical fix
This commit is contained in:
@@ -79,7 +79,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">
|
||||
@@ -111,44 +111,15 @@
|
||||
</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>
|
||||
{% endblock modals %}
|
||||
|
36
app/templates/users/edit_profile.js.j2
Normal file
36
app/templates/users/edit_profile.js.j2
Normal file
@@ -0,0 +1,36 @@
|
||||
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') }}";
|
||||
}
|
||||
);
|
||||
});
|
@@ -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