-
Notifications
You must be signed in to change notification settings - Fork 2.8k
add optional return_url parameter to "Add" button for missing prerequisites #20128
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
add optional return_url parameter to "Add" button for missing prerequisites #20128
Conversation
…erequisites.html to return user back to initial page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion on the change to add.html
.
{% if url %} | ||
{% load i18n %} | ||
<a href="{{ url }}" type="button" class="btn btn-primary"> | ||
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %} | ||
</a> | ||
{% endif %} | ||
{% load i18n %} | ||
{% if return_url %} | ||
<a href="{{ url }}?return_url={{ return_url }}" type="button" class="btn btn-primary"> | ||
{% else %} | ||
<a href="{{ url }}" type="button" class="btn btn-primary"> | ||
{% endif %} | ||
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %} | ||
</a> | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to avoid repeating ourselves:
{% if url %} | |
{% load i18n %} | |
<a href="{{ url }}" type="button" class="btn btn-primary"> | |
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %} | |
</a> | |
{% endif %} | |
{% load i18n %} | |
{% if return_url %} | |
<a href="{{ url }}?return_url={{ return_url }}" type="button" class="btn btn-primary"> | |
{% else %} | |
<a href="{{ url }}" type="button" class="btn btn-primary"> | |
{% endif %} | |
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %} | |
</a> | |
{% endif %} | |
{% if url %} | |
{% load i18n %} | |
<a href="{{ url }}{% if return_url %}?return_url={{ return_url }}{% endif %}" type="button" class="btn btn-primary"> | |
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %} | |
</a> | |
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah of course, makes sense. django templates still feel a bit strange to me.
i commited the fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @9er-tom !
Fixes: #19990
add optional return_url parameter to "Add" button, used in missing_prerequisites.html to return user back to initial page after adding an prerequisite object