@@ -56,13 +56,33 @@ def create_app(): | |||
from .tool import tool as tool_blueprint | |||
app.register_blueprint(tool_blueprint) | |||
# blueprint for practice parts of app | |||
from .practice import practice as practice_blueprint | |||
app.register_blueprint(practice_blueprint) | |||
# blueprint for sensitivity parts of app | |||
from .sensitivity import sensitivity as sensitivity_blueprint | |||
app.register_blueprint(sensitivity_blueprint) | |||
# blueprint for typology parts of app | |||
from .typology import typology as typology_blueprint | |||
app.register_blueprint(typology_blueprint) | |||
# blueprint for workflow parts of app | |||
from .workflow import workflow as workflow_blueprint | |||
app.register_blueprint(workflow_blueprint) | |||
# blueprint for publisher parts of app | |||
from .publisher import publisher as publisher_blueprint | |||
app.register_blueprint(publisher_blueprint) | |||
# blueprint for book parts of app | |||
from .book import book as book_blueprint | |||
app.register_blueprint(book_blueprint) | |||
# blueprint for practice parts of app | |||
from .practice import practice as practice_blueprint | |||
app.register_blueprint(practice_blueprint) | |||
# blueprint for reference parts of app | |||
from .reference import reference as reference_blueprint | |||
app.register_blueprint(reference_blueprint) | |||
# blueprint for create parts of app | |||
from .create import create as create_blueprint |
@@ -0,0 +1,67 @@ | |||
# @name: publisher.py | |||
# @version: 0.1 | |||
# @creation_date: 2022-02-08 | |||
# @license: The MIT License <https://opensource.org/licenses/MIT> | |||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | |||
# @purpose: publisher route for publisher-related functions and pages | |||
# @acknowledgements: | |||
# https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3 | |||
from flask import Blueprint, render_template, request, flash, redirect, url_for | |||
from flask_login import login_required, current_user | |||
from .models import Publisher | |||
from werkzeug.exceptions import abort | |||
from . import db | |||
publisher = Blueprint('publisher', __name__) | |||
# function to retrieve data about a single publisher from the database | |||
def get_publisher(publisher_id): | |||
publisher = Publisher.query.filter_by(id=publisher_id).first() | |||
if publisher is None: | |||
abort(404) | |||
return publisher | |||
# route for displaying all publishers in database | |||
@publisher.route('/publishers') | |||
def get_publishers(): | |||
publishers = Publisher.query | |||
return render_template('publishers.html', publishers=publishers) | |||
# route for displaying a single publisher based on the ID in the database | |||
@publisher.route('/publishers/<int:publisher_id>') | |||
def show_publisher(publisher_id): | |||
publisher = get_publisher(publisher_id) | |||
return render_template('publisher.html', publisher=publisher) | |||
# route for editing a single publisher based on the ID in the database | |||
@publisher.route('/publishers/<int:publisher_id>/edit', methods=('GET', 'POST')) | |||
@login_required | |||
def edit_publisher(publisher_id): | |||
publisher = get_publisher(publisher_id) | |||
if request.method == 'POST': | |||
name = request.form['name'] | |||
description = request.form['description'] | |||
if not name: | |||
flash('Name is required!') | |||
else: | |||
publisher = Publisher.query.get(publisher_id) | |||
publisher.name = name | |||
publisher.description = description | |||
db.session.commit() | |||
return redirect(url_for('publisher.get_publishers')) | |||
return render_template('edit.html', publisher=publisher) | |||
# route for function to delete a single publisher from the edit page | |||
@publisher.route('/publishers/<int:publisher_id>/delete', methods=('POST',)) | |||
@login_required | |||
def delete_publisher(publisher_id): | |||
publisher = get_publisher(publisher_id) | |||
deletion = Publisher.query.get(publisher_id) | |||
db.session.delete(deletion) | |||
db.session.commit() | |||
flash('Successfully deleted!') | |||
return redirect(url_for('publisher.get_publishers')) |
@@ -0,0 +1,67 @@ | |||
# @name: reference.py | |||
# @version: 0.1 | |||
# @creation_date: 2022-02-08 | |||
# @license: The MIT License <https://opensource.org/licenses/MIT> | |||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | |||
# @purpose: reference route for reference-related functions and pages | |||
# @acknowledgements: | |||
# https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3 | |||
from flask import Blueprint, render_template, request, flash, redirect, url_for | |||
from flask_login import login_required, current_user | |||
from .models import Reference | |||
from werkzeug.exceptions import abort | |||
from . import db | |||
reference = Blueprint('reference', __name__) | |||
# function to retrieve data about a single reference from the database | |||
def get_reference(reference_id): | |||
reference = Reference.query.filter_by(id=reference_id).first() | |||
if reference is None: | |||
abort(404) | |||
return reference | |||
# route for displaying all references in database | |||
@reference.route('/references') | |||
def get_references(): | |||
references = Reference.query | |||
return render_template('references.html', references=references) | |||
# route for displaying a single reference based on the ID in the database | |||
@reference.route('/references/<int:reference_id>') | |||
def show_reference(reference_id): | |||
reference = get_reference(reference_id) | |||
return render_template('reference.html', reference=reference) | |||
# route for editing a single reference based on the ID in the database | |||
@reference.route('/references/<int:reference_id>/edit', methods=('GET', 'POST')) | |||
@login_required | |||
def edit_reference(reference_id): | |||
reference = get_reference(reference_id) | |||
if request.method == 'POST': | |||
name = request.form['name'] | |||
description = request.form['description'] | |||
if not name: | |||
flash('Name is required!') | |||
else: | |||
reference = Reference.query.get(reference_id) | |||
reference.name = name | |||
reference.description = description | |||
db.session.commit() | |||
return redirect(url_for('reference.get_references')) | |||
return render_template('edit.html', reference=reference) | |||
# route for function to delete a single reference from the edit page | |||
@reference.route('/references/<int:reference_id>/delete', methods=('POST',)) | |||
@login_required | |||
def delete_reference(reference_id): | |||
reference = get_reference(reference_id) | |||
deletion = Reference.query.get(reference_id) | |||
db.session.delete(deletion) | |||
db.session.commit() | |||
flash('Successfully deleted!') | |||
return redirect(url_for('reference.get_references')) |
@@ -0,0 +1,67 @@ | |||
# @name: sensitivity.py | |||
# @version: 0.1 | |||
# @creation_date: 2022-02-08 | |||
# @license: The MIT License <https://opensource.org/licenses/MIT> | |||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | |||
# @purpose: sensitivity route for sensitivity-related functions and pages | |||
# @acknowledgements: | |||
# https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3 | |||
from flask import Blueprint, render_template, request, flash, redirect, url_for | |||
from flask_login import login_required, current_user | |||
from .models import Sensitivity | |||
from werkzeug.exceptions import abort | |||
from . import db | |||
sensitivity = Blueprint('sensitivity', __name__) | |||
# function to retrieve data about a single sensitivity from the database | |||
def get_sensitivity(sensitivity_id): | |||
sensitivity = Sensitivity.query.filter_by(id=sensitivity_id).first() | |||
if sensitivity is None: | |||
abort(404) | |||
return sensitivity | |||
# route for displaying all sensitivities in database | |||
@sensitivity.route('/sensitivities') | |||
def get_sensitivities(): | |||
sensitivities = Sensitivity.query | |||
return render_template('sensitivities.html', sensitivities=sensitivities) | |||
# route for displaying a single sensitivity based on the ID in the database | |||
@sensitivity.route('/sensitivities/<int:sensitivity_id>') | |||
def show_sensitivity(sensitivity_id): | |||
sensitivity = get_sensitivity(sensitivity_id) | |||
return render_template('sensitivity.html', sensitivity=sensitivity) | |||
# route for editing a single sensitivity based on the ID in the database | |||
@sensitivity.route('/sensitivities/<int:sensitivity_id>/edit', methods=('GET', 'POST')) | |||
@login_required | |||
def edit_sensitivity(sensitivity_id): | |||
sensitivity = get_sensitivity(sensitivity_id) | |||
if request.method == 'POST': | |||
name = request.form['name'] | |||
description = request.form['description'] | |||
if not name: | |||
flash('Name is required!') | |||
else: | |||
sensitivity = Sensitivity.query.get(sensitivity_id) | |||
sensitivity.name = name | |||
sensitivity.description = description | |||
db.session.commit() | |||
return redirect(url_for('sensitivity.get_sensitivities')) | |||
return render_template('edit.html', sensitivity=sensitivity) | |||
# route for function to delete a single sensitivity from the edit page | |||
@sensitivity.route('/sensitivities/<int:sensitivity_id>/delete', methods=('POST',)) | |||
@login_required | |||
def delete_sensitivity(sensitivity_id): | |||
sensitivity = get_sensitivity(sensitivity_id) | |||
deletion = Sensitivity.query.get(sensitivity_id) | |||
db.session.delete(deletion) | |||
db.session.commit() | |||
flash('Successfully deleted!') | |||
return redirect(url_for('sensitivity.get_sensitivities')) |
@@ -39,11 +39,6 @@ | |||
</button> | |||
<div class="collapse navbar-collapse" id="navbarSupportedContent"> | |||
<ul class="navbar-nav"> | |||
<li class="nav-item"> | |||
<a href="{{ url_for('book.get_books') }}" class="nav-link"> | |||
Books | |||
</a> | |||
</li> | |||
<li class="nav-item"> | |||
<a href="{{ url_for('tool.get_tools') }}" class="nav-link"> | |||
Tools | |||
@@ -55,15 +50,35 @@ | |||
</a> | |||
</li> | |||
<li class="nav-item"> | |||
<a href="{{ url_for('main.index') }}" class="nav-link"> | |||
<a href="{{ url_for('sensitivity.get_sensitivities') }}" class="nav-link"> | |||
Sensitivities | |||
</a> | |||
</li> | |||
<li class="nav-item"> | |||
<a href="{{ url_for('main.index') }}" class="nav-link"> | |||
<a href="{{ url_for('typology.get_typologies') }}" class="nav-link"> | |||
Typologies | |||
</a> | |||
</li> | |||
<li class="nav-item"> | |||
<a href="{{ url_for('workflow.get_workflows') }}" class="nav-link"> | |||
Workflows | |||
</a> | |||
</li> | |||
<li class="nav-item"> | |||
<a href="{{ url_for('publisher.get_publishers') }}" class="nav-link"> | |||
Publishers | |||
</a> | |||
</li> | |||
<li class="nav-item"> | |||
<a href="{{ url_for('book.get_books') }}" class="nav-link"> | |||
Books | |||
</a> | |||
</li> | |||
<li class="nav-item"> | |||
<a href="{{ url_for('reference.get_references') }}" class="nav-link"> | |||
References | |||
</a> | |||
</li> | |||
{% if current_user.is_authenticated %} | |||
<li class="nav-item"> | |||
<a href="{{ url_for('create.create_resource') }}" class="nav-link"> |
@@ -38,7 +38,7 @@ | |||
Project page: | |||
</th> | |||
<td> | |||
{{ tool['project_url'] }} | |||
{{ tool['projectUrl'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
@@ -46,23 +46,15 @@ | |||
Code repository: | |||
</th> | |||
<td> | |||
{{ tool['repository_url'] }} | |||
{{ tool['repositoryUrl'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
<th> | |||
Stand-alone or platform?: | |||
Expertise required to use: | |||
</th> | |||
<td> | |||
{{ tool['platform_status'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
<th> | |||
Expertise required: | |||
</th> | |||
<td> | |||
{{ tool['expertise'] }} | |||
{{ tool['expertiseToUse'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
@@ -70,47 +62,39 @@ | |||
Expertise required to self-host: | |||
</th> | |||
<td> | |||
{{ tool['self_host_expertise'] }} | |||
{{ tool['expertiseToHost'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
<th> | |||
Import / ingest: | |||
</th> | |||
<td> | |||
{{ tool['ingest'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
<th> | |||
Output formats: | |||
Technical dependencies: | |||
</th> | |||
<td> | |||
{{ tool['output'] }} | |||
{{ tool['dependencies'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
<th> | |||
SAAS?: | |||
Import / ingest formats: | |||
</th> | |||
<td> | |||
{{ tool['saas'] }} | |||
{{ tool['ingestFormats'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
<th> | |||
Community-hosted examples: | |||
Output formats: | |||
</th> | |||
<td> | |||
{{ tool['outputFormats'] }} | |||
</td> | |||
</tr> | |||
<tr> | |||
<th> | |||
Technical dependencies: | |||
Platform status: | |||
</th> | |||
<td> | |||
{{ tool['dependencies'] }} | |||
{{ tool['status'] }} | |||
</td> | |||
</tr> | |||
</tbody> |
@@ -0,0 +1,67 @@ | |||
# @name: typology.py | |||
# @version: 0.1 | |||
# @creation_date: 2022-02-08 | |||
# @license: The MIT License <https://opensource.org/licenses/MIT> | |||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | |||
# @purpose: typology route for typology-related functions and pages | |||
# @acknowledgements: | |||
# https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3 | |||
from flask import Blueprint, render_template, request, flash, redirect, url_for | |||
from flask_login import login_required, current_user | |||
from .models import Typology | |||
from werkzeug.exceptions import abort | |||
from . import db | |||
typology = Blueprint('typology', __name__) | |||
# function to retrieve data about a single typology from the database | |||
def get_typology(typology_id): | |||
typology = Typology.query.filter_by(id=typology_id).first() | |||
if typology is None: | |||
abort(404) | |||
return typology | |||
# route for displaying all typologies in database | |||
@typology.route('/typologies') | |||
def get_typologies(): | |||
typologies = Typology.query | |||
return render_template('typologies.html', typologies=typologies) | |||
# route for displaying a single typology based on the ID in the database | |||
@typology.route('/typologies/<int:typology_id>') | |||
def show_typology(typology_id): | |||
typology = get_typology(typology_id) | |||
return render_template('typology.html', typology=typology) | |||
# route for editing a single typology based on the ID in the database | |||
@typology.route('/typologies/<int:typology_id>/edit', methods=('GET', 'POST')) | |||
@login_required | |||
def edit_typology(typology_id): | |||
typology = get_typology(typology_id) | |||
if request.method == 'POST': | |||
name = request.form['name'] | |||
description = request.form['description'] | |||
if not name: | |||
flash('Name is required!') | |||
else: | |||
typology = Typology.query.get(typology_id) | |||
typology.name = name | |||
typology.description = description | |||
db.session.commit() | |||
return redirect(url_for('typology.get_typologies')) | |||
return render_template('edit.html', typology=typology) | |||
# route for function to delete a single typology from the edit page | |||
@typology.route('/typologies/<int:typology_id>/delete', methods=('POST',)) | |||
@login_required | |||
def delete_typology(typology_id): | |||
typology = get_typology(typology_id) | |||
deletion = Typology.query.get(typology_id) | |||
db.session.delete(deletion) | |||
db.session.commit() | |||
flash('Successfully deleted!') | |||
return redirect(url_for('typology.get_typologies')) |
@@ -0,0 +1,67 @@ | |||
# @name: workflow.py | |||
# @version: 0.1 | |||
# @creation_date: 2022-02-08 | |||
# @license: The MIT License <https://opensource.org/licenses/MIT> | |||
# @author: Simon Bowie <ad7588@coventry.ac.uk> | |||
# @purpose: workflow route for workflow-related functions and pages | |||
# @acknowledgements: | |||
# https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3 | |||
from flask import Blueprint, render_template, request, flash, redirect, url_for | |||
from flask_login import login_required, current_user | |||
from .models import Workflow | |||
from werkzeug.exceptions import abort | |||
from . import db | |||
workflow = Blueprint('workflow', __name__) | |||
# function to retrieve data about a single workflow from the database | |||
def get_workflow(workflow_id): | |||
workflow = Workflow.query.filter_by(id=workflow_id).first() | |||
if workflow is None: | |||
abort(404) | |||
return workflow | |||
# route for displaying all workflows in database | |||
@workflow.route('/workflows') | |||
def get_workflows(): | |||
workflows = Workflow.query | |||
return render_template('workflows.html', workflows=workflows) | |||
# route for displaying a single workflow based on the ID in the database | |||
@workflow.route('/workflows/<int:workflow_id>') | |||
def show_workflow(workflow_id): | |||
workflow = get_workflow(workflow_id) | |||
return render_template('workflow.html', workflow=workflow) | |||
# route for editing a single workflow based on the ID in the database | |||
@workflow.route('/workflows/<int:workflow_id>/edit', methods=('GET', 'POST')) | |||
@login_required | |||
def edit_workflow(workflow_id): | |||
workflow = get_workflow(workflow_id) | |||
if request.method == 'POST': | |||
name = request.form['name'] | |||
description = request.form['description'] | |||
if not name: | |||
flash('Name is required!') | |||
else: | |||
workflow = Workflow.query.get(workflow_id) | |||
workflow.name = name | |||
workflow.description = description | |||
db.session.commit() | |||
return redirect(url_for('workflow.get_workflows')) | |||
return render_template('edit.html', workflow=workflow) | |||
# route for function to delete a single workflow from the edit page | |||
@workflow.route('/workflows/<int:workflow_id>/delete', methods=('POST',)) | |||
@login_required | |||
def delete_workflow(workflow_id): | |||
workflow = get_workflow(workflow_id) | |||
deletion = Workflow.query.get(workflow_id) | |||
db.session.delete(deletion) | |||
db.session.commit() | |||
flash('Successfully deleted!') | |||
return redirect(url_for('workflow.get_workflows')) |