Browse Source

adding flexible title from settings file

main
crunk 6 months ago
parent
commit
0c21688c00
  1. 1
      library/app.py
  2. 5
      library/page.py
  3. 4
      library/templates/base.html
  4. 5
      library/templates/upload.html

1
library/app.py

@ -22,6 +22,7 @@ def create_app():
APP.config["UPLOAD_FOLDER"] = "tmpupload"
APP.config["LIBRARY_FILENAME"] = settings["libaryfilename"]
APP.config["IMAGE_FOLDER"] = "static/images"
APP.config["TITLE"] = settings["title"]
scheduler = flask_apscheduler.APScheduler()
scheduler.api_enabled = False
scheduler.init_app(APP)

5
library/page.py

@ -37,6 +37,7 @@ def index():
publicatons = csvparser.getpublications()
template = render_template(
"index.html",
title=APP.config["TITLE"],
publications=publicatons,
pubtypes=pubtypes,
pubyears=pubyears,
@ -49,7 +50,7 @@ def index():
def upload():
"""Upload route, a page to upload a book to the csv"""
uploadform = PublicationForm()
csvparser = CsvParser(APP.config["libaryfilename"], APP.config[""])
csvparser = CsvParser(APP.config["LIBRARY_FILENAME"], APP.config["IMAGE_FOLDER"])
if request.method == "POST":
if uploadform.validate_on_submit() and checksecret(
uploadform.secret.data
@ -59,7 +60,7 @@ def upload():
return redirect(str(id), code=303)
else:
return render_template("upload.html", uploadform=uploadform)
return render_template("upload.html", uploadform=uploadform)
return render_template("upload.html", title=APP.config["TITLE"], uploadform=uploadform)
@APP.route("/<publicationID>", methods=["GET", "POST"])

4
library/templates/base.html

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Library collection</title>
<title>{{title}}</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css')}}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/dropdown.css')}}">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bookmark.css')}}">
@ -16,7 +16,7 @@
</head>
<body>
<div id="cloud"></div>
<a href="/"><h1 id="library">LIBRARY COLLECTION</h1></a>
<a href="/"><h1 id="library">{{title}}</h1></a>
{% block main %}
{% endblock main %}
</body>

5
library/templates/upload.html

@ -72,11 +72,6 @@
{{ uploadform.license }}
</fieldset>
<fieldset class="uploadform-field">
{{ uploadform.licenseshort.label }}
{{ uploadform.licenseshort }}
</fieldset>
<fieldset class="uploadform-field">
{{ uploadform.highlights.label }}
{{ uploadform.highlights }}

Loading…
Cancel
Save