Skip to content

Commit

Permalink
function to indicate open fields on a tab with a small dot on the con…
Browse files Browse the repository at this point in the history
…tributor page #1247
  • Loading branch information
user committed Jun 24, 2023
1 parent dbab738 commit 5a9b8c6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions dataedit/static/peer_review/opr_contributor.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,35 @@ function updateSubmitButtonColor(){
}
}

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);


/**
* Hide and show revier controles once the user clicks the summary tab
*/
Expand Down

0 comments on commit 5a9b8c6

Please sign in to comment.