Skip to content

Commit b69c20b

Browse files
committed
setting public/private UI events/logic
1 parent 93be20e commit b69c20b

File tree

8 files changed

+465
-272
lines changed

8 files changed

+465
-272
lines changed

gateway/sds_gateway/static/css/components.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@
112112
box-shadow: none;
113113
}
114114

115+
/* Ensure textarea also has proper padding when disabled */
116+
textarea.form-control[readonly],
117+
textarea.form-control:disabled,
118+
textarea.form-control-plaintext {
119+
padding: 0.75rem 1rem;
120+
}
121+
115122
/* Author management styling */
116123
.author-item {
117124
transition: all 0.3s ease;
@@ -160,6 +167,12 @@
160167
opacity: 0.7;
161168
}
162169

170+
/* Disabled state styling */
171+
.disabled-element {
172+
opacity: 0.5;
173+
pointer-events: none;
174+
}
175+
163176
/* Authors management styling */
164177
.author-item {
165178
transition: all 0.2s ease;
@@ -1092,6 +1105,11 @@ body {
10921105
padding: 1.25rem;
10931106
}
10941107

1108+
.disable-events {
1109+
pointer-events: none;
1110+
cursor: not-allowed;
1111+
}
1112+
10951113
.display-block {
10961114
display: block;
10971115
}

gateway/sds_gateway/static/js/dataset/DatasetEditingHandler.js

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ class DatasetEditingHandler {
860860
);
861861
if (removeAllFilesButton) {
862862
removeAllFilesButton.disabled = true;
863-
removeAllFilesButton.style.opacity = "0.5";
863+
removeAllFilesButton.classList.add("disabled-element");
864864
}
865865
}
866866
}
@@ -888,15 +888,15 @@ class DatasetEditingHandler {
888888
const removeButton = row.querySelector(".mark-for-removal-btn");
889889
if (removeButton) {
890890
removeButton.disabled = true;
891-
removeButton.style.opacity = "0.5";
891+
removeButton.classList.add("disabled-element");
892892
}
893893
} else {
894894
// Restore normal state
895895
row.classList.remove("marked-for-removal");
896896
const removeButton = row.querySelector(".mark-for-removal-btn");
897897
if (removeButton) {
898898
removeButton.disabled = false;
899-
removeButton.style.opacity = "";
899+
removeButton.classList.remove("disabled-element");
900900
}
901901
}
902902
}
@@ -925,15 +925,15 @@ class DatasetEditingHandler {
925925
const removeButton = row.querySelector(".mark-for-removal-btn");
926926
if (removeButton) {
927927
removeButton.disabled = true;
928-
removeButton.style.opacity = "0.5";
928+
removeButton.classList.add("disabled-element");
929929
}
930930
} else {
931931
// Restore normal state
932932
row.classList.remove("marked-for-removal");
933933
const removeButton = row.querySelector(".mark-for-removal-btn");
934934
if (removeButton) {
935935
removeButton.disabled = false;
936-
removeButton.style.opacity = "";
936+
removeButton.classList.remove("disabled-element");
937937
}
938938
}
939939
}
@@ -1240,6 +1240,34 @@ class DatasetEditingHandler {
12401240
window.DOMUtils.hide(addAuthorBtn);
12411241
}
12421242
}
1243+
1244+
// Disable author inputs if dataset is final
1245+
if (
1246+
window.datasetModeManager &&
1247+
window.datasetModeManager.isExistingFinalDataset()
1248+
) {
1249+
const authorInputs = authorsList.querySelectorAll(
1250+
".author-name-input, .author-orcid-input",
1251+
);
1252+
authorInputs.forEach((input) => {
1253+
input.disabled = true;
1254+
input.setAttribute("readonly", "readonly");
1255+
input.classList.add("form-control-plaintext");
1256+
});
1257+
// Also disable remove buttons for authors
1258+
const removeButtons = authorsList.querySelectorAll(
1259+
".remove-author, .cancel-remove-author",
1260+
);
1261+
removeButtons.forEach((button) => {
1262+
button.disabled = true;
1263+
button.classList.add("disabled-element");
1264+
});
1265+
// Disable add button if not already disabled
1266+
if (addAuthorBtn) {
1267+
addAuthorBtn.disabled = true;
1268+
addAuthorBtn.classList.add("disabled");
1269+
}
1270+
}
12431271
};
12441272

12451273
/**

0 commit comments

Comments
 (0)