Skip to content
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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Textcavator is primarily intended for academic research and higher education. We

## Contents

This repository contains the source code for the Textcavator web application, which consists of a Django backend and Angular frontend.
This repository contains the source code for the Textcavator web application, which consists of a [Django backend](/backend/) and [Angular frontend](/frontend/). It also contains [developer documentation](/documentation/), [functional tests](/functional-tests/), and a [test app for embedding Textcavator](/iframe-test-app/).

For corpora included in Textcavator, the backend includes a definition file that specifies how to read the source files, and how this data should be structured and presented in Textcavator. This repository does _not_ include the source data itself, beyond a few sample files for testing.

Expand Down
2 changes: 2 additions & 0 deletions backend/ianalyzer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

ALLOWED_HOSTS = []

X_FRAME_OPTIONS = 'ALLOW'


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
Expand Down
17 changes: 17 additions & 0 deletions iframe-test-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# iframe test app

This is a minimal setup to test embedding Textcavator in another site using an iframe. It serves a web page that embeds your Textcavator development server. You can use it to test the layout, or try out the workflow in an embedded frame.

## Usage

The test app is run using `server.py`. It requires Python to use, no dependencies.

To run, start your Texcavator development server. Then run the container app by running:

```sh
python server.py
```

The container app will run at http://localhost:9000/ . Use ctrl + C to quit.

To direct the iframe to a specific corpus, you can include a query parameter `corpus` in the URL with the corpus name, e.g. http://localhost:9000/?corpus=troonredes .
62 changes: 62 additions & 0 deletions iframe-test-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!doctype html>
<html lang="en" data-theme="light">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="./solis.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Container app</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css">
<link rel="stylesheet" href="./style.css">
</head>

<body>
<header class="container">
<div class="hero is-small">
<div class="hero-body">
<div class="is-flex is-flex-direction-row is-align-items-center">
<div class="image is-32x32 mx-2">
<img src="./solis.png" class="">
</div>
<span>
Utrecht University
</span>
</div>
</div>
</div>
<div class="hero is-light">
<div class="hero-body">
<h1 class="title">Textcavator container</h1>
</div>
</div>
<div class="navbar is-dark" role="presentation">
<div class="navbar-start">
<a class="navbar-item">Home</a>
<a class="navbar-item">Research</a>
<a class="navbar-item">News</a>
<a class="navbar-item">About</a>
</div>
</nav>
</header>
<main>
<section class="section">
<div class="container">
<div class="frame-container">
<iframe id="textcavator-iframe"
width="100%" height="100%">
</iframe>
</div>
</div>
</section>
</main>
<footer class="container">
<div class="footer">
<div class="content has-text-centered">
Some text here.
</div>
</div>
</footer>
<script src="./main.js"></script>
</body>

</html>
10 changes: 10 additions & 0 deletions iframe-test-app/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var url = new URL(window.location);
var corpus = url.searchParams.get('corpus');

var appUrl = new URL('http://localhost:4200');
if (corpus) {
appUrl.pathname = `/search/${corpus}/`;
}

var iframe = document.getElementById('textcavator-iframe');
iframe.setAttribute('src', appUrl.toString());
9 changes: 9 additions & 0 deletions iframe-test-app/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from http.server import HTTPServer, SimpleHTTPRequestHandler

ADDRESS = ('', 9000)

server = HTTPServer(ADDRESS, SimpleHTTPRequestHandler)

if __name__ == '__main__':
print(f'Starting server at http://localhost:{server.server_port}')
server.serve_forever()
Binary file added iframe-test-app/solis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions iframe-test-app/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.frame-container {
height: 90vh;
}