Skip to content

Commit

Permalink
Adding new Collection helper
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Nov 7, 2024
1 parent bea2357 commit edd7137
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
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.")

0 comments on commit edd7137

Please sign in to comment.