-
Notifications
You must be signed in to change notification settings - Fork 72
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
Pdf mobile #2102
Pdf mobile #2102
Conversation
@@ -105,7 +105,7 @@ def sauce_tunnel(): | |||
Set up Sauce tunnel before running functional tests targeted at localhost. | |||
""" | |||
if subprocess.call(['which','sc']) == 1: # error return code -- program not found | |||
sys.exit("Please check that the `sc` program is installed and in your path. To install: https://docs.saucelabs.com/reference/sauce-connect/") | |||
sys.exit("Please check that the `sc` program is installed and in your path. To install: https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy") |
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.
LINK ROT!!!!!!
@@ -0,0 +1,7 @@ | |||
{% with request.META.HTTP_REFERER as referer %} |
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.
Is referer actually used in this "with" block? Part of a previous draft maybe?
{% endblock %} | ||
|
||
{% block mainContent %} | ||
|
||
{% if link.user_deleted %} | ||
{% include "archive/deleted.html" %} | ||
{% elif redirect_to_download_view %} | ||
{% include "archive/download_to_view_pdf.html" %} | ||
{% elif can_view %} | ||
{% include "archive/iframe.html" %} | ||
{% elif link.is_private %} |
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 think maybe this new part needs to be nested as an option inside the "elif can_view" block. As is, does this expose links that people wouldn't be allowed to view, via a laptop/desktop?
@@ -54,6 +54,17 @@ def test_dark_archive(self): | |||
response = self.get('single_linky', reverse_kwargs={'kwargs': {'guid': 'ABCD-0001'}}) | |||
self.assertIn("This record is private.", response.content) | |||
|
|||
def test_redirect_to_download(self): | |||
# Give user option to download to view pdf if on mobile | |||
client = Client(HTTP_USER_AGENT='Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_4 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B350 Safari/8536.25') |
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.
Cool!
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 so much for tackling this pesky issue!!! Looks great: had a couple quick questions, left as individual comments.
perma_web/perma/views/common.py
Outdated
capture_mime_type = capture.mime_type() | ||
redirect_to_download_view = redirect_to_download(capture_mime_type, raw_user_agent) | ||
except AttributeError: | ||
# if capture is deleted, we will catch it here |
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.
Really liked your commit message here. "If capture is deleted, then mime type does not exist. Catch error." Total nitpick, totally up to you: do you think that might be a clearer comment here than the above?
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.
And while I'm being a complete pain in the butt: redirect_to_download(capture_mime_type, raw_user_agent)
won't throw an attribute error right? Should that line be outside of the try block?
fixes #2056
Showing "view/download" button on any mobile device when viewing a PDF