mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
rename Requests namespace to requests
This commit is contained in:
parent
f36600f06c
commit
53f4400731
@ -75,7 +75,7 @@ class CorpusAnalysisStaticVisualization {
|
|||||||
|
|
||||||
getStopwords() {
|
getStopwords() {
|
||||||
this.data.promises.getStopwords = new Promise((resolve, reject) => {
|
this.data.promises.getStopwords = new Promise((resolve, reject) => {
|
||||||
Requests.corpora.entity.getStopwords()
|
requests.corpora.entity.getStopwords()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
response.json()
|
response.json()
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
|
@ -5,7 +5,7 @@ class CorpusDisplay extends ResourceDisplay {
|
|||||||
this.displayElement
|
this.displayElement
|
||||||
.querySelector('.action-button[data-action="build-request"]')
|
.querySelector('.action-button[data-action="build-request"]')
|
||||||
.addEventListener('click', (event) => {
|
.addEventListener('click', (event) => {
|
||||||
Requests.corpora.entity.build(this.corpusId);
|
requests.corpora.entity.build(this.corpusId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class AdminUserList extends ResourceList {
|
|||||||
let listAction = listActionElement === null ? 'view' : listActionElement.dataset.listAction;
|
let listAction = listActionElement === null ? 'view' : listActionElement.dataset.listAction;
|
||||||
switch (listAction) {
|
switch (listAction) {
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
Requests.users.entity.delete(itemId);
|
requests.users.entity.delete(itemId);
|
||||||
if (itemId === currentUserId) {window.location.href = '/';}
|
if (itemId === currentUserId) {window.location.href = '/';}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -153,12 +153,12 @@ class CorpusFileList extends ResourceList {
|
|||||||
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
||||||
confirmElement.addEventListener('click', (event) => {
|
confirmElement.addEventListener('click', (event) => {
|
||||||
if (currentUserId != this.userId) {
|
if (currentUserId != this.userId) {
|
||||||
Requests.corpora.entity.files.ent.delete(this.corpusId, itemId)
|
requests.corpora.entity.files.ent.delete(this.corpusId, itemId)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Requests.corpora.entity.files.ent.delete(this.corpusId, itemId)
|
requests.corpora.entity.files.ent.delete(this.corpusId, itemId)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
@ -250,12 +250,12 @@ class CorpusFileList extends ResourceList {
|
|||||||
confirmElement.addEventListener('click', (event) => {
|
confirmElement.addEventListener('click', (event) => {
|
||||||
this.selectedItemIds.forEach(selectedItemId => {
|
this.selectedItemIds.forEach(selectedItemId => {
|
||||||
if (currentUserId != this.userId) {
|
if (currentUserId != this.userId) {
|
||||||
Requests.corpora.entity.files.ent.delete(this.corpusId, selectedItemId)
|
requests.corpora.entity.files.ent.delete(this.corpusId, selectedItemId)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Requests.corpora.entity.files.ent.delete(this.corpusId, selectedItemId);
|
requests.corpora.entity.files.ent.delete(this.corpusId, selectedItemId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.selectedItemIds.clear();
|
this.selectedItemIds.clear();
|
||||||
|
@ -124,7 +124,7 @@ class CorpusFollowerList extends ResourceList {
|
|||||||
case 'update-role': {
|
case 'update-role': {
|
||||||
let followerId = listItemElement.dataset.followerId;
|
let followerId = listItemElement.dataset.followerId;
|
||||||
let roleName = event.target.value;
|
let roleName = event.target.value;
|
||||||
Requests.corpora.entity.followers.entity.role.update(this.corpusId, followerId, roleName);
|
requests.corpora.entity.followers.entity.role.update(this.corpusId, followerId, roleName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -144,12 +144,12 @@ class CorpusFollowerList extends ResourceList {
|
|||||||
case 'unfollow-request': {
|
case 'unfollow-request': {
|
||||||
let followerId = listItemElement.dataset.followerId;
|
let followerId = listItemElement.dataset.followerId;
|
||||||
if (currentUserId != this.userId) {
|
if (currentUserId != this.userId) {
|
||||||
Requests.corpora.entity.followers.entity.delete(this.corpusId, followerId)
|
requests.corpora.entity.followers.entity.delete(this.corpusId, followerId)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Requests.corpora.entity.followers.entity.delete(this.corpusId, followerId);
|
requests.corpora.entity.followers.entity.delete(this.corpusId, followerId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -171,12 +171,12 @@ class CorpusList extends ResourceList {
|
|||||||
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
||||||
confirmElement.addEventListener('click', (event) => {
|
confirmElement.addEventListener('click', (event) => {
|
||||||
if (!values['is-owner']) {
|
if (!values['is-owner']) {
|
||||||
Requests.corpora.entity.followers.entity.delete(itemId, currentUserId)
|
requests.corpora.entity.followers.entity.delete(itemId, currentUserId)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Requests.corpora.entity.delete(itemId);
|
requests.corpora.entity.delete(itemId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
@ -272,9 +272,9 @@ class CorpusList extends ResourceList {
|
|||||||
let listItem = this.listjs.get('id', selectedItemId)[0].elm;
|
let listItem = this.listjs.get('id', selectedItemId)[0].elm;
|
||||||
let values = this.listjs.get('id', listItem.dataset.id)[0].values();
|
let values = this.listjs.get('id', listItem.dataset.id)[0].values();
|
||||||
if (values['is-owner']) {
|
if (values['is-owner']) {
|
||||||
Requests.corpora.entity.delete(selectedItemId);
|
requests.corpora.entity.delete(selectedItemId);
|
||||||
} else {
|
} else {
|
||||||
Requests.corpora.entity.followers.entity.delete(selectedItemId, currentUserId);
|
requests.corpora.entity.followers.entity.delete(selectedItemId, currentUserId);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
@ -143,7 +143,7 @@ class JobList extends ResourceList {
|
|||||||
);
|
);
|
||||||
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
||||||
confirmElement.addEventListener('click', (event) => {
|
confirmElement.addEventListener('click', (event) => {
|
||||||
Requests.jobs.entity.delete(itemId);
|
requests.jobs.entity.delete(itemId);
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
break;
|
break;
|
||||||
@ -228,7 +228,7 @@ class JobList extends ResourceList {
|
|||||||
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
||||||
confirmElement.addEventListener('click', (event) => {
|
confirmElement.addEventListener('click', (event) => {
|
||||||
this.selectedItemIds.forEach(selectedItemId => {
|
this.selectedItemIds.forEach(selectedItemId => {
|
||||||
Requests.jobs.entity.delete(selectedItemId);
|
requests.jobs.entity.delete(selectedItemId);
|
||||||
});
|
});
|
||||||
this.selectedItemIds.clear();
|
this.selectedItemIds.clear();
|
||||||
this.renderingItemSelection();
|
this.renderingItemSelection();
|
||||||
|
@ -120,7 +120,7 @@ class SpaCyNLPPipelineModelList extends ResourceList {
|
|||||||
switch (listAction) {
|
switch (listAction) {
|
||||||
case 'toggle-is-public': {
|
case 'toggle-is-public': {
|
||||||
let newIsPublicValue = listActionElement.checked;
|
let newIsPublicValue = listActionElement.checked;
|
||||||
Requests.contributions.spacy_nlp_pipeline_models.entity.isPublic.update(itemId, newIsPublicValue)
|
requests.contributions.spacy_nlp_pipeline_models.entity.isPublic.update(itemId, newIsPublicValue)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
listActionElement.checked = !newIsPublicValue;
|
listActionElement.checked = !newIsPublicValue;
|
||||||
});
|
});
|
||||||
@ -169,7 +169,7 @@ class SpaCyNLPPipelineModelList extends ResourceList {
|
|||||||
);
|
);
|
||||||
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
||||||
confirmElement.addEventListener('click', (event) => {
|
confirmElement.addEventListener('click', (event) => {
|
||||||
Requests.contributions.spacy_nlp_pipeline_models.entity.delete(itemId);
|
requests.contributions.spacy_nlp_pipeline_models.entity.delete(itemId);
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
break;
|
break;
|
||||||
|
@ -129,7 +129,7 @@ class TesseractOCRPipelineModelList extends ResourceList {
|
|||||||
switch (listAction) {
|
switch (listAction) {
|
||||||
case 'toggle-is-public': {
|
case 'toggle-is-public': {
|
||||||
let newIsPublicValue = listActionElement.checked;
|
let newIsPublicValue = listActionElement.checked;
|
||||||
Requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic.update(itemId, newIsPublicValue)
|
requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic.update(itemId, newIsPublicValue)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
listActionElement.checked = !newIsPublicValue;
|
listActionElement.checked = !newIsPublicValue;
|
||||||
});
|
});
|
||||||
@ -178,7 +178,7 @@ class TesseractOCRPipelineModelList extends ResourceList {
|
|||||||
);
|
);
|
||||||
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
let confirmElement = modalElement.querySelector('.action-button[data-action="confirm"]');
|
||||||
confirmElement.addEventListener('click', (event) => {
|
confirmElement.addEventListener('click', (event) => {
|
||||||
Requests.contributions.tesseract_ocr_pipeline_models.entity.delete(itemId);
|
requests.contributions.tesseract_ocr_pipeline_models.entity.delete(itemId);
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
break;
|
break;
|
||||||
|
@ -105,6 +105,7 @@
|
|||||||
{%- endassets %}
|
{%- endassets %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// TODO: Implement an app.run method and use this for all of the following
|
||||||
const app = new App();
|
const app = new App();
|
||||||
{%- if current_user.is_authenticated %}
|
{%- if current_user.is_authenticated %}
|
||||||
const currentUserId = {{ current_user.hashid|tojson }};
|
const currentUserId = {{ current_user.hashid|tojson }};
|
||||||
@ -169,7 +170,7 @@
|
|||||||
{
|
{
|
||||||
dismissible: false,
|
dismissible: false,
|
||||||
onCloseEnd: () => {
|
onCloseEnd: () => {
|
||||||
Requests.users.entity.acceptTermsOfUse();
|
requests.users.entity.acceptTermsOfUse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
let userConfirmedSwitchElement = document.querySelector('#user-confirmed-switch');
|
let userConfirmedSwitchElement = document.querySelector('#user-confirmed-switch');
|
||||||
userConfirmedSwitchElement.addEventListener('change', (event) => {
|
userConfirmedSwitchElement.addEventListener('change', (event) => {
|
||||||
let newConfirmed = userConfirmedSwitchElement.checked;
|
let newConfirmed = userConfirmedSwitchElement.checked;
|
||||||
Requests.admin.users.entity.confirmed.update({{ user.hashid|tojson }}, newConfirmed)
|
requests.admin.users.entity.confirmed.update({{ user.hashid|tojson }}, newConfirmed)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
userConfirmedSwitchElement.checked = !userConfirmedSwitchElement;
|
userConfirmedSwitchElement.checked = !userConfirmedSwitchElement;
|
||||||
});
|
});
|
||||||
|
@ -242,7 +242,7 @@ let corpusDisplay = new CorpusDisplay(document.querySelector('#corpus-display'))
|
|||||||
{# {% if current_user.is_following_corpus(corpus) %}
|
{# {% if current_user.is_following_corpus(corpus) %}
|
||||||
let unfollowRequestElement = document.querySelector('.action-button[data-action="unfollow-request"]');
|
let unfollowRequestElement = document.querySelector('.action-button[data-action="unfollow-request"]');
|
||||||
unfollowRequestElement.addEventListener('click', () => {
|
unfollowRequestElement.addEventListener('click', () => {
|
||||||
Requests.corpora.entity.followers.entity.delete({{ corpus.hashid|tojson }}, {{ current_user.hashid|tojson }})
|
requests.corpora.entity.followers.entity.delete({{ corpus.hashid|tojson }}, {{ current_user.hashid|tojson }})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
@ -254,7 +254,7 @@ let corpusDisplay = new CorpusDisplay(document.querySelector('#corpus-display'))
|
|||||||
{# let publishingModalIsPublicSwitchElement = document.querySelector('#publishing-modal-is-public-switch');
|
{# let publishingModalIsPublicSwitchElement = document.querySelector('#publishing-modal-is-public-switch');
|
||||||
publishingModalIsPublicSwitchElement.addEventListener('change', (event) => {
|
publishingModalIsPublicSwitchElement.addEventListener('change', (event) => {
|
||||||
let newIsPublic = publishingModalIsPublicSwitchElement.checked;
|
let newIsPublic = publishingModalIsPublicSwitchElement.checked;
|
||||||
Requests.corpora.entity.isPublic.update({{ corpus.hashid|tojson }}, newIsPublic)
|
requests.corpora.entity.isPublic.update({{ corpus.hashid|tojson }}, newIsPublic)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
publishingModalIsPublicSwitchElement.checked = !newIsPublic;
|
publishingModalIsPublicSwitchElement.checked = !newIsPublic;
|
||||||
});
|
});
|
||||||
@ -264,7 +264,7 @@ publishingModalIsPublicSwitchElement.addEventListener('change', (event) => {
|
|||||||
// #region Delete
|
// #region Delete
|
||||||
let deleteModalDeleteButtonElement = document.querySelector('#delete-modal-delete-button');
|
let deleteModalDeleteButtonElement = document.querySelector('#delete-modal-delete-button');
|
||||||
deleteModalDeleteButtonElement.addEventListener('click', (event) => {
|
deleteModalDeleteButtonElement.addEventListener('click', (event) => {
|
||||||
Requests.corpora.entity.delete({{ corpus.hashid|tojson }})
|
requests.corpora.entity.delete({{ corpus.hashid|tojson }})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.href = {{ url_for('main.dashboard')|tojson }};
|
window.location.href = {{ url_for('main.dashboard')|tojson }};
|
||||||
});
|
});
|
||||||
@ -314,7 +314,7 @@ M.Modal.init(
|
|||||||
|
|
||||||
inviteUserModalInviteButtonElement.addEventListener('click', (event) => {
|
inviteUserModalInviteButtonElement.addEventListener('click', (event) => {
|
||||||
let usernames = inviteUserModalSearch.chipsData.map((chipData) => chipData.tag);
|
let usernames = inviteUserModalSearch.chipsData.map((chipData) => chipData.tag);
|
||||||
Requests.corpora.entity.followers.add({{ corpus.hashid|tojson }}, usernames);
|
requests.corpora.entity.followers.add({{ corpus.hashid|tojson }}, usernames);
|
||||||
});
|
});
|
||||||
// #endregion Invite user
|
// #endregion Invite user
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ M.Modal.init(
|
|||||||
shareLinkModalCreateButtonElement.addEventListener('click', (event) => {
|
shareLinkModalCreateButtonElement.addEventListener('click', (event) => {
|
||||||
let role = shareLinkModalCorpusFollowerRoleSelectElement.value;
|
let role = shareLinkModalCorpusFollowerRoleSelectElement.value;
|
||||||
let expiration = shareLinkModalExpirationDateDatepickerElement.value
|
let expiration = shareLinkModalExpirationDateDatepickerElement.value
|
||||||
Requests.corpora.entity.generateShareLink({{ corpus.hashid|tojson }}, role, expiration)
|
requests.corpora.entity.generateShareLink({{ corpus.hashid|tojson }}, role, expiration)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
response.json()
|
response.json()
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
|
@ -273,7 +273,7 @@ publicCorpusFollowerList.add(
|
|||||||
{% if cfr.has_permission('MANAGE_FILES') %}
|
{% if cfr.has_permission('MANAGE_FILES') %}
|
||||||
let followerBuildRequest = document.querySelector('#follower-build-request');
|
let followerBuildRequest = document.querySelector('#follower-build-request');
|
||||||
followerBuildRequest.addEventListener('click', () => {
|
followerBuildRequest.addEventListener('click', () => {
|
||||||
Requests.corpora.entity.build({{ corpus.hashid|tojson }})
|
requests.corpora.entity.build({{ corpus.hashid|tojson }})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
@ -285,7 +285,7 @@ followerBuildRequest.addEventListener('click', () => {
|
|||||||
{% if current_user.is_following_corpus(corpus) %}
|
{% if current_user.is_following_corpus(corpus) %}
|
||||||
let unfollowRequestElement = document.querySelector('.action-button[data-action="unfollow-request"]');
|
let unfollowRequestElement = document.querySelector('.action-button[data-action="unfollow-request"]');
|
||||||
unfollowRequestElement.addEventListener('click', () => {
|
unfollowRequestElement.addEventListener('click', () => {
|
||||||
Requests.corpora.entity.followers.entity.delete({{ corpus.hashid|tojson }}, {{ current_user.hashid|tojson }})
|
requests.corpora.entity.followers.entity.delete({{ corpus.hashid|tojson }}, {{ current_user.hashid|tojson }})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
@ -335,7 +335,7 @@ M.Modal.init(
|
|||||||
|
|
||||||
inviteUserModalInviteButtonElement.addEventListener('click', (event) => {
|
inviteUserModalInviteButtonElement.addEventListener('click', (event) => {
|
||||||
let usernames = inviteUserModalSearch.chipsData.map((chipData) => chipData.tag);
|
let usernames = inviteUserModalSearch.chipsData.map((chipData) => chipData.tag);
|
||||||
Requests.corpora.entity.followers.add({{ corpus.hashid|tojson }}, usernames)
|
requests.corpora.entity.followers.add({{ corpus.hashid|tojson }}, usernames)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
@ -383,7 +383,7 @@ M.Modal.init(
|
|||||||
shareLinkModalCreateButtonElement.addEventListener('click', (event) => {
|
shareLinkModalCreateButtonElement.addEventListener('click', (event) => {
|
||||||
let role = shareLinkModalCorpusFollowerRoleSelectElement.value;
|
let role = shareLinkModalCorpusFollowerRoleSelectElement.value;
|
||||||
let expiration = shareLinkModalExpirationDateDatepickerElement.value
|
let expiration = shareLinkModalExpirationDateDatepickerElement.value
|
||||||
Requests.corpora.entity.generateShareLink({{ corpus.hashid|tojson }}, role, expiration)
|
requests.corpora.entity.generateShareLink({{ corpus.hashid|tojson }}, role, expiration)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
response.json()
|
response.json()
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
|
@ -154,16 +154,16 @@
|
|||||||
let deleteJobRequestElement = document.querySelector('#delete-job-request');
|
let deleteJobRequestElement = document.querySelector('#delete-job-request');
|
||||||
let restartJobRequestElement = document.querySelector('#restart-job-request');
|
let restartJobRequestElement = document.querySelector('#restart-job-request');
|
||||||
deleteJobRequestElement.addEventListener('click', (event) => {
|
deleteJobRequestElement.addEventListener('click', (event) => {
|
||||||
Requests.jobs.entity.delete({{ job.hashid|tojson }});
|
requests.jobs.entity.delete({{ job.hashid|tojson }});
|
||||||
});
|
});
|
||||||
restartJobRequestElement.addEventListener('click', (event) => {
|
restartJobRequestElement.addEventListener('click', (event) => {
|
||||||
Requests.jobs.entity.restart({{ job.hashid|tojson }});
|
requests.jobs.entity.restart({{ job.hashid|tojson }});
|
||||||
});
|
});
|
||||||
|
|
||||||
if ({{ current_user.is_administrator()|tojson }}) {
|
if ({{ current_user.is_administrator()|tojson }}) {
|
||||||
let jobLogButtonElement = document.querySelector('#job-log-button');
|
let jobLogButtonElement = document.querySelector('#job-log-button');
|
||||||
jobLogButtonElement.addEventListener('click', (event) => {
|
jobLogButtonElement.addEventListener('click', (event) => {
|
||||||
Requests.jobs.entity.log({{ job.hashid|tojson }})
|
requests.jobs.entity.log({{ job.hashid|tojson }})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
response.json()
|
response.json()
|
||||||
|
@ -221,7 +221,7 @@ avatarUploadElement.addEventListener('change', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector('#delete-avatar').addEventListener('click', () => {
|
document.querySelector('#delete-avatar').addEventListener('click', () => {
|
||||||
Requests.users.entity.avatar.delete({{ user.hashid|tojson }})
|
requests.users.entity.avatar.delete({{ user.hashid|tojson }})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
avatarPreviewElement.src = {{ url_for('static', filename='images/user_avatar.png')|tojson }};
|
avatarPreviewElement.src = {{ url_for('static', filename='images/user_avatar.png')|tojson }};
|
||||||
@ -230,7 +230,7 @@ document.querySelector('#delete-avatar').addEventListener('click', () => {
|
|||||||
}); #}
|
}); #}
|
||||||
|
|
||||||
document.querySelector('#delete-user').addEventListener('click', (event) => {
|
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 = '/';});
|
.then((response) => {window.location.href = '/';});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ for (let collapsibleElement of document.querySelectorAll('.collapsible.no-autoin
|
|||||||
let profilePrivacySettingCheckboxElements = document.querySelectorAll('.profile-privacy-setting-checkbox');
|
let profilePrivacySettingCheckboxElements = document.querySelectorAll('.profile-privacy-setting-checkbox');
|
||||||
profileIsPublicSwitchElement.addEventListener('change', (event) => {
|
profileIsPublicSwitchElement.addEventListener('change', (event) => {
|
||||||
let newEnabled = profileIsPublicSwitchElement.checked;
|
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(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
for (let profilePrivacySettingCheckboxElement of document.querySelectorAll('.profile-privacy-setting-checkbox')) {
|
for (let profilePrivacySettingCheckboxElement of document.querySelectorAll('.profile-privacy-setting-checkbox')) {
|
||||||
@ -271,7 +271,7 @@ for (let profilePrivacySettingCheckboxElement of profilePrivacySettingCheckboxEl
|
|||||||
profilePrivacySettingCheckboxElement.addEventListener('change', (event) => {
|
profilePrivacySettingCheckboxElement.addEventListener('change', (event) => {
|
||||||
let newEnabled = profilePrivacySettingCheckboxElement.checked;
|
let newEnabled = profilePrivacySettingCheckboxElement.checked;
|
||||||
let valueName = profilePrivacySettingCheckboxElement.dataset.profilePrivacySettingName;
|
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) => {
|
.catch((response) => {
|
||||||
profilePrivacySettingCheckboxElement.checked = !newEnabled;
|
profilePrivacySettingCheckboxElement.checked = !newEnabled;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user