diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-07-14 18:50:47 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-07-14 18:50:47 -0700 |
commit | 969d5a2c913fcccce041d777f163bd8f995601b4 (patch) | |
tree | 8db68567877cb3efd366f0d6d1a5c9e50bf978cb /python/fatcat_web | |
parent | 8bf05b624c228944c4337ce57d0efa9c5ff82dcf (diff) | |
download | fatcat-x-attic-camp.tar.gz fatcat-x-attic-camp.zip |
add local links to search resultsx-attic-camp
Diffstat (limited to 'python/fatcat_web')
-rw-r--r-- | python/fatcat_web/routes.py | 11 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_search.html | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 393df33e..5fad24e8 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -15,6 +15,7 @@ from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle from fatcat_web.cors import crossdomain from fatcat_web.search import * from fatcat_web.entity_helpers import * +from fatcat_web.hacks import get_camp_pdf_path ### Generic Entity Views #################################################### @@ -703,6 +704,16 @@ def release_bibtex(ident): bibtex = citeproc_csl(csl, 'bibtex') return Response(bibtex, mimetype="text/plain") +@app.route('/release/<ident>/camp_pdf', methods=['GET']) +def release_camp_pdf(ident): + release = generic_get_entity('release', ident) + camp_pdf_url = get_camp_pdf_path(release) + if camp_pdf_url: + return redirect(app.config['CAMP_PDF_URI'] + camp_pdf_url, 301) + else: + flash("Release doesn't have any file here at the camp? Sorry!") + abort(404) + @app.route('/release/<ident>/citeproc', methods=['GET']) def release_citeproc(ident): style = request.args.get('style', 'harvard1') diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html index 59411c62..dcbfeb35 100644 --- a/python/fatcat_web/templates/release_search.html +++ b/python/fatcat_web/templates/release_search.html @@ -49,7 +49,11 @@ </h4> {% if paper.best_pdf_url %} <div style="float: right; padding: 4px;"> - <a href="{{ paper.best_pdf_url }}" class="ui violet tag label"><i class="file icon"></i>fulltext</a> + {% if paper.ia_pdf_url and '://web.archive.org' in paper.ia_pdf_url %} + <a href="/release/{{ paper.ident }}/camp_pdf" class="ui yellow tag label"><i class="tree icon"></i>local copy</a> + <br> + {% endif %} + <a href="{{ paper.best_pdf_url }}" class="ui violet tag label"> <i class="file icon"></i>fulltext</a> </div> {% endif %} {# |