Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2521,12 +2521,7 @@ SPDX-FileCopyrightText = [
"2023 Jonas Huber <https://github.com/jh-RLI> © Reiner Lemoine Institut",
"2023 Daryna Barabanova <https://github.com/Darynarli> © Reiner Lemoine Institut © Reiner Lemoine Institut",
"2023 Bryan Lancien <https://github.com/bmlancien> © Reiner Lemoine Institut",
"2023 Daryna Barabanova <https://github.com/Darynarli> © Reiner Lemoine Institut",
"2023 Jonas Huber <https://github.com/jh-RLI> © Reiner Lemoine Institut",
"2023 Jonas Huber <https://github.com/jh-RLI> © Reiner Lemoine Institut",
"2023 Jonas Huber <https://github.com/jh-RLI> © Reiner Lemoine Institut",
"2025 Daryna Barabanova <https://github.com/Darynarli> © Reiner Lemoine Institut",
"2025 Daryna Barabanova <https://github.com/Darynarli> © Reiner Lemoine Institut",
"2026 Vismaya Jochem <https://github.com/vismayajochem> © Reiner Lemoine Institut",
]

[[annotations]]
Expand Down
61 changes: 49 additions & 12 deletions dataedit/static/peer_review/opr_reviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ import { switchCategoryTab, selectNextField, updatePercentageDisplay } from "./n
import { renderSummaryPageFields, updateTabProgressIndicatorClasses } from "./summary.js";
import {isEmptyValue, isEffectivelyEmpty} from "./utilities.js";window.clientSideReviewFinished = window.clientSideReviewFinished ?? false;
let initialReviewerSuggestions = {};
document.addEventListener('DOMContentLoaded', function() {
initializeEmptyFields();
});
window.addEventListener('load', function() {
initializeEmptyFields();
})
window.clientSideReviewFinished = window.clientSideReviewFinished ?? false;
export function initReviewer() {
initializeEventBindings(saveEntrancesForReviewer);
Expand Down Expand Up @@ -76,6 +82,42 @@ export function initReviewer() {
}
}

function initializeEmptyFields() {
const allFields = document.querySelectorAll(".field");

allFields.forEach(fieldEl => {
const fieldKey = fieldEl.dataset.fieldkey;
const fieldValue = fieldEl.dataset.fieldvalue;

const isEmpty = isEffectivelyEmpty(fieldKey, fieldValue);

if (isEmpty) {
// Grey out
const labelEl = fieldEl.querySelector('.key');
const valueEl = fieldEl.querySelector('.value');

if (labelEl) labelEl.style.color = '#6c757d';
if (valueEl) valueEl.style.color = '#6c757d';

// Add explanation message
const safeKey = fieldKey.replace(/[^a-zA-Z0-9_-]/g, '_');

if (!document.getElementById(`explanation_${safeKey}`)) {
const explanationElement = document.createElement('p');
explanationElement.id = `explanation_${safeKey}`;
explanationElement.classList.add('explanation', 'text-muted', 'mt-1');
explanationElement.innerText = 'Field is empty. Reviewing is not possible.';
fieldEl.appendChild(explanationElement);
}

// Disable clicking completely
fieldEl.style.pointerEvents = "none";
fieldEl.style.cursor = "not-allowed";
fieldEl.style.opacity = "0.7";
}
});
}

