from .search import search as search_blueprint | from .search import search as search_blueprint | ||||
app.register_blueprint(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 | # blueprint for data parts of app | ||||
from .data import data as data_blueprint | from .data import data as data_blueprint |
# @name: random.py | |||||
# @name: interventions.py | |||||
# @creation_date: 2022-09-09 | # @creation_date: 2022-09-09 | ||||
# @license: The MIT License <https://opensource.org/licenses/MIT> | # @license: The MIT License <https://opensource.org/licenses/MIT> | ||||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | # @author: Simon Bowie <ad7588@coventry.ac.uk> | ||||
# @purpose: random route for random | |||||
# @purpose: inteventions route for Section 2: Search Interventions | |||||
# @acknowledgements: | # @acknowledgements: | ||||
from flask import Blueprint, render_template, request | from flask import Blueprint, render_template, request | ||||
from . import solr | from . import solr | ||||
from . import ops | 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(): | def random_record(): | ||||
core = 'all' | core = 'all' | ||||
search_results = solr.random_search(core) | search_results = solr.random_search(core) | ||||
result.update(image) | result.update(image) | ||||
return render_template('record.html', results=results) | 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(): | def two_random_records(): | ||||
core = 'all' | core = 'all' | ||||
results_list = [] | results_list = [] | ||||
i += 1 | i += 1 | ||||
return render_template('compare.html', results=results_list) | 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(): | def ten_random_titles(): | ||||
titles = solr.get_ten_random_elements('title') | titles = solr.get_ten_random_elements('title') | ||||
additional_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) | 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(): | def ten_random_abstracts(): | ||||
abstracts = solr.get_ten_random_elements('abstract') | abstracts = solr.get_ten_random_elements('abstract') | ||||
return render_template('abstracts.html', abstracts=abstracts) | 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(): | def random_images(): | ||||
images = solr.get_random_images(4) | images = solr.get_random_images(4) | ||||
additional_images = solr.get_random_images(6) | additional_images = solr.get_random_images(6) |
# @creation_date: 2022-09-07 | # @creation_date: 2022-09-07 | ||||
# @license: The MIT License <https://opensource.org/licenses/MIT> | # @license: The MIT License <https://opensource.org/licenses/MIT> | ||||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | # @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: | # @acknowledgements: | ||||
# https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login | # https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login | ||||
<div class="index-row button-search random-interferences"> | <div class="index-row button-search random-interferences"> | ||||
<div class="col text-center p-2"> | <div class="col text-center p-2"> | ||||
<!-- random titles --> | <!-- 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> | ||||
<div class="col text-center p-2"> | <div class="col text-center p-2"> | ||||
<!-- random abstracts --> | <!-- 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> | ||||
<div class="col text-center p-2"> | <div class="col text-center p-2"> | ||||
<!-- random images --> | <!-- 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> | ||||
</div> | </div> | ||||
<div class="index-row button-search random-interferences mt-5"> | <div class="index-row button-search random-interferences mt-5"> | ||||
<div class="col text-center p-2"> | <div class="col text-center p-2"> | ||||
<!-- random record --> | <!-- 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> | ||||
<div class="col text-center p-2"> | <div class="col text-center p-2"> | ||||
<!-- compare two random records --> | <!-- 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> | ||||
<div class="col text-center p-2"> | <div class="col text-center p-2"> |
<span class="code">↪ Interventions are a mode of search, they disrupt ordering and invite unexpected readings....</span> | <span class="code">↪ Interventions are a mode of search, they disrupt ordering and invite unexpected readings....</span> | ||||
</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 | ### Section 3: Hidden in plain sight |