@@ -27,9 +27,9 @@ def create_app(): | |||
from .search import search as search_blueprint | |||
app.register_blueprint(search_blueprint) | |||
# blueprint for random parts of app | |||
from .random import random as random_blueprint | |||
app.register_blueprint(random_blueprint) | |||
# blueprint for interventions parts of app | |||
from .interventions import interventions as interventions_blueprint | |||
app.register_blueprint(interventions_blueprint) | |||
# blueprint for data parts of app | |||
from .data import data as data_blueprint |
@@ -1,18 +1,18 @@ | |||
# @name: random.py | |||
# @name: interventions.py | |||
# @creation_date: 2022-09-09 | |||
# @license: The MIT License <https://opensource.org/licenses/MIT> | |||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | |||
# @purpose: random route for random | |||
# @purpose: inteventions route for Section 2: Search Interventions | |||
# @acknowledgements: | |||
from flask import Blueprint, render_template, request | |||
from . import solr | |||
from . import ops | |||
random = Blueprint('random', __name__) | |||
interventions = Blueprint('interventions', __name__) | |||
# route for random page | |||
@random.route('/random/') | |||
# route for random entry page ('A random entry') | |||
@interventions.route('/interventions/random/') | |||
def random_record(): | |||
core = 'all' | |||
search_results = solr.random_search(core) | |||
@@ -25,8 +25,8 @@ def random_record(): | |||
result.update(image) | |||
return render_template('record.html', results=results) | |||
# route for comparing two random records | |||
@random.route('/random/two/') | |||
# route for comparing two random records ('A juxtaposition of two') | |||
@interventions.route('/interventions/juxtaposition/') | |||
def two_random_records(): | |||
core = 'all' | |||
results_list = [] | |||
@@ -44,21 +44,21 @@ def two_random_records(): | |||
i += 1 | |||
return render_template('compare.html', results=results_list) | |||
# route for getting ten random titles | |||
@random.route('/random/titles/') | |||
# route for getting ten random titles ('A poetics of titles') | |||
@interventions.route('/interventions/titles/') | |||
def ten_random_titles(): | |||
titles = solr.get_ten_random_elements('title') | |||
additional_titles = solr.get_ten_random_elements('title') | |||
return render_template('titles.html', titles=titles, additional_titles=additional_titles) | |||
# route for getting ten random abstracts | |||
@random.route('/random/abstracts/') | |||
# route for getting ten random abstracts ('A handful of fragments') | |||
@interventions.route('/interventions/fragments/') | |||
def ten_random_abstracts(): | |||
abstracts = solr.get_ten_random_elements('abstract') | |||
return render_template('abstracts.html', abstracts=abstracts) | |||
# route for getting ten random images | |||
@random.route('/random/images/') | |||
# route for getting ten random images ('A scattering of images') | |||
@interventions.route('/interventions/scattering/') | |||
def random_images(): | |||
images = solr.get_random_images(4) | |||
additional_images = solr.get_random_images(6) |
@@ -2,7 +2,7 @@ | |||
# @creation_date: 2022-09-07 | |||
# @license: The MIT License <https://opensource.org/licenses/MIT> | |||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | |||
# @purpose: Main route for index and other pages | |||
# @purpose: Main route for index and other pages in Section 1: Searching the archive | |||
# @acknowledgements: | |||
# https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login | |||
@@ -10,17 +10,17 @@ | |||
<div class="index-row button-search random-interferences"> | |||
<div class="col text-center p-2"> | |||
<!-- random titles --> | |||
<a href="{{ url_for('random.ten_random_titles') }}">a poetics of titles</a> | |||
<a href="{{ url_for('interventions.ten_random_titles') }}">a poetics of titles</a> | |||
</div> | |||
<div class="col text-center p-2"> | |||
<!-- random abstracts --> | |||
<a href="{{ url_for('random.ten_random_abstracts') }}">a handful of fragments</a> | |||
<a href="{{ url_for('interventions.ten_random_abstracts') }}">a handful of fragments</a> | |||
</div> | |||
<div class="col text-center p-2"> | |||
<!-- random images --> | |||
<a href="{{ url_for('random.random_images') }}">a scattering of images</a> | |||
<a href="{{ url_for('interventions.random_images') }}">a scattering of images</a> | |||
</div> | |||
</div> | |||
@@ -58,12 +58,12 @@ | |||
<div class="index-row button-search random-interferences mt-5"> | |||
<div class="col text-center p-2"> | |||
<!-- random record --> | |||
<a href="{{ url_for('random.random_record') }}">a random entry</a> | |||
<a href="{{ url_for('interventions.random_record') }}">a random entry</a> | |||
</div> | |||
<div class="col text-center p-2"> | |||
<!-- compare two random records --> | |||
<a href="{{ url_for('random.two_random_records') }}">a juxtaposition of two</a> | |||
<a href="{{ url_for('interventions.two_random_records') }}">a juxtaposition of two</a> | |||
</div> | |||
<div class="col text-center p-2"> |
@@ -38,12 +38,12 @@ | |||
<span class="code">↪ Interventions are a mode of search, they disrupt ordering and invite unexpected readings....</span> | |||
</span> | |||
- [A poetics of titles](interventions/#titles "links to interventions section poetics of titles") | |||
- [A handful of fragments](interventions/#fragments "links to interventions section handful of fragments") | |||
- [A scattering of images](interventions/#scattering "links to interventions section scattering of images") | |||
- [A random entry](interventions/#random "links to interventions section random entry") | |||
- [A juxtaposition of two](interventions/#juxtaposition "links to interventions section juxtaposition of two") | |||
- [A timeline of inverntions](interventions/#timeline "links to interventions section timeline of inverntions) | |||
- [A poetics of titles](/interventions/titles) | |||
- [A handful of fragments](/interventions/fragments) | |||
- [A scattering of images](/interventions/scattering) | |||
- [A random entry](/interventions/random) | |||
- [A juxtaposition of two](interventions/juxtaposition) | |||
- [A timeline of inventions](interventions/#timeline "links to interventions section timeline of inverntions) | |||
### Section 3: Hidden in plain sight |