Skip to content
Snippets Groups Projects
Commit ae08115b authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

web

parent 40279662
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ def json_endpoint(f): ...@@ -36,7 +36,7 @@ def json_endpoint(f):
def base_page(content, head=html.bucket(), limited_size=True, sticky_head=True, empty=False, js_reload=None): def base_page(content, head=html.bucket(), limited_size=True, sticky_head=True, empty=False, js_reload=None):
b = html.Builder(html.html().set_indent(0)) b = html.Builder(html.html().set_indent(0))
with b.head(): with b.head():
b.title()("KSP hra") b.title()("Autotestovač úloh")
b.meta(name="viewport", content="width=device-width, initial-scale=1.0") b.meta(name="viewport", content="width=device-width, initial-scale=1.0")
b.link(rel="stylesheet", href=app.url_for('static', filename='bootstrap.min.css'), type='text/css', media="all") b.link(rel="stylesheet", href=app.url_for('static', filename='bootstrap.min.css'), type='text/css', media="all")
b.link(rel="stylesheet", href=app.url_for('static', filename='ksp-mhd.css'), type='text/css', media="all") b.link(rel="stylesheet", href=app.url_for('static', filename='ksp-mhd.css'), type='text/css', media="all")
...@@ -78,14 +78,48 @@ def base_page(content, head=html.bucket(), limited_size=True, sticky_head=True, ...@@ -78,14 +78,48 @@ def base_page(content, head=html.bucket(), limited_size=True, sticky_head=True,
def load_task_commits():
with open(os.path.join(config.DATA_DIR, "task_commits")) as f:
return json.load(f)
@app.route("/", methods=['GET', 'POST'])
@app.route("/")
def web_index(): def web_index():
b = html.Builder() b = html.Builder()
task_commits = load_task_commits()
with b.table(_class="data"):
with b.thead.tr:
b.td("Úloha")
b.td("Větev")
b.td("Commit")
for branch, path in config.TASKS:
commit = task_commits.get(task)
with b.tr:
b.td(path)
b.td(branch)
b.td(commit)
return base_page(b.root).print_file()
@app.route("/tests/")
def web_tests():
b = html.Builder()
with b.table(_class="data"):
with b.thead.tr:
b.td("Úloha")
b.td("Commit")
for branch, path in []:
with b.tr:
b.td(path)
b.td(branch)
return base_page(b.root).print_file() return base_page(b.root).print_file()
@app.route("/show_test/<string:task>/<string:commit>/", methods=['GET', 'POST']) @app.route("/tests/<string:task>/<string:commit>/")
def show_test(task, commit): def show_test(task, commit):
if not commit.isalnum(): if not commit.isalnum():
raise werkzeug.exceptions.Forbidden() raise werkzeug.exceptions.Forbidden()
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment