Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cfea1eb
fix: Use relative URL for submission status link
jennifer-richards Apr 7, 2023
942657b
refactor: Refactor/rename process_uploaded_submission async task
jennifer-richards Apr 11, 2023
df173b6
feat: Add async task to process but not accept a submission
jennifer-richards Apr 11, 2023
5be633a
feat: Replace upload_submission() with an async implementation (WIP)
jennifer-richards Apr 11, 2023
55e2dfe
fix: Do not put Submission in "uploaded" state if an error occured
jennifer-richards Apr 19, 2023
8069f42
refactor: Improve text/XML draft processing flow
jennifer-richards May 2, 2023
c2cd9a1
feat: Extract authors from text in async processing
jennifer-richards May 2, 2023
063a625
fix: Fix call signatures and abort submission on failed validation
jennifer-richards May 3, 2023
927a164
feat: Validate submission name format
jennifer-richards May 3, 2023
01f2234
fix: Correctly validate emails from text submission
jennifer-richards May 3, 2023
60a237a
fix: Clean up submission validation
jennifer-richards May 3, 2023
3ece5d9
fix: Better display errors on upload_submission page
jennifer-richards May 3, 2023
9946a02
feat: Reload submission status page when awaiting validation
jennifer-richards May 4, 2023
d0dab46
test: Fix call signatures; remove unused imports
jennifer-richards May 4, 2023
4f88cb4
chore: Add type hint
jennifer-richards May 4, 2023
dd6827e
test: Update tests to match renamed task
jennifer-richards May 4, 2023
5468788
fix: Fix typo in error message
jennifer-richards May 4, 2023
35c4aec
test: Fix failing Api- and AsyncSubmissionTests
jennifer-richards May 4, 2023
9003530
refactor: Break up submission_file() helper
jennifer-richards May 4, 2023
add179b
test: Refactor tests to run the async processing (wip)
jennifer-richards May 4, 2023
f621c62
test: Drop test of bad PDF submission
jennifer-richards May 4, 2023
70d92ce
test: Update more tests
jennifer-richards May 4, 2023
fd56a66
test: Bring back create_and_post_submission() and fix more tests
jennifer-richards May 5, 2023
dc890b4
fix: Drop to manual, don't cancel, on revision inconsistency
jennifer-richards May 5, 2023
c86fb7e
style: Restyle upload_submission() with black
jennifer-richards May 5, 2023
1e96058
test: Verify that async submission processing is invoked on upload
jennifer-richards May 5, 2023
2743d52
test: Bring back old do_submission and fix tests
jennifer-richards May 5, 2023
882b1b9
fix: Accept only XML for API submissions
jennifer-richards May 5, 2023
c0fc6d7
test: Test submission processing utilities
jennifer-richards May 5, 2023
19d8d6b
Merge branch 'main' into async-submit-ui
jennifer-richards May 5, 2023
40c3501
Merge branch 'main' into async-submit-ui
rjsparks May 8, 2023
3b34033
feat: Improve status display for "validating" submissions
jennifer-richards May 9, 2023
fa9ce91
chore: Remove obsolete code
jennifer-richards May 9, 2023
7b62682
test: Update test to match amended text
jennifer-richards May 9, 2023
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
144 changes: 84 additions & 60 deletions ietf/static/js/draft-submit.js
Original file line number Diff line number Diff line change
@@ -1,69 +1,93 @@
$(document)
.ready(function () {
// fill in submitter info when an author button is clicked
$("form.idsubmit button.author")
.on("click", function () {
var name = $(this)
.data("name");
var email = $(this)
.data("email");
$(function () {
// fill in submitter info when an author button is clicked
$("form.idsubmit button.author")
.on("click", function () {
var name = $(this)
.data("name");
var email = $(this)
.data("email");

$(this)
.parents("form")
.find("input[name=submitter-name]")
.val(name || "");
$(this)
.parents("form")
.find("input[name=submitter-email]")
.val(email || "");
});
$(this)
.parents("form")
.find("input[name=submitter-name]")
.val(name || "");
$(this)
.parents("form")
.find("input[name=submitter-email]")
.val(email || "");
});

$("form.idsubmit")
.on("submit", function () {
if (this.submittedAlready)
return false;
else {
this.submittedAlready = true;
return true;
}
});
$("form.idsubmit")
.on("submit", function () {
if (this.submittedAlready)
return false;
else {
this.submittedAlready = true;
return true;
}
});

$("form.idsubmit #add-author")
.on("click", function () {
// clone the last author block and make it empty
var cloner = $("#cloner");
var next = cloner.clone();
next.find('input:not([type=hidden])')
.val('');
$("form.idsubmit #add-author")
.on("click", function () {
// clone the last author block and make it empty
var cloner = $("#cloner");
var next = cloner.clone();
next.find('input:not([type=hidden])')
.val('');

// find the author number
var t = next.children('h3')
.text();
var n = parseInt(t.replace(/\D/g, ''));
// find the author number
var t = next.children('h3')
.text();
var n = parseInt(t.replace(/\D/g, ''));

// change the number in attributes and text
next.find('*')
.each(function () {
var e = this;
$.each(['id', 'for', 'name', 'value'], function (i, v) {
if ($(e)
.attr(v)) {
$(e)
.attr(v, $(e)
.attr(v)
.replace(n - 1, n));
}
});
// change the number in attributes and text
next.find('*')
.each(function () {
var e = this;
$.each(['id', 'for', 'name', 'value'], function (i, v) {
if ($(e)
.attr(v)) {
$(e)
.attr(v, $(e)
.attr(v)
.replace(n - 1, n));
}
});
});

t = t.replace(n, n + 1);
next.children('h3')
.text(t);

t = t.replace(n, n + 1);
next.children('h3')
.text(t);
// move the cloner id to next and insert next into the DOM
cloner.removeAttr('id');
next.attr('id', 'cloner');
next.insertAfter(cloner);

// move the cloner id to next and insert next into the DOM
cloner.removeAttr('id');
next.attr('id', 'cloner');
next.insertAfter(cloner);
});

});
});
// Reload page periodically if the enableAutoReload checkbox is present and checked
const autoReloadSwitch = document.getElementById("enableAutoReload");
const timeSinceDisplay = document.getElementById("time-since-uploaded");
if (autoReloadSwitch) {
const autoReloadTime = 30000; // ms
let autoReloadTimeoutId;
autoReloadSwitch.parentElement.classList.remove("d-none");
timeSinceDisplay.classList.remove("d-none");
autoReloadTimeoutId = setTimeout(() => location.reload(), autoReloadTime);
autoReloadSwitch.addEventListener("change", (e) => {
if (e.currentTarget.checked) {
if (!autoReloadTimeoutId) {
autoReloadTimeoutId = setTimeout(() => location.reload(), autoReloadTime);
timeSinceDisplay.classList.remove("d-none");
}
} else {
if (autoReloadTimeoutId) {
clearTimeout(autoReloadTimeoutId);
autoReloadTimeoutId = null;
timeSinceDisplay.classList.add("d-none");
}
}
});
}
});
Loading