mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-27 03:44:19 +00:00
Compare commits
3 Commits
0565f309f8
...
61be3345be
Author | SHA1 | Date | |
---|---|---|---|
|
61be3345be | ||
|
e9ddb85f03 | ||
|
e3166ca54c |
@ -33,7 +33,7 @@ class CorpusAnalysisConcordance {
|
|||||||
|
|
||||||
async submitForm(queryModeId) {
|
async submitForm(queryModeId) {
|
||||||
this.app.disableActionElements();
|
this.app.disableActionElements();
|
||||||
let queryBuilderQuery = Utils.unescape(document.querySelector('#corpus-analysis-concordance-query-preview').innerHTML.trim());
|
let queryBuilderQuery = nopaque.Utils.unescape(document.querySelector('#corpus-analysis-concordance-query-preview').innerHTML.trim());
|
||||||
let expertModeQuery = this.elements.expertModeForm.query.value.trim();
|
let expertModeQuery = this.elements.expertModeForm.query.value.trim();
|
||||||
let query = queryModeId === 'corpus-analysis-concordance-expert-mode-form' ? expertModeQuery : queryBuilderQuery;
|
let query = queryModeId === 'corpus-analysis-concordance-expert-mode-form' ? expertModeQuery : queryBuilderQuery;
|
||||||
let form = queryModeId === 'corpus-analysis-concordance-expert-mode-form' ? this.elements.expertModeForm : this.elements.queryBuilderForm;
|
let form = queryModeId === 'corpus-analysis-concordance-expert-mode-form' ? this.elements.expertModeForm : this.elements.queryBuilderForm;
|
||||||
@ -171,11 +171,11 @@ class CorpusAnalysisConcordance {
|
|||||||
this.elements.subcorpusActions.querySelector('.subcorpus-export-trigger').addEventListener('click', (event) => {
|
this.elements.subcorpusActions.querySelector('.subcorpus-export-trigger').addEventListener('click', (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let subcorpus = this.data.subcorpora[this.settings.selectedSubcorpus];
|
let subcorpus = this.data.subcorpora[this.settings.selectedSubcorpus];
|
||||||
let modalElementId = Utils.generateElementId('export-subcorpus-modal-');
|
let modalElementId = nopaque.Utils.generateElementId('export-subcorpus-modal-');
|
||||||
let exportFormatSelectElementId = Utils.generateElementId('export-format-select-');
|
let exportFormatSelectElementId = nopaque.Utils.generateElementId('export-format-select-');
|
||||||
let exportSelectedMatchesOnlyCheckboxElementId = Utils.generateElementId('export-selected-matches-only-checkbox-');
|
let exportSelectedMatchesOnlyCheckboxElementId = nopaque.Utils.generateElementId('export-selected-matches-only-checkbox-');
|
||||||
let exportFileNameInputElementId = Utils.generateElementId('export-file-name-input-');
|
let exportFileNameInputElementId = nopaque.Utils.generateElementId('export-file-name-input-');
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal" id="${modalElementId}">
|
<div class="modal" id="${modalElementId}">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
@ -112,7 +112,7 @@ class CorpusAnalysisReader {
|
|||||||
if (this.data.corpus.p.pages === 0) {return;}
|
if (this.data.corpus.p.pages === 0) {return;}
|
||||||
let pageElement;
|
let pageElement;
|
||||||
// First page button. Disables first page button if on first page
|
// First page button. Disables first page button if on first page
|
||||||
pageElement = Utils.HTMLToElement(
|
pageElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<li class="${this.data.corpus.p.page === 1 ? 'disabled' : 'waves-effect'}">
|
<li class="${this.data.corpus.p.page === 1 ? 'disabled' : 'waves-effect'}">
|
||||||
<a class="corpus-analysis-action pagination-trigger" ${this.data.corpus.p.page === 1 ? '' : 'data-target="1"'}>
|
<a class="corpus-analysis-action pagination-trigger" ${this.data.corpus.p.page === 1 ? '' : 'data-target="1"'}>
|
||||||
@ -123,7 +123,7 @@ class CorpusAnalysisReader {
|
|||||||
);
|
);
|
||||||
this.elements.corpusPagination.appendChild(pageElement);
|
this.elements.corpusPagination.appendChild(pageElement);
|
||||||
// Previous page button. Disables previous page button if on first page
|
// Previous page button. Disables previous page button if on first page
|
||||||
pageElement = Utils.HTMLToElement(
|
pageElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<li class="${this.data.corpus.p.has_prev ? 'waves-effect' : 'disabled'}">
|
<li class="${this.data.corpus.p.has_prev ? 'waves-effect' : 'disabled'}">
|
||||||
<a class="corpus-analysis-action pagination-trigger" ${this.data.corpus.p.has_prev ? 'data-target="' + this.data.corpus.p.prev_num + '"' : ''}>
|
<a class="corpus-analysis-action pagination-trigger" ${this.data.corpus.p.has_prev ? 'data-target="' + this.data.corpus.p.prev_num + '"' : ''}>
|
||||||
@ -135,7 +135,7 @@ class CorpusAnalysisReader {
|
|||||||
this.elements.corpusPagination.appendChild(pageElement);
|
this.elements.corpusPagination.appendChild(pageElement);
|
||||||
// First page as number. Hides first page button if on first page
|
// First page as number. Hides first page button if on first page
|
||||||
if (this.data.corpus.p.page > 6) {
|
if (this.data.corpus.p.page > 6) {
|
||||||
pageElement = Utils.HTMLToElement(
|
pageElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<li class="waves-effect">
|
<li class="waves-effect">
|
||||||
<a class="corpus-analysis-action pagination-trigger" data-target="1">1</a>
|
<a class="corpus-analysis-action pagination-trigger" data-target="1">1</a>
|
||||||
@ -143,14 +143,14 @@ class CorpusAnalysisReader {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
this.elements.corpusPagination.appendChild(pageElement);
|
this.elements.corpusPagination.appendChild(pageElement);
|
||||||
pageElement = Utils.HTMLToElement("<li style='margin-top: 5px;'>…</li>");
|
pageElement = nopaque.Utils.HTMLToElement("<li style='margin-top: 5px;'>…</li>");
|
||||||
this.elements.corpusPagination.appendChild(pageElement);
|
this.elements.corpusPagination.appendChild(pageElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// render page buttons (5 before and 5 after current page)
|
// render page buttons (5 before and 5 after current page)
|
||||||
for (let i = this.data.corpus.p.page - this.settings.pagination.innerWindow; i <= this.data.corpus.p.page; i++) {
|
for (let i = this.data.corpus.p.page - this.settings.pagination.innerWindow; i <= this.data.corpus.p.page; i++) {
|
||||||
if (i <= 0) {continue;}
|
if (i <= 0) {continue;}
|
||||||
pageElement = Utils.HTMLToElement(
|
pageElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<li class="${i === this.data.corpus.p.page ? 'active' : 'waves-effect'}">
|
<li class="${i === this.data.corpus.p.page ? 'active' : 'waves-effect'}">
|
||||||
<a class="corpus-analysis-action pagination-trigger" ${i === this.data.corpus.p.page ? '' : 'data-target="' + i + '"'}>${i}</a>
|
<a class="corpus-analysis-action pagination-trigger" ${i === this.data.corpus.p.page ? '' : 'data-target="' + i + '"'}>${i}</a>
|
||||||
@ -161,7 +161,7 @@ class CorpusAnalysisReader {
|
|||||||
};
|
};
|
||||||
for (let i = this.data.corpus.p.page +1; i <= this.data.corpus.p.page + this.settings.pagination.innerWindow; i++) {
|
for (let i = this.data.corpus.p.page +1; i <= this.data.corpus.p.page + this.settings.pagination.innerWindow; i++) {
|
||||||
if (i > this.data.corpus.p.pages) {break;}
|
if (i > this.data.corpus.p.pages) {break;}
|
||||||
pageElement = Utils.HTMLToElement(
|
pageElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<li class="${i === this.data.corpus.p.page ? 'active' : 'waves-effect'}">
|
<li class="${i === this.data.corpus.p.page ? 'active' : 'waves-effect'}">
|
||||||
<a class="corpus-analysis-action pagination-trigger" ${i === this.data.corpus.p.page ? '' : 'data-target="' + i + '"'}>${i}</a>
|
<a class="corpus-analysis-action pagination-trigger" ${i === this.data.corpus.p.page ? '' : 'data-target="' + i + '"'}>${i}</a>
|
||||||
@ -172,9 +172,9 @@ class CorpusAnalysisReader {
|
|||||||
};
|
};
|
||||||
// Last page as number. Hides last page button if on last page
|
// Last page as number. Hides last page button if on last page
|
||||||
if (this.data.corpus.p.page < this.data.corpus.p.pages - 6) {
|
if (this.data.corpus.p.page < this.data.corpus.p.pages - 6) {
|
||||||
pageElement = Utils.HTMLToElement("<li style='margin-top: 5px;'>…</li>");
|
pageElement = nopaque.Utils.HTMLToElement("<li style='margin-top: 5px;'>…</li>");
|
||||||
this.elements.corpusPagination.appendChild(pageElement);
|
this.elements.corpusPagination.appendChild(pageElement);
|
||||||
pageElement = Utils.HTMLToElement(
|
pageElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<li class="waves-effect">
|
<li class="waves-effect">
|
||||||
<a class="corpus-analysis-action pagination-trigger" data-target="${this.data.corpus.p.pages}">${this.data.corpus.p.pages}</a>
|
<a class="corpus-analysis-action pagination-trigger" data-target="${this.data.corpus.p.pages}">${this.data.corpus.p.pages}</a>
|
||||||
@ -184,7 +184,7 @@ class CorpusAnalysisReader {
|
|||||||
this.elements.corpusPagination.appendChild(pageElement);
|
this.elements.corpusPagination.appendChild(pageElement);
|
||||||
}
|
}
|
||||||
// Next page button. Disables next page button if on last page
|
// Next page button. Disables next page button if on last page
|
||||||
pageElement = Utils.HTMLToElement(
|
pageElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<li class="${this.data.corpus.p.has_next ? 'waves-effect' : 'disabled'}">
|
<li class="${this.data.corpus.p.has_next ? 'waves-effect' : 'disabled'}">
|
||||||
<a class="corpus-analysis-action pagination-trigger" ${this.data.corpus.p.has_next ? 'data-target="' + this.data.corpus.p.next_num + '"' : ''}>
|
<a class="corpus-analysis-action pagination-trigger" ${this.data.corpus.p.has_next ? 'data-target="' + this.data.corpus.p.next_num + '"' : ''}>
|
||||||
@ -195,7 +195,7 @@ class CorpusAnalysisReader {
|
|||||||
);
|
);
|
||||||
this.elements.corpusPagination.appendChild(pageElement);
|
this.elements.corpusPagination.appendChild(pageElement);
|
||||||
// Last page button. Disables last page button if on last page
|
// Last page button. Disables last page button if on last page
|
||||||
pageElement = Utils.HTMLToElement(
|
pageElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<li class="${this.data.corpus.p.page === this.data.corpus.p.pages ? 'disabled' : 'waves-effect'}">
|
<li class="${this.data.corpus.p.page === this.data.corpus.p.pages ? 'disabled' : 'waves-effect'}">
|
||||||
<a class="corpus-analysis-action pagination-trigger" ${this.data.corpus.p.page === this.data.corpus.p.pages ? '' : 'data-target="' + this.data.corpus.p.pages + '"'}>
|
<a class="corpus-analysis-action pagination-trigger" ${this.data.corpus.p.page === this.data.corpus.p.pages ? '' : 'data-target="' + this.data.corpus.p.pages + '"'}>
|
||||||
|
@ -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()
|
nopaque.requests.corpora.entity.getStopwords()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
response.json()
|
response.json()
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
@ -104,7 +104,7 @@ class CorpusAnalysisStaticVisualization {
|
|||||||
renderTextInfoList() {
|
renderTextInfoList() {
|
||||||
let corpusData = this.data.corpus.o.staticData;
|
let corpusData = this.data.corpus.o.staticData;
|
||||||
let corpusTextInfoListElement = document.querySelector('.corpus-text-info-list');
|
let corpusTextInfoListElement = document.querySelector('.corpus-text-info-list');
|
||||||
let corpusTextInfoList = new ResourceLists.CorpusTextInfoList(corpusTextInfoListElement);
|
let corpusTextInfoList = new nopaque.resource_lists.CorpusTextInfoList(corpusTextInfoListElement);
|
||||||
let texts = corpusData.s_attrs.text.lexicon;
|
let texts = corpusData.s_attrs.text.lexicon;
|
||||||
let textData = [];
|
let textData = [];
|
||||||
for (let i = 0; i < Object.entries(texts).length; i++) {
|
for (let i = 0; i < Object.entries(texts).length; i++) {
|
||||||
@ -213,7 +213,7 @@ class CorpusAnalysisStaticVisualization {
|
|||||||
|
|
||||||
async renderTokenList() {
|
async renderTokenList() {
|
||||||
let corpusTokenListElement = document.querySelector('.corpus-token-list');
|
let corpusTokenListElement = document.querySelector('.corpus-token-list');
|
||||||
let corpusTokenList = new ResourceLists.CorpusTokenList(corpusTokenListElement);
|
let corpusTokenList = new nopaque.resource_lists.CorpusTokenList(corpusTokenListElement);
|
||||||
let filteredData = this.filterData();
|
let filteredData = this.filterData();
|
||||||
let stopwords = this.data.stopwords;
|
let stopwords = this.data.stopwords;
|
||||||
if (this.data.stopwords === undefined) {
|
if (this.data.stopwords === undefined) {
|
||||||
@ -358,7 +358,7 @@ class CorpusAnalysisStaticVisualization {
|
|||||||
if (stopwordLanguageSelection.children.length === 0) {
|
if (stopwordLanguageSelection.children.length === 0) {
|
||||||
Object.keys(stopwords).forEach(language => {
|
Object.keys(stopwords).forEach(language => {
|
||||||
if (language !== 'user_stopwords') {
|
if (language !== 'user_stopwords') {
|
||||||
let optionElement = Utils.HTMLToElement(`<option value="${language}" ${language === 'english' ? 'selected' : ''}>${language}</option>`);
|
let optionElement = nopaque.Utils.HTMLToElement(`<option value="${language}" ${language === 'english' ? 'selected' : ''}>${language}</option>`);
|
||||||
stopwordLanguageSelection.appendChild(optionElement);
|
stopwordLanguageSelection.appendChild(optionElement);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -367,7 +367,7 @@ class CorpusAnalysisStaticVisualization {
|
|||||||
// Render user stopwords over input field.
|
// Render user stopwords over input field.
|
||||||
if (this.data.stopwords['user_stopwords'].length > 0) {
|
if (this.data.stopwords['user_stopwords'].length > 0) {
|
||||||
for (let word of this.data.stopwords['user_stopwords']) {
|
for (let word of this.data.stopwords['user_stopwords']) {
|
||||||
let chipElement = Utils.HTMLToElement(`<div class="chip">${word}<i class="close material-icons">close</i></div>`);
|
let chipElement = nopaque.Utils.HTMLToElement(`<div class="chip">${word}<i class="close material-icons">close</i></div>`);
|
||||||
chipElement.addEventListener('click', (event) => {
|
chipElement.addEventListener('click', (event) => {
|
||||||
let removedListItem = event.target.closest('.chip').firstChild.textContent;
|
let removedListItem = event.target.closest('.chip').firstChild.textContent;
|
||||||
this.data.stopwords['user_stopwords'] = structuredClone(this.data.stopwords['user_stopwords'].filter(item => item !== removedListItem));
|
this.data.stopwords['user_stopwords'] = structuredClone(this.data.stopwords['user_stopwords'].filter(item => item !== removedListItem));
|
||||||
@ -433,7 +433,7 @@ class CorpusAnalysisStaticVisualization {
|
|||||||
let stopwordLanguageChipList = document.querySelector('#stopword-language-chip-list');
|
let stopwordLanguageChipList = document.querySelector('#stopword-language-chip-list');
|
||||||
stopwordLanguageChipList.innerHTML = '';
|
stopwordLanguageChipList.innerHTML = '';
|
||||||
for (let word of stopwords) {
|
for (let word of stopwords) {
|
||||||
let chipElement = Utils.HTMLToElement(`<div class="chip">${word}<i class="close material-icons">close</i></div>`);
|
let chipElement = nopaque.Utils.HTMLToElement(`<div class="chip">${word}<i class="close material-icons">close</i></div>`);
|
||||||
chipElement.addEventListener('click', (event) => {
|
chipElement.addEventListener('click', (event) => {
|
||||||
let removedListItem = event.target.closest('.chip').firstChild.textContent;
|
let removedListItem = event.target.closest('.chip').firstChild.textContent;
|
||||||
this.data.stopwords[language] = structuredClone(this.data.stopwords[language].filter(item => item !== removedListItem));
|
this.data.stopwords[language] = structuredClone(this.data.stopwords[language].filter(item => item !== removedListItem));
|
||||||
|
@ -28,7 +28,7 @@ class GeneralQueryBuilderFunctions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addPlaceholder() {
|
addPlaceholder() {
|
||||||
let placeholder = Utils.HTMLToElement('<span id="corpus-analysis-concordance-query-builder-input-field-placeholder">Click on a button to add a query component</span>');
|
let placeholder = nopaque.Utils.HTMLToElement('<span id="corpus-analysis-concordance-query-builder-input-field-placeholder">Click on a button to add a query component</span>');
|
||||||
this.elements.queryInputField.appendChild(placeholder);
|
this.elements.queryInputField.appendChild(placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,9 +58,9 @@ class GeneralQueryBuilderFunctions {
|
|||||||
|
|
||||||
queryChipFactory(dataType, prettyQueryText, queryText, index = null, isClosingTag = false, isEditable = false) {
|
queryChipFactory(dataType, prettyQueryText, queryText, index = null, isClosingTag = false, isEditable = false) {
|
||||||
// Creates a new query chip element, adds Eventlisteners for selection, deletion and drag and drop and appends it to the query input field.
|
// Creates a new query chip element, adds Eventlisteners for selection, deletion and drag and drop and appends it to the query input field.
|
||||||
queryText = Utils.escape(queryText);
|
queryText = nopaque.Utils.escape(queryText);
|
||||||
prettyQueryText = Utils.escape(prettyQueryText);
|
prettyQueryText = nopaque.Utils.escape(prettyQueryText);
|
||||||
let queryChipElement = Utils.HTMLToElement(
|
let queryChipElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<span class="chip query-component" data-type="${dataType}" data-query="${queryText}" draggable="true" data-closing-tag="${isClosingTag}">
|
<span class="chip query-component" data-type="${dataType}" data-query="${queryText}" draggable="true" data-closing-tag="${isClosingTag}">
|
||||||
${prettyQueryText}${isEditable ? '<i class="material-icons chip-action-button" data-chip-action="edit" style="padding-left:5px; font-size:18px; cursor:pointer;">edit</i>': ''}
|
${prettyQueryText}${isEditable ? '<i class="material-icons chip-action-button" data-chip-action="edit" style="padding-left:5px; font-size:18px; cursor:pointer;">edit</i>': ''}
|
||||||
@ -276,7 +276,7 @@ class GeneralQueryBuilderFunctions {
|
|||||||
queryChips = this.elements.queryInputField.querySelectorAll('.query-component[data-type="token"]');
|
queryChips = this.elements.queryInputField.querySelectorAll('.query-component[data-type="token"]');
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let targetChipElement = Utils.HTMLToElement('<span class="chip drop-target">Drop here</span>');
|
let targetChipElement = nopaque.Utils.HTMLToElement('<span class="chip drop-target">Drop here</span>');
|
||||||
for (let element of queryChips) {
|
for (let element of queryChips) {
|
||||||
if (element === this.elements.queryInputField.querySelectorAll('.query-component')[0]) {
|
if (element === this.elements.queryInputField.querySelectorAll('.query-component')[0]) {
|
||||||
let secondTargetChipClone = targetChipElement.cloneNode(true);
|
let secondTargetChipClone = targetChipElement.cloneNode(true);
|
||||||
@ -324,7 +324,7 @@ class GeneralQueryBuilderFunctions {
|
|||||||
this.elements.queryChipElements.forEach(element => {
|
this.elements.queryChipElements.forEach(element => {
|
||||||
let queryElement = element.dataset.query;
|
let queryElement = element.dataset.query;
|
||||||
if (queryElement !== undefined) {
|
if (queryElement !== undefined) {
|
||||||
queryElement = Utils.escape(queryElement);
|
queryElement = nopaque.Utils.escape(queryElement);
|
||||||
}
|
}
|
||||||
queryInputFieldContent.push(queryElement);
|
queryInputFieldContent.push(queryElement);
|
||||||
});
|
});
|
||||||
|
@ -179,7 +179,7 @@ nopaque.App = class App {
|
|||||||
{
|
{
|
||||||
dismissible: false,
|
dismissible: false,
|
||||||
onCloseEnd: (modalElement) => {
|
onCloseEnd: (modalElement) => {
|
||||||
Requests.users.entity.acceptTermsOfUse();
|
nopaque.requests.users.entity.acceptTermsOfUse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -188,9 +188,9 @@ nopaque.App = class App {
|
|||||||
|
|
||||||
/* Initialize nopaque Components */
|
/* Initialize nopaque Components */
|
||||||
// #region
|
// #region
|
||||||
ResourceDisplays.AutoInit();
|
nopaque.resource_displays.AutoInit();
|
||||||
ResourceLists.AutoInit();
|
nopaque.resource_lists.AutoInit();
|
||||||
Forms.AutoInit();
|
nopaque.forms.AutoInit();
|
||||||
// #endregion
|
// #endregion
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,4 +1,4 @@
|
|||||||
Forms.BaseForm = class BaseForm {
|
nopaque.forms.BaseForm = class BaseForm {
|
||||||
static htmlClass;
|
static htmlClass;
|
||||||
|
|
||||||
constructor(formElement) {
|
constructor(formElement) {
|
||||||
@ -28,7 +28,7 @@ Forms.BaseForm = class BaseForm {
|
|||||||
|
|
||||||
submit(event) {
|
submit(event) {
|
||||||
let request = new XMLHttpRequest();
|
let request = new XMLHttpRequest();
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -67,7 +67,7 @@ Forms.BaseForm = class BaseForm {
|
|||||||
for (let selectElement of this.formElement.querySelectorAll('select')) {
|
for (let selectElement of this.formElement.querySelectorAll('select')) {
|
||||||
if (selectElement.value === '') {
|
if (selectElement.value === '') {
|
||||||
let inputFieldElement = selectElement.closest('.input-field');
|
let inputFieldElement = selectElement.closest('.input-field');
|
||||||
let errorHelperTextElement = Utils.HTMLToElement(
|
let errorHelperTextElement = nopaque.Utils.HTMLToElement(
|
||||||
'<span class="helper-text error-color-text" data-helper-text-type="error">Please select an option.</span>'
|
'<span class="helper-text error-color-text" data-helper-text-type="error">Please select an option.</span>'
|
||||||
);
|
);
|
||||||
inputFieldElement.appendChild(errorHelperTextElement);
|
inputFieldElement.appendChild(errorHelperTextElement);
|
||||||
@ -93,7 +93,7 @@ Forms.BaseForm = class BaseForm {
|
|||||||
.querySelector(`input[name$="${inputName}"], select[name$="${inputName}"]`)
|
.querySelector(`input[name$="${inputName}"], select[name$="${inputName}"]`)
|
||||||
.closest('.input-field');
|
.closest('.input-field');
|
||||||
for (let inputError of inputErrors) {
|
for (let inputError of inputErrors) {
|
||||||
let errorHelperTextElement = Utils.HTMLToElement(
|
let errorHelperTextElement = nopaque.Utils.HTMLToElement(
|
||||||
`<span class="helper-text error-color-text" data-helper-type="error">${inputError}</span>`
|
`<span class="helper-text error-color-text" data-helper-type="error">${inputError}</span>`
|
||||||
);
|
);
|
||||||
inputFieldElement.appendChild(errorHelperTextElement);
|
inputFieldElement.appendChild(errorHelperTextElement);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Forms.CreateContributionForm = class CreateContributionForm extends Forms.BaseForm {
|
nopaque.forms.CreateContributionForm = class CreateContributionForm extends nopaque.forms.BaseForm {
|
||||||
static htmlClass = 'create-contribution-form';
|
static htmlClass = 'create-contribution-form';
|
||||||
|
|
||||||
constructor(formElement) {
|
constructor(formElement) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Forms.CreateCorpusFileForm = class CreateCorpusFileForm extends Forms.BaseForm {
|
nopaque.forms.CreateCorpusFileForm = class CreateCorpusFileForm extends nopaque.forms.BaseForm {
|
||||||
static htmlClass = 'create-corpus-file-form';
|
static htmlClass = 'create-corpus-file-form';
|
||||||
|
|
||||||
constructor(formElement) {
|
constructor(formElement) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Forms.CreateJobForm = class CreateJobForm extends Forms.BaseForm {
|
nopaque.forms.CreateJobForm = class CreateJobForm extends nopaque.forms.BaseForm {
|
||||||
static htmlClass = 'create-job-form';
|
static htmlClass = 'create-job-form';
|
||||||
|
|
||||||
constructor(formElement) {
|
constructor(formElement) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
var Forms = {};
|
nopaque.forms = {};
|
||||||
|
|
||||||
Forms.AutoInit = () => {
|
nopaque.forms.AutoInit = () => {
|
||||||
for (let propertyName in Forms) {
|
for (let propertyName in nopaque.forms) {
|
||||||
let property = Forms[propertyName];
|
let property = nopaque.forms[propertyName];
|
||||||
// Call autoInit of all properties that are subclasses of Forms.BaseForm.
|
// Call autoInit of all properties that are subclasses of nopaque.forms.BaseForm.
|
||||||
// This does not include Forms.BaseForm itself.
|
// This does not include nopaque.forms.BaseForm itself.
|
||||||
if (property.prototype instanceof Forms.BaseForm) {
|
if (property.prototype instanceof nopaque.forms.BaseForm) {
|
||||||
// Check if the static htmlClass property is defined.
|
// Check if the static htmlClass property is defined.
|
||||||
if (property.htmlClass === undefined) {return;}
|
if (property.htmlClass === undefined) {return;}
|
||||||
// Gather all HTML elements that have the `this.htmlClass` class
|
// Gather all HTML elements that have the `this.htmlClass` class
|
||||||
|
5
app/static/js/index.js
Normal file
5
app/static/js/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* This object functions as a global namespace for nopaque.
|
||||||
|
* All components of nopaque should be attached to this object.
|
||||||
|
*/
|
||||||
|
var nopaque = {};
|
@ -1 +0,0 @@
|
|||||||
var nopaque = {};
|
|
@ -1,19 +1,19 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /admin routes *
|
* Requests for /admin routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.admin = {};
|
nopaque.requests.admin = {};
|
||||||
|
|
||||||
Requests.admin.users = {};
|
nopaque.requests.admin.users = {};
|
||||||
|
|
||||||
Requests.admin.users.entity = {};
|
nopaque.requests.admin.users.entity = {};
|
||||||
|
|
||||||
Requests.admin.users.entity.confirmed = {};
|
nopaque.requests.admin.users.entity.confirmed = {};
|
||||||
|
|
||||||
Requests.admin.users.entity.confirmed.update = (userId, value) => {
|
nopaque.requests.admin.users.entity.confirmed.update = (userId, value) => {
|
||||||
let input = `/admin/users/${userId}/confirmed`;
|
let input = `/admin/users/${userId}/confirmed`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(value)
|
body: JSON.stringify(value)
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
@ -1,58 +1,58 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /contributions routes *
|
* Requests for /contributions routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.contributions = {};
|
nopaque.requests.contributions = {};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /contributions/spacy-nlp-pipeline-models routes *
|
* Requests for /contributions/spacy-nlp-pipeline-models routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.contributions.spacy_nlp_pipeline_models = {};
|
nopaque.requests.contributions.spacy_nlp_pipeline_models = {};
|
||||||
|
|
||||||
Requests.contributions.spacy_nlp_pipeline_models.entity = {};
|
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity = {};
|
||||||
|
|
||||||
Requests.contributions.spacy_nlp_pipeline_models.entity.delete = (spacyNlpPipelineModelId) => {
|
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity.delete = (spacyNlpPipelineModelId) => {
|
||||||
let input = `/contributions/spacy-nlp-pipeline-models/${spacyNlpPipelineModelId}`;
|
let input = `/contributions/spacy-nlp-pipeline-models/${spacyNlpPipelineModelId}`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.contributions.spacy_nlp_pipeline_models.entity.isPublic = {};
|
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity.isPublic = {};
|
||||||
|
|
||||||
Requests.contributions.spacy_nlp_pipeline_models.entity.isPublic.update = (spacyNlpPipelineModelId, value) => {
|
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity.isPublic.update = (spacyNlpPipelineModelId, value) => {
|
||||||
let input = `/contributions/spacy-nlp-pipeline-models/${spacyNlpPipelineModelId}/is_public`;
|
let input = `/contributions/spacy-nlp-pipeline-models/${spacyNlpPipelineModelId}/is_public`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(value)
|
body: JSON.stringify(value)
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /contributions/tesseract-ocr-pipeline-models routes *
|
* Requests for /contributions/tesseract-ocr-pipeline-models routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.contributions.tesseract_ocr_pipeline_models = {};
|
nopaque.requests.contributions.tesseract_ocr_pipeline_models = {};
|
||||||
|
|
||||||
Requests.contributions.tesseract_ocr_pipeline_models.entity = {};
|
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity = {};
|
||||||
|
|
||||||
Requests.contributions.tesseract_ocr_pipeline_models.entity.delete = (tesseractOcrPipelineModelId) => {
|
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity.delete = (tesseractOcrPipelineModelId) => {
|
||||||
let input = `/contributions/tesseract-ocr-pipeline-models/${tesseractOcrPipelineModelId}`;
|
let input = `/contributions/tesseract-ocr-pipeline-models/${tesseractOcrPipelineModelId}`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic = {};
|
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic = {};
|
||||||
|
|
||||||
Requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic.update = (tesseractOcrPipelineModelId, value) => {
|
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic.update = (tesseractOcrPipelineModelId, value) => {
|
||||||
let input = `/contributions/tesseract-ocr-pipeline-models/${tesseractOcrPipelineModelId}/is_public`;
|
let input = `/contributions/tesseract-ocr-pipeline-models/${tesseractOcrPipelineModelId}/is_public`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(value)
|
body: JSON.stringify(value)
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
@ -1,102 +1,102 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /corpora routes *
|
* Requests for /corpora routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.corpora = {};
|
nopaque.requests.corpora = {};
|
||||||
|
|
||||||
Requests.corpora.entity = {};
|
nopaque.requests.corpora.entity = {};
|
||||||
|
|
||||||
Requests.corpora.entity.delete = (corpusId) => {
|
nopaque.requests.corpora.entity.delete = (corpusId) => {
|
||||||
let input = `/corpora/${corpusId}`;
|
let input = `/corpora/${corpusId}`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.corpora.entity.build = (corpusId) => {
|
nopaque.requests.corpora.entity.build = (corpusId) => {
|
||||||
let input = `/corpora/${corpusId}/build`;
|
let input = `/corpora/${corpusId}/build`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.corpora.entity.generateShareLink = (corpusId, role, expiration) => {
|
nopaque.requests.corpora.entity.generateShareLink = (corpusId, role, expiration) => {
|
||||||
let input = `/corpora/${corpusId}/generate-share-link`;
|
let input = `/corpora/${corpusId}/generate-share-link`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({role: role, expiration: expiration})
|
body: JSON.stringify({role: role, expiration: expiration})
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.corpora.entity.getStopwords = () => {
|
nopaque.requests.corpora.entity.getStopwords = () => {
|
||||||
let input = `/corpora/stopwords`;
|
let input = `/corpora/stopwords`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.corpora.entity.isPublic = {};
|
nopaque.requests.corpora.entity.isPublic = {};
|
||||||
|
|
||||||
Requests.corpora.entity.isPublic.update = (corpusId, isPublic) => {
|
nopaque.requests.corpora.entity.isPublic.update = (corpusId, isPublic) => {
|
||||||
let input = `/corpora/${corpusId}/is_public`;
|
let input = `/corpora/${corpusId}/is_public`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(isPublic)
|
body: JSON.stringify(isPublic)
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /corpora/<entity>/files routes *
|
* Requests for /corpora/<entity>/files routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.corpora.entity.files = {};
|
nopaque.requests.corpora.entity.files = {};
|
||||||
|
|
||||||
Requests.corpora.entity.files.ent = {};
|
nopaque.requests.corpora.entity.files.ent = {};
|
||||||
|
|
||||||
Requests.corpora.entity.files.ent.delete = (corpusId, corpusFileId) => {
|
nopaque.requests.corpora.entity.files.ent.delete = (corpusId, corpusFileId) => {
|
||||||
let input = `/corpora/${corpusId}/files/${corpusFileId}`;
|
let input = `/corpora/${corpusId}/files/${corpusFileId}`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /corpora/<entity>/followers routes *
|
* Requests for /corpora/<entity>/followers routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.corpora.entity.followers = {};
|
nopaque.requests.corpora.entity.followers = {};
|
||||||
|
|
||||||
Requests.corpora.entity.followers.add = (corpusId, usernames) => {
|
nopaque.requests.corpora.entity.followers.add = (corpusId, usernames) => {
|
||||||
let input = `/corpora/${corpusId}/followers`;
|
let input = `/corpora/${corpusId}/followers`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(usernames)
|
body: JSON.stringify(usernames)
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.corpora.entity.followers.entity = {};
|
nopaque.requests.corpora.entity.followers.entity = {};
|
||||||
|
|
||||||
Requests.corpora.entity.followers.entity.delete = (corpusId, followerId) => {
|
nopaque.requests.corpora.entity.followers.entity.delete = (corpusId, followerId) => {
|
||||||
let input = `/corpora/${corpusId}/followers/${followerId}`;
|
let input = `/corpora/${corpusId}/followers/${followerId}`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.corpora.entity.followers.entity.role = {};
|
nopaque.requests.corpora.entity.followers.entity.role = {};
|
||||||
|
|
||||||
Requests.corpora.entity.followers.entity.role.update = (corpusId, followerId, value) => {
|
nopaque.requests.corpora.entity.followers.entity.role.update = (corpusId, followerId, value) => {
|
||||||
let input = `/corpora/${corpusId}/followers/${followerId}/role`;
|
let input = `/corpora/${corpusId}/followers/${followerId}/role`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(value)
|
body: JSON.stringify(value)
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var Requests = {};
|
nopaque.requests = {};
|
||||||
|
|
||||||
Requests.JSONfetch = (input, init={}) => {
|
nopaque.requests.JSONfetch = (input, init={}) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let fixedInit = {};
|
let fixedInit = {};
|
||||||
fixedInit.headers = {};
|
fixedInit.headers = {};
|
||||||
@ -8,7 +8,7 @@ Requests.JSONfetch = (input, init={}) => {
|
|||||||
if (init.hasOwnProperty('body')) {
|
if (init.hasOwnProperty('body')) {
|
||||||
fixedInit.headers['Content-Type'] = 'application/json';
|
fixedInit.headers['Content-Type'] = 'application/json';
|
||||||
}
|
}
|
||||||
fetch(input, Utils.mergeObjectsDeep(init, fixedInit))
|
fetch(input, nopaque.Utils.mergeObjectsDeep(init, fixedInit))
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /jobs routes *
|
* Requests for /jobs routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.jobs = {};
|
nopaque.requests.jobs = {};
|
||||||
|
|
||||||
Requests.jobs.entity = {};
|
nopaque.requests.jobs.entity = {};
|
||||||
|
|
||||||
Requests.jobs.entity.delete = (jobId) => {
|
nopaque.requests.jobs.entity.delete = (jobId) => {
|
||||||
let input = `/jobs/${jobId}`;
|
let input = `/jobs/${jobId}`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.jobs.entity.log = (jobId) => {
|
nopaque.requests.jobs.entity.log = (jobId) => {
|
||||||
let input = `/jobs/${jobId}/log`;
|
let input = `/jobs/${jobId}/log`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.jobs.entity.restart = (jobId) => {
|
nopaque.requests.jobs.entity.restart = (jobId) => {
|
||||||
let input = `/jobs/${jobId}/restart`;
|
let input = `/jobs/${jobId}/restart`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
@ -2,50 +2,50 @@
|
|||||||
* Users *
|
* Users *
|
||||||
* Fetch requests for /users routes *
|
* Fetch requests for /users routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.users = {};
|
nopaque.requests.users = {};
|
||||||
|
|
||||||
Requests.users.entity = {};
|
nopaque.requests.users.entity = {};
|
||||||
|
|
||||||
Requests.users.entity.delete = (userId) => {
|
nopaque.requests.users.entity.delete = (userId) => {
|
||||||
let input = `/users/${userId}`;
|
let input = `/users/${userId}`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.users.entity.acceptTermsOfUse = () => {
|
nopaque.requests.users.entity.acceptTermsOfUse = () => {
|
||||||
let input = `/users/accept-terms-of-use`;
|
let input = `/users/accept-terms-of-use`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
Requests.users.entity.avatar = {};
|
nopaque.requests.users.entity.avatar = {};
|
||||||
|
|
||||||
Requests.users.entity.avatar.delete = (userId) => {
|
nopaque.requests.users.entity.avatar.delete = (userId) => {
|
||||||
let input = `/users/${userId}/avatar`;
|
let input = `/users/${userId}/avatar`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Requests for /users/<entity>/settings routes *
|
* Requests for /users/<entity>/settings routes *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
Requests.users.entity.settings = {};
|
nopaque.requests.users.entity.settings = {};
|
||||||
|
|
||||||
Requests.users.entity.settings.profilePrivacy = {};
|
nopaque.requests.users.entity.settings.profilePrivacy = {};
|
||||||
|
|
||||||
Requests.users.entity.settings.profilePrivacy.update = (userId, profilePrivacySetting, enabled) => {
|
nopaque.requests.users.entity.settings.profilePrivacy.update = (userId, profilePrivacySetting, enabled) => {
|
||||||
let input = `/users/${userId}/settings/profile-privacy/${profilePrivacySetting}`;
|
let input = `/users/${userId}/settings/profile-privacy/${profilePrivacySetting}`;
|
||||||
let init = {
|
let init = {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(enabled)
|
body: JSON.stringify(enabled)
|
||||||
};
|
};
|
||||||
return Requests.JSONfetch(input, init);
|
return nopaque.requests.JSONfetch(input, init);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceDisplays.CorpusDisplay = class CorpusDisplay extends ResourceDisplays.ResourceDisplay {
|
nopaque.resource_displays.CorpusDisplay = class CorpusDisplay extends nopaque.resource_displays.ResourceDisplay {
|
||||||
static htmlClass = 'corpus-display';
|
static htmlClass = 'corpus-display';
|
||||||
|
|
||||||
constructor(displayElement) {
|
constructor(displayElement) {
|
||||||
@ -7,7 +7,7 @@ ResourceDisplays.CorpusDisplay = class CorpusDisplay extends ResourceDisplays.Re
|
|||||||
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);
|
nopaque.requests.corpora.entity.build(this.corpusId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
var ResourceDisplays = {};
|
nopaque.resource_displays = {};
|
||||||
|
|
||||||
ResourceDisplays.AutoInit = () => {
|
nopaque.resource_displays.AutoInit = () => {
|
||||||
for (let propertyName in ResourceDisplays) {
|
for (let propertyName in nopaque.resource_displays) {
|
||||||
let property = ResourceDisplays[propertyName];
|
let property = nopaque.resource_displays[propertyName];
|
||||||
// Call autoInit of all properties that are subclasses of `ResourceDisplays.ResourceDisplay`.
|
// Call autoInit of all properties that are subclasses of `nopaque.resource_displays.ResourceDisplay`.
|
||||||
// This does not include `ResourceDisplays.ResourceDisplay` itself.
|
// This does not include `nopaque.resource_displays.ResourceDisplay` itself.
|
||||||
if (property.prototype instanceof ResourceDisplays.ResourceDisplay) {
|
if (property.prototype instanceof nopaque.resource_displays.ResourceDisplay) {
|
||||||
// Check if the static `htmlClass` property is defined.
|
// Check if the static `htmlClass` property is defined.
|
||||||
if (property.htmlClass === undefined) {return;}
|
if (property.htmlClass === undefined) {return;}
|
||||||
// Gather all HTML elements that have the `this.htmlClass` class
|
// Gather all HTML elements that have the `this.htmlClass` class
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceDisplays.JobDisplay = class JobDisplay extends ResourceDisplays.ResourceDisplay {
|
nopaque.resource_displays.JobDisplay = class JobDisplay extends nopaque.resource_displays.ResourceDisplay {
|
||||||
static htmlClass = 'job-display';
|
static htmlClass = 'job-display';
|
||||||
|
|
||||||
constructor(displayElement) {
|
constructor(displayElement) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceDisplays.ResourceDisplay = class ResourceDisplay {
|
nopaque.resource_displays.ResourceDisplay = class ResourceDisplay {
|
||||||
static htmlClass;
|
static htmlClass;
|
||||||
|
|
||||||
constructor(displayElement) {
|
constructor(displayElement) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.AdminUserList = class AdminUserList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.AdminUserList = class AdminUserList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'admin-user-list';
|
static htmlClass = 'admin-user-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -37,9 +37,9 @@ ResourceLists.AdminUserList = class AdminUserList extends ResourceLists.Resource
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('user-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('user-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
@ -87,7 +87,7 @@ ResourceLists.AdminUserList = class AdminUserList extends ResourceLists.Resource
|
|||||||
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);
|
nopaque.requests.users.entity.delete(itemId);
|
||||||
if (itemId === currentUserId) {window.location.href = '/';}
|
if (itemId === currentUserId) {window.location.href = '/';}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.CorpusFileList = class CorpusFileList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.CorpusFileList = class CorpusFileList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'corpus-file-list';
|
static htmlClass = 'corpus-file-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -62,9 +62,9 @@ ResourceLists.CorpusFileList = class CorpusFileList extends ResourceLists.Resour
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('corpus-file-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('corpus-file-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
@ -121,7 +121,7 @@ ResourceLists.CorpusFileList = class CorpusFileList extends ResourceLists.Resour
|
|||||||
switch (listAction) {
|
switch (listAction) {
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
let values = this.listjs.get('id', itemId)[0].values();
|
let values = this.listjs.get('id', itemId)[0].values();
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -149,12 +149,12 @@ ResourceLists.CorpusFileList = class CorpusFileList extends ResourceLists.Resour
|
|||||||
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)
|
nopaque.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)
|
nopaque.requests.corpora.entity.files.ent.delete(this.corpusId, itemId)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
@ -208,7 +208,7 @@ ResourceLists.CorpusFileList = class CorpusFileList extends ResourceLists.Resour
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -229,7 +229,7 @@ ResourceLists.CorpusFileList = class CorpusFileList extends ResourceLists.Resour
|
|||||||
this.selectedItemIds.forEach(selectedItemId => {
|
this.selectedItemIds.forEach(selectedItemId => {
|
||||||
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();
|
||||||
let itemElement = Utils.HTMLToElement(`<li> - ${values.title}</li>`);
|
let itemElement = nopaque.Utils.HTMLToElement(`<li> - ${values.title}</li>`);
|
||||||
itemList.appendChild(itemElement);
|
itemList.appendChild(itemElement);
|
||||||
});
|
});
|
||||||
let modal = M.Modal.init(
|
let modal = M.Modal.init(
|
||||||
@ -246,12 +246,12 @@ ResourceLists.CorpusFileList = class CorpusFileList extends ResourceLists.Resour
|
|||||||
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)
|
nopaque.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);
|
nopaque.requests.corpora.entity.files.ent.delete(this.corpusId, selectedItemId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.selectedItemIds.clear();
|
this.selectedItemIds.clear();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.CorpusFollowerList = class CorpusFollowerList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.CorpusFollowerList = class CorpusFollowerList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'corpus-follower-list';
|
static htmlClass = 'corpus-follower-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -68,9 +68,9 @@ ResourceLists.CorpusFollowerList = class CorpusFollowerList extends ResourceList
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('corpus-follower-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('corpus-follower-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
@ -120,7 +120,7 @@ ResourceLists.CorpusFollowerList = 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);
|
nopaque.requests.corpora.entity.followers.entity.role.update(this.corpusId, followerId, roleName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -140,12 +140,12 @@ ResourceLists.CorpusFollowerList = 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)
|
nopaque.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);
|
nopaque.requests.corpora.entity.followers.entity.delete(this.corpusId, followerId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.CorpusList = class CorpusList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.CorpusList = class CorpusList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'corpus-list';
|
static htmlClass = 'corpus-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -93,9 +93,9 @@ ResourceLists.CorpusList = class CorpusList extends ResourceLists.ResourceList {
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('corpus-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('corpus-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
@ -139,7 +139,7 @@ ResourceLists.CorpusList = class CorpusList extends ResourceLists.ResourceList {
|
|||||||
switch (listAction) {
|
switch (listAction) {
|
||||||
case 'delete-request': {
|
case 'delete-request': {
|
||||||
let values = this.listjs.get('id', itemId)[0].values();
|
let values = this.listjs.get('id', itemId)[0].values();
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -167,12 +167,12 @@ ResourceLists.CorpusList = class CorpusList extends ResourceLists.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)
|
nopaque.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);
|
nopaque.requests.corpora.entity.delete(itemId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
@ -224,7 +224,7 @@ ResourceLists.CorpusList = class CorpusList extends ResourceLists.ResourceList {
|
|||||||
// Saved for future use:
|
// Saved for future use:
|
||||||
// <p class="hide">Do you really want to unfollow this Corpora?</p>
|
// <p class="hide">Do you really want to unfollow this Corpora?</p>
|
||||||
// <ul id="selected-unfollow-items-list"></ul>
|
// <ul id="selected-unfollow-items-list"></ul>
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -245,7 +245,7 @@ ResourceLists.CorpusList = class CorpusList extends ResourceLists.ResourceList {
|
|||||||
this.selectedItemIds.forEach(selectedItemId => {
|
this.selectedItemIds.forEach(selectedItemId => {
|
||||||
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();
|
||||||
let itemElement = Utils.HTMLToElement(`<li> - ${values.title}</li>`);
|
let itemElement = nopaque.Utils.HTMLToElement(`<li> - ${values.title}</li>`);
|
||||||
// if (!values['is-owner']) {
|
// if (!values['is-owner']) {
|
||||||
// itemUnfollowList.appendChild(itemElement);
|
// itemUnfollowList.appendChild(itemElement);
|
||||||
// } else {
|
// } else {
|
||||||
@ -268,9 +268,9 @@ ResourceLists.CorpusList = class CorpusList extends ResourceLists.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);
|
nopaque.requests.corpora.entity.delete(selectedItemId);
|
||||||
} else {
|
} else {
|
||||||
Requests.corpora.entity.followers.entity.delete(selectedItemId, currentUserId);
|
nopaque.requests.corpora.entity.followers.entity.delete(selectedItemId, currentUserId);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.CorpusTextInfoList = class CorpusTextInfoList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.CorpusTextInfoList = class CorpusTextInfoList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'corpus-text-info-list';
|
static htmlClass = 'corpus-text-info-list';
|
||||||
|
|
||||||
static defaultOptions = {
|
static defaultOptions = {
|
||||||
@ -6,8 +6,8 @@ ResourceLists.CorpusTextInfoList = class CorpusTextInfoList extends ResourceList
|
|||||||
};
|
};
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
let _options = Utils.mergeObjectsDeep(
|
let _options = nopaque.Utils.mergeObjectsDeep(
|
||||||
ResourceLists.CorpusTextInfoList.defaultOptions,
|
nopaque.resource_lists.CorpusTextInfoList.defaultOptions,
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
super(listContainerElement, _options);
|
super(listContainerElement, _options);
|
||||||
@ -49,9 +49,9 @@ ResourceLists.CorpusTextInfoList = class CorpusTextInfoList extends ResourceList
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('corpus-file-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('corpus-file-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.CorpusTokenList = class CorpusTokenList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.CorpusTokenList = class CorpusTokenList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'corpus-token-list';
|
static htmlClass = 'corpus-token-list';
|
||||||
|
|
||||||
static defaultOptions = {
|
static defaultOptions = {
|
||||||
@ -6,8 +6,8 @@ ResourceLists.CorpusTokenList = class CorpusTokenList extends ResourceLists.Reso
|
|||||||
};
|
};
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
let _options = Utils.mergeObjectsDeep(
|
let _options = nopaque.Utils.mergeObjectsDeep(
|
||||||
ResourceLists.CorpusTokenList.defaultOptions,
|
nopaque.resource_lists.CorpusTokenList.defaultOptions,
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
super(listContainerElement, _options);
|
super(listContainerElement, _options);
|
||||||
@ -72,9 +72,9 @@ ResourceLists.CorpusTokenList = class CorpusTokenList extends ResourceLists.Reso
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('corpus-token-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('corpus-token-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.DetailedPublicCorpusList = class DetailedPublicCorpusList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.DetailedPublicCorpusList = class DetailedPublicCorpusList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'detailed-public-corpus-list';
|
static htmlClass = 'detailed-public-corpus-list';
|
||||||
|
|
||||||
get item() {
|
get item() {
|
||||||
@ -32,9 +32,9 @@ ResourceLists.DetailedPublicCorpusList = class DetailedPublicCorpusList extends
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('corpus-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('corpus-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
var ResourceLists = {};
|
nopaque.resource_lists = {};
|
||||||
|
|
||||||
ResourceLists.AutoInit = () => {
|
nopaque.resource_lists.AutoInit = () => {
|
||||||
for (let propertyName in ResourceLists) {
|
for (let propertyName in nopaque.resource_lists) {
|
||||||
let property = ResourceLists[propertyName];
|
let property = nopaque.resource_lists[propertyName];
|
||||||
// Call autoInit of all properties that are subclasses of `ResourceLists.ResourceList`.
|
// Call autoInit of all properties that are subclasses of `nopaque.resource_lists.ResourceList`.
|
||||||
// This does not include `ResourceLists.ResourceList` itself.
|
// This does not include `nopaque.resource_lists.ResourceList` itself.
|
||||||
if (property.prototype instanceof ResourceLists.ResourceList) {
|
if (property.prototype instanceof nopaque.resource_lists.ResourceList) {
|
||||||
// Check if the static `htmlClass` property is defined.
|
// Check if the static `htmlClass` property is defined.
|
||||||
if (property.htmlClass === undefined) {return;}
|
if (property.htmlClass === undefined) {return;}
|
||||||
// Gather all HTML elements that have the `this.htmlClass` class
|
// Gather all HTML elements that have the `this.htmlClass` class
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.JobInputList = class JobInputList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.JobInputList = class JobInputList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'job-input-list';
|
static htmlClass = 'job-input-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -36,9 +36,9 @@ ResourceLists.JobInputList = class JobInputList extends ResourceLists.ResourceLi
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('job-input-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('job-input-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.JobList = class JobList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.JobList = class JobList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'job-list';
|
static htmlClass = 'job-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -56,9 +56,9 @@ ResourceLists.JobList = class JobList extends ResourceLists.ResourceList {
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('job-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('job-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
@ -112,7 +112,7 @@ ResourceLists.JobList = class JobList extends ResourceLists.ResourceList {
|
|||||||
switch (listAction) {
|
switch (listAction) {
|
||||||
case 'delete-request': {
|
case 'delete-request': {
|
||||||
let values = this.listjs.get('id', itemId)[0].values();
|
let values = this.listjs.get('id', itemId)[0].values();
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -139,7 +139,7 @@ ResourceLists.JobList = class JobList extends ResourceLists.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);
|
nopaque.requests.jobs.entity.delete(itemId);
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
break;
|
break;
|
||||||
@ -187,7 +187,7 @@ ResourceLists.JobList = class JobList extends ResourceLists.ResourceList {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -208,7 +208,7 @@ ResourceLists.JobList = class JobList extends ResourceLists.ResourceList {
|
|||||||
this.selectedItemIds.forEach(selectedItemId => {
|
this.selectedItemIds.forEach(selectedItemId => {
|
||||||
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();
|
||||||
let itemElement = Utils.HTMLToElement(`<li> - ${values.title}</li>`);
|
let itemElement = nopaque.Utils.HTMLToElement(`<li> - ${values.title}</li>`);
|
||||||
itemList.appendChild(itemElement);
|
itemList.appendChild(itemElement);
|
||||||
});
|
});
|
||||||
let modal = M.Modal.init(
|
let modal = M.Modal.init(
|
||||||
@ -224,7 +224,7 @@ ResourceLists.JobList = class JobList extends ResourceLists.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);
|
nopaque.requests.jobs.entity.delete(selectedItemId);
|
||||||
});
|
});
|
||||||
this.selectedItemIds.clear();
|
this.selectedItemIds.clear();
|
||||||
this.renderingItemSelection();
|
this.renderingItemSelection();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.JobResultList = class JobResultList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.JobResultList = class JobResultList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'job-result-list';
|
static htmlClass = 'job-result-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -42,9 +42,9 @@ ResourceLists.JobResultList = class JobResultList extends ResourceLists.Resource
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('job-result-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('job-result-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.PublicCorpusList = class PublicCorpusList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.PublicCorpusList = class PublicCorpusList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'public-corpus-list';
|
static htmlClass = 'public-corpus-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -49,9 +49,9 @@ ResourceLists.PublicCorpusList = class PublicCorpusList extends ResourceLists.Re
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('corpus-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('corpus-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.PublicUserList = class PublicUserList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.PublicUserList = class PublicUserList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'public-user-list';
|
static htmlClass = 'public-user-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -37,9 +37,9 @@ ResourceLists.PublicUserList = class PublicUserList extends ResourceLists.Resour
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('user-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('user-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.ResourceList = class ResourceList {
|
nopaque.resource_lists.ResourceList = class ResourceList {
|
||||||
/* A wrapper class for the list.js list.
|
/* A wrapper class for the list.js list.
|
||||||
* This class is not meant to be used directly, instead it should be used as
|
* This class is not meant to be used directly, instead it should be used as
|
||||||
* a base class for concrete resource list implementations.
|
* a base class for concrete resource list implementations.
|
||||||
@ -21,9 +21,9 @@ ResourceLists.ResourceList = class ResourceList {
|
|||||||
if ('valueNames' in options) {
|
if ('valueNames' in options) {
|
||||||
throw '"valueNames" is not supported as an option, define it as a getter in the list class';
|
throw '"valueNames" is not supported as an option, define it as a getter in the list class';
|
||||||
}
|
}
|
||||||
let _options = Utils.mergeObjectsDeep(
|
let _options = nopaque.Utils.mergeObjectsDeep(
|
||||||
{item: this.item, valueNames: this.valueNames},
|
{item: this.item, valueNames: this.valueNames},
|
||||||
ResourceLists.ResourceList.defaultOptions,
|
nopaque.resource_lists.ResourceList.defaultOptions,
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
this.listContainerElement = listContainerElement;
|
this.listContainerElement = listContainerElement;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.SpaCyNLPPipelineModelList = class SpaCyNLPPipelineModelList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.SpaCyNLPPipelineModelList = class SpaCyNLPPipelineModelList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'spacy-nlp-pipeline-model-list';
|
static htmlClass = 'spacy-nlp-pipeline-model-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -60,9 +60,9 @@ ResourceLists.SpaCyNLPPipelineModelList = class SpaCyNLPPipelineModelList extend
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('spacy-nlp-pipeline-model-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('spacy-nlp-pipeline-model-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
@ -116,7 +116,7 @@ ResourceLists.SpaCyNLPPipelineModelList = class SpaCyNLPPipelineModelList extend
|
|||||||
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)
|
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity.isPublic.update(itemId, newIsPublicValue)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
listActionElement.checked = !newIsPublicValue;
|
listActionElement.checked = !newIsPublicValue;
|
||||||
});
|
});
|
||||||
@ -138,7 +138,7 @@ ResourceLists.SpaCyNLPPipelineModelList = class SpaCyNLPPipelineModelList extend
|
|||||||
switch (listAction) {
|
switch (listAction) {
|
||||||
case 'delete-request': {
|
case 'delete-request': {
|
||||||
let values = this.listjs.get('id', itemId)[0].values();
|
let values = this.listjs.get('id', itemId)[0].values();
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -165,7 +165,7 @@ ResourceLists.SpaCyNLPPipelineModelList = class SpaCyNLPPipelineModelList extend
|
|||||||
);
|
);
|
||||||
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);
|
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity.delete(itemId);
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
break;
|
break;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ResourceLists.TesseractOCRPipelineModelList = class TesseractOCRPipelineModelList extends ResourceLists.ResourceList {
|
nopaque.resource_lists.TesseractOCRPipelineModelList = class TesseractOCRPipelineModelList extends nopaque.resource_lists.ResourceList {
|
||||||
static htmlClass = 'tesseract-ocr-pipeline-model-list';
|
static htmlClass = 'tesseract-ocr-pipeline-model-list';
|
||||||
|
|
||||||
constructor(listContainerElement, options = {}) {
|
constructor(listContainerElement, options = {}) {
|
||||||
@ -69,9 +69,9 @@ ResourceLists.TesseractOCRPipelineModelList = class TesseractOCRPipelineModelLis
|
|||||||
|
|
||||||
initListContainerElement() {
|
initListContainerElement() {
|
||||||
if (!this.listContainerElement.hasAttribute('id')) {
|
if (!this.listContainerElement.hasAttribute('id')) {
|
||||||
this.listContainerElement.id = Utils.generateElementId('tesseract-ocr-pipeline-model-list-');
|
this.listContainerElement.id = nopaque.Utils.generateElementId('tesseract-ocr-pipeline-model-list-');
|
||||||
}
|
}
|
||||||
let listSearchElementId = Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
let listSearchElementId = nopaque.Utils.generateElementId(`${this.listContainerElement.id}-search-`);
|
||||||
this.listContainerElement.innerHTML = `
|
this.listContainerElement.innerHTML = `
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">search</i>
|
<i class="material-icons prefix">search</i>
|
||||||
@ -125,7 +125,7 @@ ResourceLists.TesseractOCRPipelineModelList = class TesseractOCRPipelineModelLis
|
|||||||
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)
|
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic.update(itemId, newIsPublicValue)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
listActionElement.checked = !newIsPublicValue;
|
listActionElement.checked = !newIsPublicValue;
|
||||||
});
|
});
|
||||||
@ -147,7 +147,7 @@ ResourceLists.TesseractOCRPipelineModelList = class TesseractOCRPipelineModelLis
|
|||||||
switch (listAction) {
|
switch (listAction) {
|
||||||
case 'delete-request': {
|
case 'delete-request': {
|
||||||
let values = this.listjs.get('id', itemId)[0].values();
|
let values = this.listjs.get('id', itemId)[0].values();
|
||||||
let modalElement = Utils.HTMLToElement(
|
let modalElement = nopaque.Utils.HTMLToElement(
|
||||||
`
|
`
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -174,7 +174,7 @@ ResourceLists.TesseractOCRPipelineModelList = class TesseractOCRPipelineModelLis
|
|||||||
);
|
);
|
||||||
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);
|
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity.delete(itemId);
|
||||||
});
|
});
|
||||||
modal.open();
|
modal.open();
|
||||||
break;
|
break;
|
||||||
|
91
app/static/js/utils.js
Normal file
91
app/static/js/utils.js
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
nopaque.Utils = class Utils {
|
||||||
|
static escape(text) {
|
||||||
|
// https://codereview.stackexchange.com/a/126722
|
||||||
|
let lookup = {
|
||||||
|
'<': 'lt',
|
||||||
|
'>': 'gt',
|
||||||
|
'"': 'quot',
|
||||||
|
'\'': 'apos',
|
||||||
|
'&': 'amp',
|
||||||
|
'\r': '#10',
|
||||||
|
'\n': '#13'
|
||||||
|
};
|
||||||
|
|
||||||
|
return text.toString().replace(/[<>"'\r\n&]/g, (chr) => {
|
||||||
|
return '&' + lookup[chr] + ';';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static unescape(escapedText) {
|
||||||
|
let lookup = {
|
||||||
|
'lt': '<',
|
||||||
|
'gt': '>',
|
||||||
|
'quot': '"',
|
||||||
|
'apos': "'",
|
||||||
|
'amp': '&',
|
||||||
|
'#10': '\r',
|
||||||
|
'#13': '\n'
|
||||||
|
};
|
||||||
|
|
||||||
|
return escapedText.replace(/&(#?\w+);/g, (match, entity) => {
|
||||||
|
if (lookup.hasOwnProperty(entity)) {
|
||||||
|
return lookup[entity];
|
||||||
|
}
|
||||||
|
|
||||||
|
return match;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static HTMLToElement(HTMLString) {
|
||||||
|
let templateElement = document.createElement('template');
|
||||||
|
templateElement.innerHTML = HTMLString.trim();
|
||||||
|
return templateElement.content.firstChild;
|
||||||
|
}
|
||||||
|
|
||||||
|
static generateElementId(prefix='', suffix='') {
|
||||||
|
for (let i = 0; true; i++) {
|
||||||
|
if (document.querySelector(`#${prefix}${i}${suffix}`) !== null) {continue;}
|
||||||
|
return `${prefix}${i}${suffix}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static isObject(object) {
|
||||||
|
return object !== null && typeof object === 'object' && !Array.isArray(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static mergeObjectsDeep(...objects) {
|
||||||
|
let mergedObject = {};
|
||||||
|
if (objects.length === 0) {
|
||||||
|
return mergedObject;
|
||||||
|
}
|
||||||
|
if (!this.isObject(objects[0])) {throw 'Cannot merge non-object';}
|
||||||
|
if (objects.length === 1) {
|
||||||
|
return this.mergeObjectsDeep(mergedObject, objects[0]);
|
||||||
|
}
|
||||||
|
if (!this.isObject(objects[1])) {throw 'Cannot merge non-object';}
|
||||||
|
for (let key in objects[0]) {
|
||||||
|
if (objects[0].hasOwnProperty(key)) {
|
||||||
|
if (objects[1].hasOwnProperty(key)) {
|
||||||
|
if (this.isObject(objects[0][key]) && this.isObject(objects[1][key])) {
|
||||||
|
mergedObject[key] = this.mergeObjectsDeep(objects[0][key], objects[1][key]);
|
||||||
|
} else {
|
||||||
|
mergedObject[key] = objects[1][key];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mergedObject[key] = objects[0][key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let key in objects[1]) {
|
||||||
|
if (objects[1].hasOwnProperty(key)) {
|
||||||
|
if (!objects[0].hasOwnProperty(key)) {
|
||||||
|
mergedObject[key] = objects[1][key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (objects.length === 2) {
|
||||||
|
return mergedObject;
|
||||||
|
}
|
||||||
|
return this.mergeObjectsDeep(mergedObject, ...objects.slice(2));
|
||||||
|
}
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
Utils = {};
|
|
@ -1,89 +0,0 @@
|
|||||||
Utils.escape = (text) => {
|
|
||||||
// https://codereview.stackexchange.com/a/126722
|
|
||||||
var table = {
|
|
||||||
'<': 'lt',
|
|
||||||
'>': 'gt',
|
|
||||||
'"': 'quot',
|
|
||||||
'\'': 'apos',
|
|
||||||
'&': 'amp',
|
|
||||||
'\r': '#10',
|
|
||||||
'\n': '#13'
|
|
||||||
};
|
|
||||||
|
|
||||||
return text.toString().replace(/[<>"'\r\n&]/g, (chr) => {
|
|
||||||
return '&' + table[chr] + ';';
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Utils.unescape = (escapedText) => {
|
|
||||||
var table = {
|
|
||||||
'lt': '<',
|
|
||||||
'gt': '>',
|
|
||||||
'quot': '"',
|
|
||||||
'apos': "'",
|
|
||||||
'amp': '&',
|
|
||||||
'#10': '\r',
|
|
||||||
'#13': '\n'
|
|
||||||
};
|
|
||||||
|
|
||||||
return escapedText.replace(/&(#?\w+);/g, (match, entity) => {
|
|
||||||
if (table.hasOwnProperty(entity)) {
|
|
||||||
return table[entity];
|
|
||||||
}
|
|
||||||
|
|
||||||
return match;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Utils.HTMLToElement = (HTMLString) => {
|
|
||||||
let templateElement = document.createElement('template');
|
|
||||||
templateElement.innerHTML = HTMLString.trim();
|
|
||||||
return templateElement.content.firstChild;
|
|
||||||
};
|
|
||||||
|
|
||||||
Utils.generateElementId = (prefix='', suffix='') => {
|
|
||||||
for (let i = 0; true; i++) {
|
|
||||||
if (document.querySelector(`#${prefix}${i}${suffix}`) !== null) {continue;}
|
|
||||||
return `${prefix}${i}${suffix}`;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Utils.isObject = (object) => {
|
|
||||||
return object !== null && typeof object === 'object' && !Array.isArray(object);
|
|
||||||
};
|
|
||||||
|
|
||||||
Utils.mergeObjectsDeep = (...objects) => {
|
|
||||||
let mergedObject = {};
|
|
||||||
if (objects.length === 0) {
|
|
||||||
return mergedObject;
|
|
||||||
}
|
|
||||||
if (!Utils.isObject(objects[0])) {throw 'Cannot merge non-object';}
|
|
||||||
if (objects.length === 1) {
|
|
||||||
return Utils.mergeObjectsDeep(mergedObject, objects[0]);
|
|
||||||
}
|
|
||||||
if (!Utils.isObject(objects[1])) {throw 'Cannot merge non-object';}
|
|
||||||
for (let key in objects[0]) {
|
|
||||||
if (objects[0].hasOwnProperty(key)) {
|
|
||||||
if (objects[1].hasOwnProperty(key)) {
|
|
||||||
if (Utils.isObject(objects[0][key]) && Utils.isObject(objects[1][key])) {
|
|
||||||
mergedObject[key] = Utils.mergeObjectsDeep(objects[0][key], objects[1][key]);
|
|
||||||
} else {
|
|
||||||
mergedObject[key] = objects[1][key];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mergedObject[key] = objects[0][key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let key in objects[1]) {
|
|
||||||
if (objects[1].hasOwnProperty(key)) {
|
|
||||||
if (!objects[0].hasOwnProperty(key)) {
|
|
||||||
mergedObject[key] = objects[1][key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (objects.length === 2) {
|
|
||||||
return mergedObject;
|
|
||||||
}
|
|
||||||
return Utils.mergeObjectsDeep(mergedObject, ...objects.slice(2));
|
|
||||||
};
|
|
@ -7,17 +7,9 @@
|
|||||||
{%- assets
|
{%- assets
|
||||||
filters='rjsmin',
|
filters='rjsmin',
|
||||||
output='gen/app.%(version)s.js',
|
output='gen/app.%(version)s.js',
|
||||||
'js/nopaque/index.js',
|
'js/index.js',
|
||||||
'js/nopaque/app.js'
|
'js/app.js',
|
||||||
%}
|
'js/utils.js'
|
||||||
<script src="{{ ASSET_URL }}"></script>
|
|
||||||
{%- endassets %}
|
|
||||||
|
|
||||||
{%- assets
|
|
||||||
filters='rjsmin',
|
|
||||||
output='gen/utils.%(version)s.js',
|
|
||||||
'js/utils/index.js',
|
|
||||||
'js/utils/utils.js'
|
|
||||||
%}
|
%}
|
||||||
<script src="{{ ASSET_URL }}"></script>
|
<script src="{{ ASSET_URL }}"></script>
|
||||||
{%- endassets %}
|
{%- endassets %}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
let corpusListElement = document.querySelector('#corpus-list');
|
let corpusListElement = document.querySelector('#corpus-list');
|
||||||
let corpusList = new ResourceLists.CorpusList(corpusListElement);
|
let corpusList = new nopaque.resource_lists.CorpusList(corpusListElement);
|
||||||
corpusList.add(
|
corpusList.add(
|
||||||
[
|
[
|
||||||
{% for corpus in corpora %}
|
{% for corpus in corpora %}
|
||||||
|
@ -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)
|
nopaque.requests.admin.users.entity.confirmed.update({{ user.hashid|tojson }}, newConfirmed)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
userConfirmedSwitchElement.checked = !userConfirmedSwitchElement;
|
userConfirmedSwitchElement.checked = !userConfirmedSwitchElement;
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
let adminUserListElement = document.querySelector('#admin-user-list');
|
let adminUserListElement = document.querySelector('#admin-user-list');
|
||||||
let adminUserList = new ResourceLists.AdminUserList(adminUserListElement);
|
let adminUserList = new nopaque.resource_lists.AdminUserList(adminUserListElement);
|
||||||
adminUserList.add(
|
adminUserList.add(
|
||||||
[
|
[
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
|
@ -240,7 +240,7 @@
|
|||||||
{% 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 }})
|
nopaque.requests.corpora.entity.followers.entity.delete({{ corpus.hashid|tojson }}, {{ current_user.hashid|tojson }})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
@ -252,7 +252,7 @@
|
|||||||
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)
|
nopaque.requests.corpora.entity.isPublic.update({{ corpus.hashid|tojson }}, newIsPublic)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
publishingModalIsPublicSwitchElement.checked = !newIsPublic;
|
publishingModalIsPublicSwitchElement.checked = !newIsPublic;
|
||||||
});
|
});
|
||||||
@ -262,7 +262,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 }})
|
nopaque.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 }};
|
||||||
});
|
});
|
||||||
@ -312,7 +312,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);
|
nopaque.requests.corpora.entity.followers.add({{ corpus.hashid|tojson }}, usernames);
|
||||||
});
|
});
|
||||||
// #endregion Invite user
|
// #endregion Invite user
|
||||||
|
|
||||||
@ -357,7 +357,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)
|
nopaque.requests.corpora.entity.generateShareLink({{ corpus.hashid|tojson }}, role, expiration)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
response.json()
|
response.json()
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
|
@ -242,7 +242,7 @@
|
|||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
let publicCorpusFileList = new ResourceLists.CorpusFileList(document.querySelector('#corpus-file-list'));
|
let publicCorpusFileList = new nopaque.resource_lists.CorpusFileList(document.querySelector('#corpus-file-list'));
|
||||||
publicCorpusFileList.add(
|
publicCorpusFileList.add(
|
||||||
[
|
[
|
||||||
{% for corpus_file in corpus.files %}
|
{% for corpus_file in corpus.files %}
|
||||||
@ -259,7 +259,7 @@ refreshButton.addEventListener('click', () => {
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if cfr.has_permission('MANAGE_FOLLOWERS') %}
|
{% if cfr.has_permission('MANAGE_FOLLOWERS') %}
|
||||||
let publicCorpusFollowerList = new ResourceLists.CorpusFollowerList(document.querySelector('.corpus-follower-list'));
|
let publicCorpusFollowerList = new nopaque.resource_lists.CorpusFollowerList(document.querySelector('.corpus-follower-list'));
|
||||||
publicCorpusFollowerList.add(
|
publicCorpusFollowerList.add(
|
||||||
[
|
[
|
||||||
{% for cfa in cfas %}
|
{% for cfa in cfas %}
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
<p>Find public corpora.</p>
|
<p>Find public corpora.</p>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<span class="card-title">Public Corpora</span>
|
|
||||||
<div id="public-corpus-list"></div>
|
<div id="public-corpus-list"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -63,7 +62,7 @@
|
|||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
let publicUserListElement = document.querySelector('#public-user-list');
|
let publicUserListElement = document.querySelector('#public-user-list');
|
||||||
let publicUserList = new ResourceLists.PublicUserList(publicUserListElement);
|
let publicUserList = new nopaque.resource_lists.PublicUserList(publicUserListElement);
|
||||||
publicUserList.add(
|
publicUserList.add(
|
||||||
[
|
[
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
@ -73,7 +72,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
let publicCorpusListElement = document.querySelector('#public-corpus-list');
|
let publicCorpusListElement = document.querySelector('#public-corpus-list');
|
||||||
let publicCorpusList = new ResourceLists.PublicCorpusList(publicCorpusListElement);
|
let publicCorpusList = new nopaque.resource_lists.PublicCorpusList(publicCorpusListElement);
|
||||||
publicCorpusList.add(
|
publicCorpusList.add(
|
||||||
[
|
[
|
||||||
{% for corpus in corpora %}
|
{% for corpus in corpora %}
|
||||||
|
@ -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 }})
|
nopaque.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 }})
|
nopaque.requests.users.entity.delete({{ user.hashid|tojson }})
|
||||||
.then((response) => {window.location.href = '/';});
|
.then((response) => {window.location.href = '/';});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ let profileIsPublicSwitchElement = document.querySelector('#profile-is-public-sw
|
|||||||
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)
|
nopaque.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)
|
nopaque.requests.users.entity.settings.profilePrivacy.update({{ user.hashid|tojson }}, valueName, newEnabled)
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
profilePrivacySettingCheckboxElement.checked = !newEnabled;
|
profilePrivacySettingCheckboxElement.checked = !newEnabled;
|
||||||
});
|
});
|
||||||
|
@ -122,7 +122,7 @@
|
|||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
let followedCorpusList = new ResourceLists.PublicCorpusList(document.querySelector('.followed-corpus-list'));
|
let followedCorpusList = new nopaque.resource_lists.PublicCorpusList(document.querySelector('.followed-corpus-list'));
|
||||||
followedCorpusList.add(
|
followedCorpusList.add(
|
||||||
[
|
[
|
||||||
{% for corpus in user.followed_corpora %}
|
{% for corpus in user.followed_corpora %}
|
||||||
@ -132,7 +132,7 @@ followedCorpusList.add(
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
let publicCorpusList = new ResourceLists.PublicCorpusList(document.querySelector('.public-corpus-list'));
|
let publicCorpusList = new nopaque.resource_lists.PublicCorpusList(document.querySelector('.public-corpus-list'));
|
||||||
publicCorpusList.add(
|
publicCorpusList.add(
|
||||||
[
|
[
|
||||||
{% for corpus in user.corpora %}
|
{% for corpus in user.corpora %}
|
||||||
|
Loading…
Reference in New Issue
Block a user