diff options
author | Nico Geyso <nico.geyso@fu-berlin.de> | 2014-12-09 23:59:54 +0100 |
---|---|---|
committer | Nico Geyso <nico.geyso@fu-berlin.de> | 2014-12-09 23:59:54 +0100 |
commit | 274d1790239f52440137cc922018a87af32a4ab7 (patch) | |
tree | 43149197b724f95af49c483194f2498b13f10ae2 /app/templates | |
parent | 79788b3590aba6384611a2c29012bbd821c290ee (diff) | |
download | klausuren-274d1790239f52440137cc922018a87af32a4ab7.tar.gz klausuren-274d1790239f52440137cc922018a87af32a4ab7.tar.bz2 klausuren-274d1790239f52440137cc922018a87af32a4ab7.zip |
Refactoring
Diffstat (limited to 'app/templates')
-rw-r--r-- | app/templates/403.html | 2 | ||||
-rw-r--r-- | app/templates/404.html | 16 | ||||
-rw-r--r-- | app/templates/_layout.html (renamed from app/templates/layout.html) | 19 | ||||
-rw-r--r-- | app/templates/courses.html (renamed from app/templates/module_list.html) | 6 | ||||
-rw-r--r-- | app/templates/exams.html | 29 | ||||
-rw-r--r-- | app/templates/index.html | 5 | ||||
-rw-r--r-- | app/templates/module_show.html | 30 | ||||
-rw-r--r-- | app/templates/upload.html | 32 |
8 files changed, 76 insertions, 63 deletions
diff --git a/app/templates/403.html b/app/templates/403.html index 5f2317f..1569421 100644 --- a/app/templates/403.html +++ b/app/templates/403.html @@ -1,4 +1,4 @@ -{% extends "layout.html" %} +{% extends "_layout.html" %} {% block body %} <h2>Fehler 403 - Zugang verboten</h2> diff --git a/app/templates/404.html b/app/templates/404.html new file mode 100644 index 0000000..a1526ff --- /dev/null +++ b/app/templates/404.html @@ -0,0 +1,16 @@ +{% extends "_layout.html" %} +{% block body %} +<h2>Fehler 403 - Zugang verboten</h2> + +<dl> + <dt>Code</dt> + <dd>{{error.code}}</dd> + + <dt>Beschreibung</dt> + <dd>{{error.description}}</dd> +</dl> + +<p> + <a href="{{url_for('main.index')}}">zur Startseite</a> +</p> +{% endblock %} diff --git a/app/templates/layout.html b/app/templates/_layout.html index 14ec7c5..5eaef3f 100644 --- a/app/templates/layout.html +++ b/app/templates/_layout.html @@ -2,8 +2,7 @@ <html> <head> <meta charset="utf-8" /> - <link rel="stylesheet" type="text/css" media="all" href="{{url_for('static', - filename='style_v3.css')}}" /> + <link rel="stylesheet" type="text/css" media="all" href="{{url_for('static', filename='style.css')}}" /> <script type="text/javascript" src="{{url_for('static',filename='jquery-1.8.0.min.js')}}"></script> <title>Fit</title> </head> @@ -17,21 +16,21 @@ <div id="sub-header"> {% if study %} <p> - {% if not request.base_url.endswith(url_for('.upload', study=study, module = module))%} - {% if not request.base_url.endswith(url_for('errorhandler')) %} - <a href="{{url_for('.upload', study=study, module=module)}}">neue Klausur hochladen</a> + {% if not request.base_url.endswith(url_for('.upload', study=study, course= course))%} + {% if not request.base_url.endswith(url_for('forbidden')) %} + <a href="{{url_for('.upload', study=study, course=course)}}">neue Klausur hochladen</a> {% endif %} {% else %} - <a href="{{url_for('.study_index', study=study, module=module)}}">zurück</a> + <a href="{{url_for('.courses_show', study=study, course=course)}}">zurück</a> {% endif %} </p> - <h2><a href="{{url_for('.study_index', study=study)}}">{{study.capitalize()}}</a></h2> + <h2><a href="{{url_for('.courses_show', study=study)}}">{{study.capitalize()}}</a></h2> {% endif %} <ul class="flashes"> - {% with messages = get_flashed_messages() %} - {% for message in messages %} - <li>{{ message }}</li> + {% with messages = get_flashed_messages(with_categories=true) %} + {% for category, message in messages %} + <li class="{{ category }}">{{ message }}</li> {% endfor %} {% endwith %} </ul> diff --git a/app/templates/module_list.html b/app/templates/courses.html index 9469020..f315e11 100644 --- a/app/templates/module_list.html +++ b/app/templates/courses.html @@ -1,11 +1,11 @@ -{% extends "layout.html" %} +{% extends "_layout.html" %} {% block body %} <h3>Klausuren</h3> <ul> - {% for module in modules %} + {% for course in courses %} <li> - <a href="{{url_for('.study_index', study = study, module=module)}}">{{module}}</a> + <a href="{{url_for('.courses_show', study = study, course=course)}}">{{course}}</a> </li> {% else %} <li>Keine Klausuren bisher hochgeladen!</li> diff --git a/app/templates/exams.html b/app/templates/exams.html new file mode 100644 index 0000000..7e4af54 --- /dev/null +++ b/app/templates/exams.html @@ -0,0 +1,29 @@ +{% macro render_courses_list(courses, entries) %} +<ul> +{% for year,files in entries %} + <li> + {{year}} + <ul> + {% for name, path in files %} + <li> + <a href="{{url_for('static', filename = path)}}"> + {{name|truncate(40,True)}} + </a> + </li> + {% endfor %} + </ul> + </li> +{% else %} + <li>Keine Einträge bisher</li> +{% endfor %} +</ul> +{% endmacro %} + +{% extends "_layout.html" %} +{% block body %} + <div id="exams"> + <h3>{{courses}}</h3> + + {{ render_courses_list(courses, entries)}} + </div> +{% endblock %} diff --git a/app/templates/index.html b/app/templates/index.html index 9d090c3..8ab2c06 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,4 +1,4 @@ -{% extends "layout.html" %} +{% extends "_layout.html" %} {% block body %} <h2>Studiengänge</h2> @@ -6,7 +6,7 @@ <ul id="studies"> {% for name,img_path in studies|sort %} <li> - <a href="{{url_for('main.study_index', study=name)}}"> + <a href="{{url_for('main.courses_show', study=name)}}"> <img src="{{url_for('static',filename=img_path)}}" alt="{{name}}" /> {{name.capitalize()}} </a> @@ -16,5 +16,4 @@ {% endfor %} </ul> </div> - {% endblock %} diff --git a/app/templates/module_show.html b/app/templates/module_show.html deleted file mode 100644 index e31da24..0000000 --- a/app/templates/module_show.html +++ /dev/null @@ -1,30 +0,0 @@ -{% macro render_module_list(module, entries) %} -<ul id="module-list"> -{% for year,files in entries %} - <li> - {{year}} - <ul> - {% for name in files %} - <li> - <a href="{{url_for('.study_show', study = study, module=module, year=year, filename=name)}}"> - {{name|truncate(40,True)}} - </a> - </li> - {% endfor %} - </ul> - </li> -{% else %} - <li>Keine Einträge bisher</li> -{% endfor %} -</ul> -{% endmacro %} - -{% extends "layout.html" %} -{% block body %} - <div id="module-index"> - <h3>{{module}}</h3> - - {{ render_module_list(module, entries)}} - </div> - -{% endblock %} diff --git a/app/templates/upload.html b/app/templates/upload.html index 0e00354..e19a113 100644 --- a/app/templates/upload.html +++ b/app/templates/upload.html @@ -20,17 +20,17 @@ {{ render_fields(field, None) }} {% endmacro %} -{% extends "layout.html" %} +{% extends "_layout.html" %} {% block body %} <h3>neue Klausur hochladen</h3> <div id="upload"> <form method="POST" enctype="multipart/form-data" - action="{{url_for('.upload', study=study, module=module)}}"> + action="{{url_for('.upload', study=study, course=course)}}"> {{ form.csrf_token }} {{ render_field(form.exam) }} - {{ render_fields(form.module, form.module_new, placeholder='Modulname') }} + {{ render_fields(form.course, form.course_new, placeholder='Modulname') }} {{ render_field(form.year) }} <p> @@ -38,39 +38,39 @@ </p> </form> - <div id="module-index"></div> + <div id="exams"></div> </div> <script type="text/javascript"> $(document).ready(function() { - var elem = $('#module_new'); - var module = $('#module'); + var elem = $('#course_new'); + var course = $('#course'); - var update_modules = function() { - var text = module.find("option:selected").text(); - $.get('/{{study}}/modules/' + text, function(data) { - $('#module-index').replaceWith($(data).find('#module-index')); + var update_courses = function() { + var text = course.find("option:selected").text(); + $.get('/{{study}}/courses/' + text, function(data) { + $('#exams').replaceWith($(data).find('#exams')); }); }; - update_modules(); + update_courses(); - if(module.val() != 'new') + if(course.val() != 'new') elem.hide(); - module.change(function(){ + course.change(function(){ var current = $(this); var value = current.val(); var text = current.find("option:selected").text(); if(value == 'new') { - $('#module-index').fadeOut('fast', function() { elem.fadeIn(); }); + $('#exams').fadeOut('fast', function() { elem.fadeIn(); }); } else { elem.fadeOut('fast', function() { if(value != '') - update_modules(); + update_courses(); else - $('#module-index').fadeOut('fast'); + $('#exams').fadeOut('fast'); }); } |