CDLUC3 / ezid

CDLUC3 ezid
MIT License
10 stars 4 forks source link

Switching form for homepage without reloading page #786

Open sfisher opened 2 weeks ago

sfisher commented 2 weeks ago

This is a continuation of #541 .

This makes it so that switching to ARK or DOI changes the form below without reloading the page.

It also includes some of the previous fixes for VPAT stuff. If you accept that previous PR first then the diff will only show the things actually changed for this PR.

This now moves the form to a partial. It adds some actions controller actions for handling AJAX. It adds javascript for triggering the AJAX calls and then re-renders the new content into the appropriate div for the new form.

I also had to add some hidden fields and leave the radio buttons for the ARk/DOI outside the main form since it will get erased when the form is re-rendered so that it needs to stay outside the main form.

I took a while to figure out why the normal one didn't work and apparently the layout for it doesn't work with fieldset but needs to stay as a div instead.

We can talk through this in our dev sync or other things if you like since it may not be obvious how it works if you're not familiar with AJAX and some of the Javascript.

sfisher commented 1 week ago

Sure, if you like. Their problem with the old form was that the page reloading resets the user/screen reader place on the page (on the ark/doi radio buttons). This addresses it and is a fairly standard alternative to reloading the whole page so that the place on the page isn't reset by a page reload.

But I'm sure we can run it by John Kratz or someone on the team and they'd be happy to look at it.

sfisher commented 1 week ago

We're not currently using this, though may be useful in the future. If we come back to this branch it will be here.

sfisher commented 5 days ago

Ooopsie. I think I accidentally closed the wrong ticket here and it wasn't merged. So re-opening.