Add buttons to nav bar

This commit is contained in:
Sauer 2019-04-13 17:58:44 +02:00
parent a13586a8f0
commit 338fa78a20
2 changed files with 15 additions and 8 deletions

View File

@ -102,22 +102,27 @@ def solution():
def result(user_id):
return render_template('result.html', title='Sortierhut', hausname='Knuth', haustext='Mitglieder dieses Hauses mögen LaTeX-Anzüge und Eisbären.', id=user_id)
def convert_csv_to_list_of_lists():
def convert_csv_to_list_of_lists(csv_file):
list_of_lists = list()
if not os.path.exists(datafile):
open(datafile, 'a').close()
if not os.path.exists(csv_file):
open(csv_file, 'a').close()
with open(datafile, 'r', newline='') as f:
with open(csv_file, 'r', newline='') as f:
reader = csv.reader(f)
for line in reader:
list_of_lists.append(line)
return list_of_lists
@app.route('/admint_rocks_20190417')
def admin():
file_data = convert_csv_to_list_of_lists()
return render_template('admin.html', title='Sortierhut', text='Hallo, Admin Fooboar', file_data=file_data)
@app.route('/admint_form')
def admin_form():
file_data = convert_csv_to_list_of_lists(datafile)
return render_template('admin_form.html', title='Sortierhut', text='Hallo, Admin Fooboar', file_data=file_data)
@app.route('/admint_solution')
def admin_solution():
file_data = convert_csv_to_list_of_lists(solutionfile)
return render_template('admin_solution.html', title='Sortierhut', file_data=file_data)
@app.route('/answers', methods=['GET', 'POST'])
def answers():

View File

@ -16,6 +16,8 @@
<li {% if request.path == url_for('index') %} class="active" {% endif %}><a href="{{ url_for('index') }}">Home</a></li>
<li {% if request.path == url_for('questions') %} class="active" {% endif %}><a href="{{ url_for('questions') }}">Formular</a></li>
<li {% if request.path == url_for('answers') %} class="active" {% endif %}><a href="{{ url_for('answers') }}">Meine Antworten</a></li>
<li {% if request.path == url_for('solution') %} class="active" {% endif %}><a href="{{ url_for('solution') }}">Lösung einreichen</a></li>
<li {% if request.path == url_for('patrons') %} class="active" {% endif %}><a href="{{ url_for('patrons') }}">Häuser</a></li>
</ul>
</nav>
{% block content %}