Skip to content

Hacky submit_once status overlay - #135

Open
EkriirkE wants to merge 2 commits into
roundup-tracker:masterfrom
EkriirkE:feature/Submit-wait-overlay
Open

EkriirkE wants to merge 2 commits into
roundup-tracker:masterfrom
EkriirkE:feature/Submit-wait-overlay

Conversation

@EkriirkE

@EkriirkE EkriirkE commented Sep 22, 2026 •

Copy link
Copy Markdown

It would be wonderful if when clicking submit the screens would indicate that it is working/waiting. This is a very hacky but working implementation.

Ideally the overlay would be predefined and available in the base HTML, and the styles in a global css file.

@rouilj

rouilj commented Sep 23, 2026

Copy link
Copy Markdown
Member

Hi Erik:

Thanks for your contribution.

I assume the problem you are solving is that there is no indication that the "submit" button has been clicked.
Did you have another issue that prompted this change?

While investigating your change, I realized that the submit button isn't disabled after clicking and the text
of the button doesn't change to "Submitting..." 8-(. That is standard in many of the trackers I implement.

If that was part of the default trackers, would you still want/need the overlay?

If the overlay is still needed, I agree adding

<div id="status_overlay">
<div id="status_overlay_content">Some text to be changed.</div>
</div>

at the bottom of page.html (or equivalent in the jinja2 template) and adding css to style.css is the way to go.

Also I usually center text these days using display: flex and place-content: center.
As you said this is a hacky implementation, but was there some specific reason you went with
vertical-align/text-align?

Thanks again for your interest in Roundup and making it better.

-- rouilj

@EkriirkE

EkriirkE commented Sep 24, 2026 •

Copy link
Copy Markdown
Author

Hi John,
Yes the main concern is no indication a submission was performed. We have various trackers built upon roundup that have a huge dataset where actions can take several seconds before anything is refreshed/redirected. Users including myself have lamented being unsure anything is happening. Disabling the button and replacing the text is a start!* But honestly something more in-your-face is better :) hence the overlay thought.

I hadn't looked too deep into the templating system you have, it is daunting at first - thanks for the pointers! After testing, display:flex only placed the content horizontally centered, but block did only vertical.
I have adjusted the PR accordingly, hitting all the pages except minimal where I put a dummy span.

  • I suspect the button changing may have been skipped because there can be many such submit_once buttons on a form so I also added some "tracking" for the timeout to undo this to the correct button. BUT you have to pass this as a parameter to each call, and links CANNOT use href="javascript:submit_once(this) because href is global context and "this" is the window not the initiating element - instead such links have to be converted to onClick="submit_once(this) for that to work. I added some checks for this so unadapted buttons/links still function.

@rouilj

rouilj commented Sep 24, 2026

Copy link
Copy Markdown
Member

Hello Erik:

I haven't yet had a chance to look at your latest PR and won't till this weekend.

Hi John, Yes the main concern is no indication a submission was performed.
We have various trackers built upon roundup that have a huge dataset where
actions can take several seconds before anything is refreshed/redirected.

Got it. If you're interested, I would like to email/chat off ticket about your setup/use
cases.

I hadn't looked too deep into the templating system you have, it is daunting
at first - thanks for the pointers!

Sure. This https://www.roundup-tracker.org/docs/reference.html#id69 provides an overview of the templates and might help. I assume your tracker is based on the classic (TAL templating) based tracker. The layout for the jinja2 based tracker is different. Also the customizing
https://www.roundup-tracker.org/docs/customizing.html document might help.

After testing, display:flex only placed the content horizontally centered, but
block did only vertical. I have adjusted the PR accordingly, hitting all the
pages except minimal where I put a dummy span.

I'll take a look.

  • I suspect the button changing may have been skipped because there can be
    many such submit_once buttons on a form

That is true. You can add a standard <button> element as well. For example:
https://wiki.roundup-tracker.org/SubmitSilentChange. In this case I would find the buttons/inputs using:

document.querySelectorAll("[type=submit], [data-show-busy]")

