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

Link to textanswer_edit with a button instead of in the answer text #1689

Merged
merged 16 commits into from
Jan 17, 2022

Conversation

fidoriel
Copy link
Collaborator

No description provided.

@janno42 janno42 linked an issue Dec 21, 2021 that may be closed by this pull request
evap/staff/views.py Outdated Show resolved Hide resolved
@@ -164,6 +168,7 @@ $(document).ready(() => {
type: "POST",
url: "{% url 'staff:evaluation_textanswers_update_publish' %}",
data: parameters,
success: function(data) { if(action == "textanswer_link" && data) window.location = data; },
Copy link
Member

Choose a reason for hiding this comment

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

This seems a bit hacky, I don't know what we concluded the last time we talked about it. We now thought that it could possibly be clearer if the button would be in a form by default (which would submit and redirect by default) and we only cancel the submission when we want to do ajax instead.

Even better: Always submit forms and use standard conventions to ignore the response. According to https://stackoverflow.com/a/3283126/13679671 (I also tested with the evaluation_edit view) the browser will not reload the page if the status code is 204 - that means you could just return that for all cases except for the one where you really want to redirect. This means a small refactor is needed about the way these buttons work - I don't know how keen you are on HTML forms, but it probably shouldn't be too bad.

If you don't want to spend more time on this, you can also leave it like this for now and we will fix it later :)

@niklasmohrin
Copy link
Member

Two things functionality-wise:

  1. When editing an answer and saving, I start over at the first textanswer instead of where I left off
  2. When clicking the edit button, the quick view still shifts to the next question just before the site reloads:
    slidingbug

Not sure how much weight should be put on those things. I would prefer if both were fixed, but I leave the final call to @janno42 and others :)

evap/staff/templates/quick-review.js Outdated Show resolved Hide resolved
@fidoriel
Copy link
Collaborator Author

fidoriel commented Jan 6, 2022

There is a third thing too. If you open the edit window from full review and save you will be redirected to the quick review. All those three things have been there before my PR. If you like I would fix them. But this is a very rarely used feature, if I understood correctly 10x a year and the bugs are not critical. I think it is not worth the time. You could open a issue with very low priority?

@niklasmohrin
Copy link
Member

The two things I wrote are old? How do they occur? Aren't these problems that are specific to the new feature?

It would of course be nice to have all of it fixed, but we can probably first merge this PR for the functionality and make a second issue that makes-it-right ™️, this one shouldn't be put back for too long though

@fidoriel
Copy link
Collaborator Author

fidoriel commented Jan 7, 2022

I did not change the links, just where they are located.

fidoriel and others added 2 commits January 10, 2022 19:57
Co-authored-by: Johannes Wolf <johannes-wolf@posteo.de>
Co-authored-by: Johannes Wolf <johannes-wolf@posteo.de>
Copy link
Member

@janno42 janno42 left a comment

Choose a reason for hiding this comment

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

✔️ Meets requirements
✔️ UI functionality checked

Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

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

One more thought from me, other than that this looks good 👍

evap/staff/views.py Show resolved Hide resolved
Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

Current code is okay for now, @niklasmohrin will create a follow up issue where we'll try to refactor this to use less javascript and instead utilize html forms and behavior of browsers on different http status codes.

@niklasmohrin niklasmohrin changed the title fix for #1607 Link to textanswer_edit with a button instead of in the answer text Jan 17, 2022
@niklasmohrin niklasmohrin merged commit e7455ee into e-valuation:main Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Text answer edit button
4 participants