From 969d5a2c913fcccce041d777f163bd8f995601b4 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 14 Jul 2019 18:50:47 -0700 Subject: add local links to search results --- python/fatcat_web/routes.py | 11 +++++++++++ python/fatcat_web/templates/release_search.html | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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//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//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 @@ {% if paper.best_pdf_url %}
-   fulltext + {% if paper.ia_pdf_url and '://web.archive.org' in paper.ia_pdf_url %} +   local copy +
+ {% endif %} +         fulltext
{% endif %} {# -- cgit v1.2.3