mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-23 06:20:34 +00:00
Redesign corpus page and add possibility to add followers by username for owner
This commit is contained in:
@ -12,16 +12,6 @@ class CorpusDisplay extends RessourceDisplay {
|
||||
.addEventListener('click', (event) => {
|
||||
Utils.deleteCorpusRequest(this.userId, this.corpusId);
|
||||
});
|
||||
this.displayElement
|
||||
.querySelector('.action-switch[data-action="toggle-is-public"]')
|
||||
.addEventListener('click', (event) => {
|
||||
if (event.target.tagName !== 'INPUT') {return;}
|
||||
if (event.target.checked) {
|
||||
Utils.enableCorpusIsPublicRequest(this.userId, this.corpusId);
|
||||
} else {
|
||||
Utils.disableCorpusIsPublicRequest(this.userId, this.corpusId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
init(user) {
|
||||
@ -31,7 +21,6 @@ class CorpusDisplay extends RessourceDisplay {
|
||||
this.setStatus(corpus.status);
|
||||
this.setTitle(corpus.title);
|
||||
this.setNumTokens(corpus.num_tokens);
|
||||
this.setShareLink();
|
||||
}
|
||||
|
||||
onPatch(patch) {
|
||||
@ -82,7 +71,7 @@ class CorpusDisplay extends RessourceDisplay {
|
||||
}
|
||||
|
||||
setStatus(status) {
|
||||
let elements = this.displayElement.querySelectorAll('.corpus-analyse-trigger')
|
||||
let elements = this.displayElement.querySelectorAll('.action-button[data-action="analyze"]');
|
||||
for (let element of elements) {
|
||||
if (['BUILT', 'STARTING_ANALYSIS_SESSION', 'RUNNING_ANALYSIS_SESSION', 'CANCELING_ANALYSIS_SESSION'].includes(status)) {
|
||||
element.classList.remove('disabled');
|
||||
@ -118,28 +107,4 @@ class CorpusDisplay extends RessourceDisplay {
|
||||
new Date(creationDate).toLocaleString("en-US")
|
||||
);
|
||||
}
|
||||
|
||||
setShareLink() {
|
||||
let generateShareLinkButton = this.displayElement.querySelector('#generate-share-link-button');
|
||||
let copyShareLinkButton = this.displayElement.querySelector('#copy-share-link-button');
|
||||
let shareLinkInput = this.displayElement.querySelector('#share-link-input');
|
||||
let shareLinkContainer = this.displayElement.querySelector('#share-link-container');
|
||||
let roleSelect = this.displayElement.querySelector('#role-select');
|
||||
let expirationDate = this.displayElement.querySelector('#expiration');
|
||||
|
||||
|
||||
generateShareLinkButton.addEventListener('click', () => {
|
||||
Utils.generateCorpusShareLinkRequest(`${this.corpusId}`, roleSelect.value, expirationDate.value)
|
||||
.then((shareLink) => {
|
||||
shareLinkContainer.classList.remove('hide');
|
||||
shareLinkInput.value = shareLink;
|
||||
});
|
||||
});
|
||||
|
||||
copyShareLinkButton.addEventListener('click', () => {
|
||||
shareLinkInput.select();
|
||||
navigator.clipboard.writeText(shareLinkInput.value);
|
||||
app.flash(`Copied!`, 'success');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user