Skip to content

Commit

Permalink
function to indicate open fields on a tab with a small dot on the rev…
Browse files Browse the repository at this point in the history
…iewer page #1247
  • Loading branch information
user committed Jun 24, 2023
1 parent 4531b18 commit 59cab18
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion dataedit/static/peer_review/opr_reviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,35 @@ const otherTabs = [
document.getElementById('resource-tab')
];
const reviewContent = document.querySelector(".review__content");
function updateTabClasses() {
const tabNames = ['general', 'spatiotemporal', 'source', 'license', 'contributor', 'resource']; // список имен вкладок
for (let i = 0; i < tabNames.length; i++) {
let tabName = tabNames[i];
let tab = document.getElementById(tabName + '-tab');
if (!tab) continue; // пропускаем, если вкладка не найдена

let fields = Array.from(document.querySelectorAll('#' + tabName + ' .field')); // извлекаем поля для данной вкладки

let allOk = true; // предполагаем, что все поля в порядке
for (let j = 0; j < fields.length; j++) {
let fieldState = getFieldState(fields[j].id.replace('field_', ''));
if (fieldState !== 'ok') {
allOk = false;
break;
}
}
if (allOk) {
tab.classList.add('status');
tab.classList.add('status--done');
} else {
tab.classList.remove('status');
tab.classList.remove('status--done');
}
}
}
window.addEventListener('DOMContentLoaded', updateTabClasses);


// Event listener for clicking the "Summary" tab button
summaryTab.addEventListener('click', function() {
toggleReviewControls(false);
reviewContent.classList.toggle("tab-pane--100");
Expand All @@ -747,3 +774,5 @@ function toggleReviewControls(show) {
}

peerReview(config);


0 comments on commit 59cab18

Please sign in to comment.