function deletePeerReview() {
if (!confirm("Are you sure?")) return;
const json = JSON.stringify({
Expand All @@ -97,6 +139,9 @@ function click_field(fieldKey, fieldValue, category) {
const isEmpty = isEffectivelyEmpty(fieldKey, fieldValue);
const cleanedFieldKey = fieldKey.replace(/\.\d+/g, '');

if (isEmpty) {
return; // Exit early, don't allow interaction
}
switchCategoryTab(category);
setSelectedField(fieldKey);
setselectedFieldValue(fieldValue);
Expand All @@ -112,17 +157,9 @@ function click_field(fieldKey, fieldValue, category) {
// If it's empty, buttons MUST be disabled, regardless of previous state (unless you want to allow un-reviewing, but generally empty = no action)
const buttons = ["ok-button", "rejected-button", "suggestion-button"];

buttons.forEach(btn => {
const el = document.getElementById(btn);
if (isEmpty) {
el.disabled = true; // Force disable if empty
} else {
// If not empty, disable if no state is selected yet?
// Actually, in the original code, buttons were enabled if a state existed.
// But usually, you want buttons enabled so you CAN select a state.
// Let's assume buttons should be enabled if the field has content.
el.disabled = false;
}
buttons.forEach(btn => {
const el = document.getElementById(btn);
el.disabled = false; // Enable buttons since we know field is not empty
});

// 3. Handle empty field messages
Expand Down Expand Up @@ -243,4 +280,4 @@ function saveEntrancesForReviewer() {

selectNextField();
check_if_review_finished();
}
}
194 changes: 97 additions & 97 deletions dataedit/templates/dataedit/opr_review.html
Original file line number Diff line number Diff line change
Expand Up @@ -717,113 +717,113 @@ <h2 class="accordion-header" id="heading-temporal-{{ forloop.counter }}">
role="tabpanel"
aria-labelledby="summary-tab"></div>
</div>
</div>
<div class="review__controls">
<div class="review__box">
<div id="field-descriptions-json" style="display: none;">
{{ field_descriptions_json }}
</div>
<div class="review__description" id="review-info">
<button type="button" data-bs-toggle="modal" data-bs-target="#myModal">
Open Peer Review process <i class="fas fa-info-circle" style="color: #2972A6;"></i>
</button>
</div>
<div class="review__btn-nav">
<button type="button" onclick="selectPreviousField()">
<span class="btn__icon">
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M7.35,0 L8.06,0.71 L1.41,7.35 L8.06,14 L7.35,14.71 L0,7.35 L7.35,0" />
</svg>
</span>
</button>
<button type="button" onclick="selectNextField()">
<span class="btn__icon">
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M5.35,15.35 L4.65,14.65 L11.29,8 L4.65,1.35 L5.35,0.65 L12.71,8 L5.35,15.35" />
</svg>
</span>
</button>
</div>
<div id="field-descriptions"></div>
<div class="flex-reviewer" id="review-window">
<h2 id="review-field-name" style="display:none"></h2>
<div class="review__btns" role="group">
<div class="review__btn review__btn--success">
<button type="button" id="ok-button" value="ok" onclick="selectState('ok');">
<span class="btn__icon">
<svg width="12" height="12" fill="currentColor" viewBox="0 0 24 24">
<path d="m22.28,3.75c-.31,0-.6.14-.81.36l-13.4,13.4-5.66-4.37h0c-.25-.19-.56-.28-.87-.24-.31.04-.59.2-.79.45s-.28.56-.23.88c.04.31.21.59.46.78l6.48,5.01c.47.36,1.14.32,1.55-.1l14.14-14.14c.35-.34.46-.86.26-1.31-.19-.45-.64-.73-1.13-.71h0Z" />
</svg>
</span>
<span>Accept</span>
</button>
<div class="review__controls">
<div class="review__box">
<div id="field-descriptions-json" style="display: none;">
{{ field_descriptions_json }}
</div>
<div class="review__description" id="review-info">
<button type="button" data-bs-toggle="modal" data-bs-target="#myModal">
Open Peer Review process <i class="fas fa-info-circle" style="color: #2972A6;"></i>
</button>
</div>
<div class="review__btn-nav">
<button type="button" onclick="selectPreviousField()">
<span class="btn__icon">
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M7.35,0 L8.06,0.71 L1.41,7.35 L8.06,14 L7.35,14.71 L0,7.35 L7.35,0" />
</svg>
</span>
</button>
<button type="button" onclick="selectNextField()">
<span class="btn__icon">
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M5.35,15.35 L4.65,14.65 L11.29,8 L4.65,1.35 L5.35,0.65 L12.71,8 L5.35,15.35" />
</svg>
</span>
</button>
</div>
<div id="field-descriptions"></div>
<div class="flex-reviewer" id="review-window">
<h2 id="review-field-name" style="display:none"></h2>
<div class="review__btns" role="group">
<div class="review__btn review__btn--success">
<button type="button" id="ok-button" value="ok" onclick="selectState('ok');">
<span class="btn__icon">
<svg width="12" height="12" fill="currentColor" viewBox="0 0 24 24">
<path d="m22.28,3.75c-.31,0-.6.14-.81.36l-13.4,13.4-5.66-4.37h0c-.25-.19-.56-.28-.87-.24-.31.04-.59.2-.79.45s-.28.56-.23.88c.04.31.21.59.46.78l6.48,5.01c.47.36,1.14.32,1.55-.1l14.14-14.14c.35-.34.46-.86.26-1.31-.19-.45-.64-.73-1.13-.71h0Z" />
</svg>
</span>
<span>Accept</span>
</button>
</div>
<div class="review__btn review__btn--suggested">
<button type="button"
id="suggestion-button"
value="suggestion"
onclick="selectState('suggestion');">
<span class="btn__icon">
<svg width="12" height="12" fill="currentColor" viewBox="0 0 24 24">
<path d="m10.6,17.92c-.01-.37-.02-.65-.02-.83,0-1.09.15-2.03.46-2.82.23-.59.59-1.19,1.09-1.8.37-.44,1.04-1.08,1.99-1.93.96-.85,1.58-1.52,1.87-2.03.29-.5.43-1.05.43-1.65,0-1.08-.42-2.02-1.26-2.84-.84-.81-1.88-1.22-3.1-1.22s-2.17.37-2.95,1.11c-.79.74-1.31,1.9-1.56,3.47l-2.85-.34c.26-2.1,1.02-3.72,2.29-4.84,1.27-1.12,2.94-1.68,5.03-1.68,2.21,0,3.97.6,5.28,1.8,1.31,1.2,1.97,2.65,1.97,4.36,0,.98-.23,1.89-.69,2.72-.46.83-1.36,1.85-2.71,3.03-.9.8-1.49,1.39-1.77,1.77-.28.38-.48.82-.61,1.31-.14.49-.21,1.29-.23,2.4h-2.67Zm-.17,5.56v-3.16h3.15v3.16h-3.15Z" />
</svg>
</span>
<span>Suggest</span>
</button>
</div>
<div class="review__btn review__btn--denied">
<button type="button"
id="rejected-button"
value="rejected"
onclick="selectState('rejected');">
<span class="btn__icon">
<svg width="12" height="12" fill="currentColor" viewBox="0 0 24 24">
<path d="m13.46,12.41L22.94,2.92c.4-.4.4-1.06,0-1.46s-1.06-.4-1.46,0l-9.49,9.48L2.52,1.46c-.4-.4-1.06-.4-1.46,0-.4.4-.4,1.06,0,1.46l9.47,9.48L1.06,21.87c-.4.4-.4,1.06,0,1.46.2.2.47.3.73.3s.53-.1.73-.3l9.47-9.47,9.47,9.48c.2.2.47.3.73.3s.53-.1.73-.3c.4-.4.4-1.06,0-1.46l-9.47-9.48Z" />
</svg>
</span>
<span>Deny</span>
</button>
</div>
</div>
<div class="review__btn review__btn--suggested">
<div id="explanation-container" class="review__explanation"></div>
<div class="d-none review__remarks" id="reviewer_remarks">
<div class="review__field" id="field-value">
<label for="valuearea" class="form-label">Your value suggestion*</label>
<textarea class="form-control" id="valuearea" rows="2"></textarea>
</div>
<div class="review__field review__field--nolabel" id="field-comment">
<label for="commentarea" class="form-label"></label>
<textarea class="form-control"
id="commentarea"
rows="2"
placeholder="Comment here if you want to explain your suggestion"></textarea>
</div>
<button type="button"
id="suggestion-button"
value="suggestion"
onclick="selectState('suggestion');">
<span class="btn__icon">
<svg width="12" height="12" fill="currentColor" viewBox="0 0 24 24">
<path d="m10.6,17.92c-.01-.37-.02-.65-.02-.83,0-1.09.15-2.03.46-2.82.23-.59.59-1.19,1.09-1.8.37-.44,1.04-1.08,1.99-1.93.96-.85,1.58-1.52,1.87-2.03.29-.5.43-1.05.43-1.65,0-1.08-.42-2.02-1.26-2.84-.84-.81-1.88-1.22-3.1-1.22s-2.17.37-2.95,1.11c-.79.74-1.31,1.9-1.56,3.47l-2.85-.34c.26-2.1,1.02-3.72,2.29-4.84,1.27-1.12,2.94-1.68,5.03-1.68,2.21,0,3.97.6,5.28,1.8,1.31,1.2,1.97,2.65,1.97,4.36,0,.98-.23,1.89-.69,2.72-.46.83-1.36,1.85-2.71,3.03-.9.8-1.49,1.39-1.77,1.77-.28.38-.48.82-.61,1.31-.14.49-.21,1.29-.23,2.4h-2.67Zm-.17,5.56v-3.16h3.15v3.16h-3.15Z" />
</svg>
</span>
<span>Suggest</span>
</button>
class="btn btn-warning review__field-save"
id="submitButton">Save comment/new value</button>
</div>
<div class="review__btn review__btn--denied">
<div class="d-none review__comments" id="reviewer_comments">
<div class="review__field review__field--nolabel" id="field-comment">
<label for="comments" class="form-label"></label>
<textarea class="form-control"
id="comments"
rows="2"
placeholder="Comment here if you want to explain your suggestion"></textarea>
</div>
<button type="button"
id="rejected-button"
value="rejected"
onclick="selectState('rejected');">
<span class="btn__icon">
<svg width="12" height="12" fill="currentColor" viewBox="0 0 24 24">
<path d="m13.46,12.41L22.94,2.92c.4-.4.4-1.06,0-1.46s-1.06-.4-1.46,0l-9.49,9.48L2.52,1.46c-.4-.4-1.06-.4-1.46,0-.4.4-.4,1.06,0,1.46l9.47,9.48L1.06,21.87c-.4.4-.4,1.06,0,1.46.2.2.47.3.73.3s.53-.1.73-.3l9.47-9.47,9.47,9.48c.2.2.47.3.73.3s.53-.1.73-.3c.4-.4.4-1.06,0-1.46l-9.47-9.48Z" />
</svg>
</span>
<span>Deny</span>
</button>
class="btn btn-warning review__field-save"
id="submitCommentButton">Save comment</button>
</div>
</div>
<div id="explanation-container" class="review__explanation"></div>
<div class="d-none review__remarks" id="reviewer_remarks">
<div class="review__field" id="field-value">
<label for="valuearea" class="form-label">Your value suggestion*</label>
<textarea class="form-control" id="valuearea" rows="2"></textarea>
</div>
<div class="review__field review__field--nolabel" id="field-comment">
<label for="commentarea" class="form-label"></label>
<textarea class="form-control"
id="commentarea"
rows="2"
placeholder="Comment here if you want to explain your suggestion"></textarea>
</div>
<button type="button"
class="btn btn-warning review__field-save"
id="submitButton">Save comment/new value</button>
</div>
<div class="review__infos">
<div>
Dataset uploaded by <a href="#">bmlancien</a> on <span class="review__infos--date">2022-09-19</span>
</div>
<div class="d-none review__comments" id="reviewer_comments">
<div class="review__field review__field--nolabel" id="field-comment">
<label for="comments" class="form-label"></label>
<textarea class="form-control"
id="comments"
rows="2"
placeholder="Comment here if you want to explain your suggestion"></textarea>
</div>
<button type="button"
class="btn btn-warning review__field-save"
id="submitCommentButton">Save comment</button>
<div>
<span class="review__infos--review-number">0</span> review
</div>
</div>
</div>
<div class="review__infos">
<div>
Dataset uploaded by <a href="#">bmlancien</a> on <span class="review__infos--date">2022-09-19</span>
</div>
<div>
<span class="review__infos--review-number">0</span> review
</div>
</div>
</div>
</div>
</div>
Expand Down
Loading