| @@ -18,7 +18,6 @@ Run `./database_functions -h` to see the instructions for this script. | |||
| The following is no longer required in Flask-SQLAlchemy 3. See https://stackoverflow.com/questions/73968584/flask-sqlalchemy-db-create-all-got-an-unexpected-keyword-argument-app | |||
| For creating database and user in production: | |||
| `docker-compose exec -it db mysql -u root -p` | |||
| @@ -66,10 +66,6 @@ def create_app(): | |||
| from .practice import practice as practice_blueprint | |||
| app.register_blueprint(practice_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) | |||
| @@ -82,28 +82,6 @@ def create_resource(): | |||
| db.session.add(new_practice) | |||
| db.session.commit() | |||
| elif request.form.get('resource_type') == 'publisher': | |||
| type = 'publisher' | |||
| name = request.form.get('publisher_name') | |||
| description = request.form.get('description') | |||
| publisherUrl = request.form.get('publisherUrl') | |||
| if not name: | |||
| flash('Name is required!') | |||
| else: | |||
| publisher = Publisher.query.filter_by(name=name).first() # if this returns a publisher, then the name already exists in database | |||
| if publisher: # if a publisher is found, we want to redirect back to create page | |||
| flash('Publisher with same name already exists') | |||
| return redirect(url_for('create.create_resource',_external=True,_scheme=os.environ.get('SSL_SCHEME'))) | |||
| # create a new publisher with the form data | |||
| new_publisher = Resource(type=type, name=name, description=description, publisherUrl=publisherUrl) | |||
| # add the new publisher to the database | |||
| db.session.add(new_publisher) | |||
| db.session.commit() | |||
| elif request.form.get('resource_type') == 'book': | |||
| type = 'book' | |||
| name = request.form.get('book_name') | |||
| @@ -1,56 +0,0 @@ | |||
| # @name: publisher.py | |||
| # @creation_date: 2022-04-05 | |||
| # @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 Resource | |||
| from .resources import * | |||
| from .relationships import * | |||
| from werkzeug.exceptions import abort | |||
| from . import db | |||
| import os | |||
| publisher = Blueprint('publisher', __name__) | |||
| # route for displaying all publishers in database | |||
| @publisher.route('/publishers') | |||
| def get_publishers(): | |||
| publishers = Resource.query.filter_by(type='publisher') | |||
| return render_template('resources.html', resources=publishers, type='publisher') | |||
| # 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_resource(publisher_id) | |||
| links = get_relationships(publisher_id) | |||
| return render_template('resource.html', resource=publisher, links=links) | |||
| # 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_resource(publisher_id) | |||
| if request.method == 'POST': | |||
| if not request.form['name']: | |||
| flash('Name is required!') | |||
| else: | |||
| publisher = Resource.query.get(publisher_id) | |||
| publisher.name = request.form['name'] | |||
| publisher.description = request.form['description'] | |||
| db.session.commit() | |||
| return redirect(url_for('publisher.get_publishers',_external=True,_scheme=os.environ.get('SSL_SCHEME'))) | |||
| return render_template('edit.html', resource=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): | |||
| delete_resource(publisher_id) | |||
| return redirect(url_for('publisher.get_publishers',_external=True,_scheme=os.environ.get('SSL_SCHEME'))) | |||
| @@ -19,7 +19,7 @@ | |||
| --bs-success-rgb: 25,135,84; | |||
| --bs-tool-rgb: 13,202,240; | |||
| --bs-practice-rgb: 255,193,7; | |||
| --bs-publisher-rgb: 150, 224, 167; | |||
| --bs-book-rgb: 150, 224, 167; | |||
| --bs-danger-rgb: 220,53,69; | |||
| --bs-light-rgb: 248,249,250; | |||
| --bs-dark-rgb: 33,37,41; | |||
| @@ -1059,9 +1059,9 @@ main > .container { | |||
| background-color: rgba(var(--bs-practice-rgb),var(--bs-bg-opacity))!important; | |||
| } | |||
| .bg-publisher { | |||
| .bg-book { | |||
| --bs-bg-opacity: 1; | |||
| background-color: rgba(var(--bs-publisher-rgb),var(--bs-bg-opacity))!important; | |||
| background-color: rgba(var(--bs-book-rgb),var(--bs-bg-opacity))!important; | |||
| } | |||
| .drop { | |||
| @@ -59,11 +59,6 @@ | |||
| Books | |||
| </a> | |||
| </li> | |||
| <li class="nav-item"> | |||
| <a href="{{ url_for('publisher.get_publishers') }}" class="nav-link"> | |||
| Publishers | |||
| </a> | |||
| </li> | |||
| {% if current_user.is_authenticated %} | |||
| <li class="nav-item"> | |||
| <a href="{{ url_for('create.create_resource') }}" class="nav-link"> | |||
| @@ -9,7 +9,6 @@ | |||
| <option selected="selected">Please choose</option> | |||
| <option value="tool">Tool</option> | |||
| <option value="practice">Practice</option> | |||
| <option value="publisher">Publisher</option> | |||
| <option value="book">Book</option> | |||
| </select> | |||
| </div> | |||
| @@ -108,22 +107,6 @@ | |||
| <textarea class="form-control" rows="4" type="text" name="description" placeholder="Practice description" autofocus=""></textarea> | |||
| </div> | |||
| </div> | |||
| <div id="resource_type_publisher" class="resource_type_input" style="display: none;"> | |||
| <div class="mb-3 mt-3"> | |||
| <label for="publisher_name">Publisher name</label> | |||
| <input class="form-control" type="text" name="publisher_name" placeholder="Publisher name" autofocus=""> | |||
| </div> | |||
| <div class="mb-3 mt-3"> | |||
| <label for="description">Publisher description</label> | |||
| <textarea class="form-control" rows="4" type="text" name="description" placeholder="Publisher description" autofocus=""></textarea> | |||
| </div> | |||
| <div class="mb-3 mt-3"> | |||
| <label for="publisherUrl">Publisher URL</label> | |||
| <input class="form-control" type="text" name="publisherUrl" placeholder="Publisher URL" autofocus=""> | |||
| </div> | |||
| </div> | |||
| <div id="resource_type_book" class="resource_type_input" style="display: none;"> | |||
| <div class="mb-3 mt-3"> | |||
| <label for="book_name">Book name</label> | |||
| @@ -173,11 +173,4 @@ | |||
| onclick="return confirm('Are you sure you want to delete this practice?')"> | |||
| </form> | |||
| {% endif %} | |||
| {% if resource['type'] == 'publisher' %} | |||
| <form action="{{ url_for('publisher.delete_publisher', publisher_id=resource['id']) }}" method="POST"> | |||
| <input type="submit" value="Delete" | |||
| class="btn btn-danger btn-sm" | |||
| onclick="return confirm('Are you sure you want to delete this publisher?')"> | |||
| </form> | |||
| {% endif %} | |||
| {% endblock %} | |||
| @@ -6,7 +6,7 @@ | |||
| <hr> | |||
| <p> | |||
| Browse from this selection of random tools, search or explore books, tools, practices, and publishers. | |||
| Browse from this selection of random tools, search or explore tools, practices, and experimental books. | |||
| </p> | |||
| <div class="row"> | |||
| @@ -29,10 +29,6 @@ | |||
| <a href="{{ url_for('practice.show_practice', practice_id=resource['id']) }}"> | |||
| <h3 class="card-title text-center text-dark">{{ resource['name'] }}</h3> | |||
| </a> | |||
| {% elif resource['type'] == 'publisher' %} | |||
| <a href="{{ url_for('publisher.show_publisher', publisher_id=resource['id']) }}"> | |||
| <h3 class="card-title text-center text-dark">{{ resource['name'] }}</h3> | |||
| </a> | |||
| {% endif %} | |||
| <p class="card-text"> | |||
| {{ resource['description']|truncate(100) }} | |||
| @@ -46,10 +42,6 @@ | |||
| <a href="{{ url_for('practice.edit_practice', practice_id=resource['id']) }}"> | |||
| <span class="badge bg-dark">Edit</span> | |||
| </a> | |||
| {% elif resource['type'] == 'publisher' %} | |||
| <a href="{{ url_for('publisher.edit_publisher', publisher_id=resource['id']) }}"> | |||
| <span class="badge bg-dark">Edit</span> | |||
| </a> | |||
| {% endif %} | |||
| {% endif %} | |||
| </div> | |||
| @@ -1,6 +1,6 @@ | |||
| # ExPub Compendium | |||
| The Experimental Publishing Compendium is for authors, designers, publishers, institutions and technologist who challenge, push and redefine the shape, form and rationale of scholarly works. The compendium offers a catalogues of tools, practices, publishers, and books to inspire experimental scholarly works. | |||
| The Experimental Publishing Compendium is for authors, designers, publishers, institutions and technologist who challenge, push and redefine the shape, form and rationale of scholarly works. The compendium offers a catalogues of tools, practices, and books to inspire experimental scholarly works. | |||
| ## How to use the compendium | |||
| @@ -8,7 +8,7 @@ The compendium catalogues potential ingredients for the making of experimental p | |||
| - Under [Tools](/tools) you’ll find mostly software that supports experimental publication from collective writing to the annotation and remix of published texts. | |||
| - [Practices](/practices) provide inspiration for experimental book making. | |||
| - [Books](/books) and [publishers](/publishers) provides examples of experimental books and those who publish them. | |||
| - [Books](/books) provides examples of experimental books and those who publish them. | |||
| Each item is cross linked so that a practice will take you to relevant tools or examples and vice versa. | |||