Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show clipped paper snapshot in fix metadata dialog #4645

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 12 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
34 changes: 32 additions & 2 deletions hugo/layouts/papers/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,18 @@
document.getElementById("paperIdSpan").textContent = paper_params.anthology_id;
document.getElementById("paperTitle").value = paper_params.title;
document.getElementById("paperAbstract").value = paper_params.abstract;
document.getElementById("paperPDF").href = "{{ $paper.pdf }}";
document.getElementById("paperSnapshot").href = "https://aclanthology.org/thumb/" + paper_params.anthology_id + ".jpg";
document.getElementById("paperSnapshotImg").src = "https://aclanthology.org/thumb/" + paper_params.anthology_id + ".jpg";

const container = document.getElementById("authorsContainer");
container.innerHTML = "";
paper_params.authors.forEach((author, idx) => {
container.appendChild(createAuthorRow(author.first, author.last, author.id));
});

refreshAuthorList();

const modal = new bootstrap.Modal(document.getElementById('metadataModal'));
modal.show();
}
Expand Down Expand Up @@ -139,6 +144,7 @@
authorsContainer.appendChild(draggedElement);
}
draggedElement = null;
refreshAuthorList();
});

function createAuthorRow(first, last, id) {
Expand Down Expand Up @@ -170,6 +176,7 @@
firstName.placeholder = 'First name';
firstName.className = 'form-control';
firstName.value = first;
firstName.oninput = () => refreshAuthorList();

firstNameCol.appendChild(firstName);
grabberCol.appendChild(firstNameCol);
Expand All @@ -183,6 +190,7 @@
lastName.placeholder = 'Last name';
lastName.className = 'form-control';
lastName.value = last;
lastName.oninput = () => refreshAuthorList();

lastNameCol.appendChild(lastName);

Expand All @@ -200,7 +208,7 @@
delBtn.type = 'button';
delBtn.className = 'btn btn-sm btn-danger';
delBtn.textContent = 'X';
delBtn.onclick = () => row.remove();
delBtn.onclick = () => { row.remove(); refreshAuthorList(); };

delCol.appendChild(delBtn);

Expand All @@ -218,6 +226,17 @@
container.appendChild(createAuthorRow("", "", "", ""));
}

function refreshAuthorList() {
const container = document.getElementById('authorsContainer');
var authors = "";
for (authorRow of container.children) {
const first = authorRow.children[1].children[0].value;
const last = authorRow.children[2].children[0].value;
authors += first + " " + last + "; "
}
document.getElementById("paperAuthorList").textContent = authors.slice(0,-2);
}

// Drag & Drop functions for authors
let draggedAuthor = null;
function dragAuthor(ev) {
Expand All @@ -239,6 +258,7 @@
} else {
container.appendChild(draggedAuthor);
}
refreshAuthorList();
}
}

Expand Down Expand Up @@ -357,12 +377,22 @@ <h5 class="modal-title">Correct Metadata for <span id="paperIdSpan"></span></h5>
<small id="abstractTitleHelp" class="form-text text-muted">Correct abstract if needed. Retain XML formatting tags such as &lt;tex-math&gt;.</small>
<textarea class="form-control" id="paperAbstract" rows="6"></textarea>
</div>

<div class="mb-3">
<label class="form-label">Verification against PDF</label>
<small class="form-text text-muted">Ensure that the new title/authors match the snapshot below. (If there is no snapshot or it is too small, consult <a href="#" id="paperPDF">the PDF</a>.)</small>
<div style="height: 150px; text-align: center; overflow: hidden; position: relative;">
<a id="paperSnapshot" href=""><img id="paperSnapshotImg" src="" style="position: absolute; left: 0; top: -50px;"></a>
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played around with this a bit and think something like this might work:

<div style="max-height:150px;" class="overflow-hidden w-100">
  <a id="paperSnapshot" href="https://aclanthology.org/thumb/2024.tacl-1.3.jpg">
    <img id="paperSnapshotImg" src="https://aclanthology.org/thumb/2024.tacl-1.3.jpg" class="w-100" style="transform: translate(0, 5%) scale(1.25);">
  </a>
</div>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played quite a bit but eventually had too many hours into the project and was happy to have something working. This kind of design isn't my forte. I'll try pushing up this change on this PR.

<small class="form-text text-muted">Authors concatenated from the text boxes above:</small>
<div class="card card-body bg-light" id="paperAuthorList"></div>
</div>
</form>
</div>
<div class="modal-footer d-flex align-items-center">
<div class="form-check mb-0">
<input type="checkbox" class="form-check-input" id="pdfCorrectionCheck">
<label class="form-check-label" for="pdfCorrectionCheck">ALL author names, the title, and the abstract match the PDF. If paper metadata matches the PDF, but the paper should be linked to a different author page, please file an <a href="https://github.com/acl-org/acl-anthology/issues/new?assignees=anthology-assist&labels=correction%2Cmetadata&projects=&template=02-name-correction.yml&title=Author+Page%3A+%7Breplace+with+author+name%7D">author page correction</a> instead.</label>
<label class="form-check-label" for="pdfCorrectionCheck">ALL author names match the snapshot above—including middle initials, hyphens, and accents.</label>
</div>
<button type="button" class="btn btn-primary" onclick="submitMetadataCorrection()">Submit</button>
</div>
Expand Down