coyote-team / coyote

Image annotation site and API to enable the distributed annotation of museum images.
https://coyote-team.github.io/coyote/
Other
58 stars 11 forks source link

Add AJAX to dashboard status changes #165

Open alavatelliMCA opened 6 years ago

alavatelliMCA commented 6 years ago

After approve or reject is clicked from the main dashboard admin Ready to Review queue you are sent to the description/representation page that was either approved or rejected.

When a description is approved or rejected and no more descriptions remain in the queue on that resource the entire image/resource block should go away and you stay on the main dashboard page so that you may continue approving and rejecting or editing.

stacietaylorcima commented 6 years ago

Notes on this issue: I think we need to apply some kind of AJAX call to the simple_form_for. From what I've researched, we should need to pass remote: true through the form. simple_form_for accepts an options hash as the 2nd argument so I thought something along these lines would work: = simple_form_for representation, remote: true, html: { class: 'form form--inline' }, wrapper: :inline do |f|, but it doesn't seem to do the trick. I also think I need to do something with the ajax:success and ajax:error events in the controller? Anyway, I'm going to set this one aside to let my mind refresh on it and move on to something else.

@flipsasser Any thoughts?

stacietaylorcima commented 6 years ago

@alavatelliMCA This is a TOTAL pain and something we are definitely working on. In the meantime, if you want to approve a bunch of representations quickly, I'd suggest doing it on the Descriptions page, but selecting only the boxes of the representations you want to approve/reject and applying that action. Obvs, still not an efficient solution, but might save you some time if you need to work on this right away. I'll keep you updated!

flipsasser commented 6 years ago

@stacietaylorcima I'd recommend you provide a simple return_to param in the form, and have the controller performing the approve / reject workflow check for that param to redirect users to, only then falling back to the show representation page.

sinabahram commented 6 years ago

I actually was hoping for an AJAX solution here. can we have this not incur a page load? The API is fully there. Can we not just use SimpleForm to do an ajax request instead of a post with redirect?

I ask because this will lose focus for keyboard users, but more importantly, lead to a 1,000 new design requests from MCA because it may not scroll to the right place after page load, cause a flicker, etc. etc. etc.

If that’s super hard, I get it, but let me know.

flipsasser commented 6 years ago

That's feasible. I'll work w/ @stacietaylorcima on getting that implemented.