Skip to content
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

Adding new Collection helper #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions iiify/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def helper(identifier):
return render_template('helpers/movies.html', identifier=identifier)
elif mediatype == "texts":
return render_template('helpers/texts.html', identifier=identifier)
elif mediatype == "collection":
return render_template('helpers/collection.html', identifier=identifier)
else:
return render_template('helpers/unknown.html', identifier=identifier)

Expand Down
38 changes: 38 additions & 0 deletions iiify/templates/helpers/collection.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>IIIF Collection Helper</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<link rel="stylesheet" type="text/css" href="{{ request.url_root}}static/styles/docs.css" media="all"/>

</head>
<body>
<header>
<img class="center" src="{{ request.url_root }}static/images/ia.png"/>
</header>
<div id="container">

<h1>IIIF Collection Helper</h1>

<p>The IA collection page URL is: <a href="https://archive.org/details/{{ identifier }}">https://archive.org/details/{{ identifier }}</a></p>

<p>The IA identifier is: {{ identifier }}</p>

<p>The IIIF collection URL is: <a href="https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json">https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json</a></p>

<h2>IIIF viewer options</h2>
<ul>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json">Mirador</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json">Universal Viewer</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json">Clover</a></li>

</ul>

</body>
</html>
23 changes: 23 additions & 0 deletions tests/test_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
os.environ["FLASK_CACHE_DISABLE"] = "true"

import unittest
from flask.testing import FlaskClient
from iiify.app import app

class TestHelper(unittest.TestCase):

def setUp(self) -> None:
self.test_app = FlaskClient(app)

def test_single_image(self):
resp = self.test_app.get("/iiif/helper/img-8664_202009/")
self.assertEqual(resp.status_code, 200)

self.assertIn('<a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/3/img-8664_202009/manifest.json">Mirador</a>', resp.text, "Couldn't find Mirador link in helper page.")

def test_collection(self):
resp = self.test_app.get("/iiif/helper/frankbford/")
self.assertEqual(resp.status_code, 200)

self.assertIn('<a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/3/frankbford/collection.json">Mirador</a>', resp.text, "Couldn't find Mirador link in helper page.")
Loading