Skip to content
Snippets Groups Projects
Commit 3c5e5322 authored by Dennis Baurichter's avatar Dennis Baurichter
Browse files

web: Add autocompletion for deposits

The list of valid autocompletions is deployment specific and may be
configured in 99-meta/config.py.

Fixes #67
parent 2530b6ff
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
## messages: list of named tuples of (cls, title, body)
<%!
import urllib.parse
import klausurarchiv.config
%>
<%inherit file="base-internal.mako" />
......@@ -94,7 +95,10 @@
<label class="control-label" for="deposit">Pfand:</label>
<input type="text" name="deposit"
value="${args["deposit"] if "deposit" in args else ""}"
class="form-control" />
class="form-control" list="deposits" />
<datalist id="deposits">
${"\n".join(["<option value=\"%s\" />"%(d) for d in klausurarchiv.config.deposits])}
</datalist>
<input type="submit" name="commit"
value="(W)eiter: Ausleihen"
class="btn btn-primary"
......
from klausurarchiv.config_base import *
## \brief See klausurarchiv/config.py#deposits
deposits=["Studierendenausweis", "Semesterticket", "Führerschein", "10 €"]
## \brief See klausurarchiv/config.py#printPDFFile
def printPDFFile(filename,count):
......@@ -18,3 +20,4 @@ def resolveStudentID(id):
# todo: implement this method, performing whatever magic needs to be
# performed in order to obtain a student's name from its ID (e.g. an LDAP
# search)
pass
......@@ -9,8 +9,9 @@
#
# By including this module, the deployment-specific code is loaded automatically
# and all of its symbols are included in this module's namespace.
# Additionally, for each configurable method a default is implemented here.
# These methods are:
# Additionally, for each configurable method or variable a default is
# implemented here. These methods and variables are:
# - klausurarchiv.config.deposits
# - klausurarchiv.config.printPDFFile
# - klausurarchiv.config.scanToPDF
# - klausurarchiv.config.resolveStudentID
......@@ -28,6 +29,13 @@ fn_config=os.path.join(
# define each default here and load configuration afterwards. This ensures that
# defaults are properly overwritten.
## \brief List of some valid deposits
#
# This list is used for autocompletion of the deposit in the web interface. The
# user can still enter other deposits, but this should be the regular / most
# common ones.
deposits=[]
## \brief Deployment-specific method issuing a printjob of a single exam file.
#
# This method is to be overwritten by the deployment-specific configuration
......@@ -78,4 +86,7 @@ if os.path.exists(fn_config):
setattr(ThisModule,k,getattr(m,k))
# special handling for non-method variable
if "deposits" in dir(m):
setattr(ThisModule,"deposits",getattr(m,"deposits"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment