-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Display warning banner in latest version #3547
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
from rest_framework.response import Response | ||
from rest_framework_jsonp.renderers import JSONPRenderer | ||
|
||
from readthedocs.builds.constants import LATEST, TAG | ||
from readthedocs.builds.constants import LATEST, STABLE, TAG | ||
from readthedocs.builds.models import Version | ||
from readthedocs.projects.models import Project | ||
from readthedocs.projects.version_handling import ( | ||
|
@@ -26,7 +26,8 @@ def get_version_compare_data(project, base_version=None): | |
Retrieve metadata about the highest version available for this project. | ||
|
||
:param base_version: We assert whether or not the base_version is also the | ||
highest version in the resulting "is_highest" value. | ||
highest version in the resulting "is_highest" value | ||
or the stabel version in "is_stable". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Little typo "stabel" -> "stable" |
||
""" | ||
versions_qs = project.versions.public().filter(active=True) | ||
|
||
|
@@ -40,10 +41,15 @@ def get_version_compare_data(project, base_version=None): | |
'project': six.text_type(highest_version_obj), | ||
'version': six.text_type(highest_version_comparable), | ||
'is_highest': True, | ||
'is_stable': False, | ||
} | ||
if highest_version_obj: | ||
ret_val['url'] = highest_version_obj.get_absolute_url() | ||
ret_val['slug'] = (highest_version_obj.slug,) | ||
if base_version and base_version.slug == STABLE: | ||
ret_val['is_highest'] = False | ||
ret_val['is_stable'] = True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not really following the whole flow, but supposing this case:
we end up returning a (I'm asking because I'm a little confused here) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I'm confused too p: but looking to the docstring, says:
So, always return that information about the highest. And when And I realized that when I enter to stable version manually (docs/2018 instead of docs/stable in my example) the message appears, I need to check that case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After looking deeper into the code, I found that @humitos can you confirm that? In that case, we need to add some field |
||
return ret_val | ||
if base_version and base_version.slug != LATEST: | ||
try: | ||
base_version_comparable = parse_version_failsafe( | ||
|
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.
Somewhere I read that @ericholscher used the word "unreleased" here instead and I liked.
I think it's clearer to use a sentence like,
You are using an unreleased version of this library
Going deeper on this (maybe in another PR focusing more on this), words like "library" and "using" don't make too much sense for all type of documentation that RTD hosts. Maybe changing them to "documentation" and "reading" are more general.
You are reading an unreleased version of this documentation
What do you think?
Example from Django docs,
https://docs.djangoproject.com/en/dev/intro/tutorial01/
I also like the "tip" saying where you can find the other versions. I'd like to go in that direction, but I'm not sure how to write a good English sentence for this, @RichardLitt want to help us?
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.
I was thinking the same, the word documentation makes more sense here.
Also, we are missing some i18n on this message, I'm not sure how relevant is that for now.
About the tip, I think would be a little confusing, since the position of the version selector change according to the theme (some times is on the left and others floating to the right), and we asre already providing a link to go to the stable version.
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.
Good point! I think it's relevant, but I'd say to open another issue to track this. I don't know how we are handling i18n in Javascript. Did you see other parts in the code?
Yeah, you are right. I think there is no generic way to point the users to the right place.