where data-show-busy is an attribute you can add to signal that a busy overlay or button text/disabled should be triggered on click.

so I also added some "tracking" for
the timeout to undo this to the correct button. BUT you have to pass this as a
parameter to each call, and links CANNOT use href="javascript:submit_once(this)
because href is global context and "this" is the window not the initiating element
instead such links have to be converted to onClick="submit_once(this) for that
to work. I added some checks for this so unadapted buttons/links still function.

One thing to note is that onX html attributes are being removed from Roundup
templates. They interfere with the ability to improve security using a content security
policy (CSP). The onClick etc. attributes are due to be removed and replaced with
core javascript to add click handlers. See: https://issues.roundup-tracker.org/issue2550939.

-- rouilj

Comment thread roundup/cgi/templating.py
submitted_restore = "";

function submit_reset() {
$("#submit_overlay").hide();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this $(...) jquery? If so please replace it with vanilla javascript.

Going forward I hope to remove jquery entirely from all templates (issue2551423 as it is a maintainance issue: https://issues.roundup-tracker.org/issue2551422 https://issues.roundup-tracker.org/issue2551424. So I really don't want to add more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, and no problem! (the original commit used vanilla JS, I just noticed that jQuery was used and firgured that was more the direction you were using)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

jquery has some specific uses for some interactions and was added back
in 2009 when IE was a thing. At that point I don't think querySelector() existed.

Comment thread roundup/cgi/templating.py
<script nonce="%s" type="text/javascript">
submitted = false;
function submit_once() {
submitted_restore = "";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might I suggest a different way to do this. Your current code gives the submitted variable two different meanings:

  1. a true/false flag if the button has submitted a request.
  2. the button DOM object.

While that is hacky (so lives up to the title 9-)), it ook me a bit to figure out what the (type(submitted) == type(true) was doing.

I suggest keeping submitted as a simple boolean value.

Since you added the variable: submitted_restore, make it have one of two values:

  • an unset value of null (which can be tested with submitted_restore !== null (which should test type as well as value)
  • a plain object set (at line 3465 in this diff) using:
    submitted_restore = { "target": e, "text": e.textContent, "value": e.value }
    

Doing it this way, you restore the value if it is not the same as the text string. This happens in the SubmitSilentChange example.

width: 100%;
}

td.date, th.date {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you restore the trailing whitespace in the css and html files across all your changes. Looks like there are 3 of them. The whitespace fixups in the javascript in templating.py are fine. That's not something that has to be applied manually as part of the upgrade.

When I add updates like this to upgrading.txt, I sometimes include references to the commit. This lets
admins download the commit as a patch and apply it to their trackers. Having a clean patch
that only changes the one thing needed for the additional function is better.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

My IDE removes all trailing spaces automatically upon save, I'll see what I can do to exempt your remo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. I can't apply your PR directly in github (our VCS of record is mercurial), so I can fix it before I commit. But having it fixed in the pull request would be best.

Comment thread roundup/cgi/templating.py

const transfer = new DataTransfer();
file_list = document.querySelectorAll('pre[data-mimetype]');
file_list.forEach( file =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change is fine since it is in the Python file that is not meant to be customized on a per tracker basis.

Comment thread roundup/cgi/templating.py
function submit_reset() {
$("#submit_overlay").hide();
if (typeof(submitted)!=typeof(true)) {
submitted.value = submitted.textContent = submitted_restore;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See: https://github.com/roundup-tracker/roundup/pull/135/changes#diff-c0f24b87223e22a82a98c3206cd1d037b4b0fd5aef85706ed53bb6b9a59eeb96R3445

value and text content might not be the same specially if the text content is multiple words.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Our implementation uses href= links for some submits, this was a way to cover both buttons/inputs and anchors - I did not see a conflict in my testing when both were modified but I can instead put a check in for html element vs form element to use value or text accordingly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume the href link id executing a (long running) read only operation (like a search)?

I just want to make sure that your link is not updating the database using a GET (rather than POST) method (which was something that was done with earlier Roundup implementations and does have one remnant in current Roundup).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants