Browse Source

adding flexible title from settings file

main
crunk 10 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["UPLOAD_FOLDER"] = "tmpupload"
APP.config["LIBRARY_FILENAME"] = settings["libaryfilename"] APP.config["LIBRARY_FILENAME"] = settings["libaryfilename"]
APP.config["IMAGE_FOLDER"] = "static/images" APP.config["IMAGE_FOLDER"] = "static/images"
APP.config["TITLE"] = settings["title"]
scheduler = flask_apscheduler.APScheduler() scheduler = flask_apscheduler.APScheduler()
scheduler.api_enabled = False scheduler.api_enabled = False
scheduler.init_app(APP) scheduler.init_app(APP)

5
library/page.py

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

4
library/templates/base.html

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

5
library/templates/upload.html

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

Loading…
Cancel
Save