Commit 5ec5c2e2 authored by Andreas Valder's avatar Andreas Valder
Browse files

Merge branch 'magnus' into 'master'

Fix error in courses.html

See merge request !28
parents bf628dd2 7d19efc2
...@@ -31,51 +31,54 @@ ...@@ -31,51 +31,54 @@
</div> </div>
</div> </div>
<div class="visible-xs" id="xs-check"></div> {% if courses %}
{% if groupedby == 'semester' %} <div class="visible-xs" id="xs-check"></div>
{% set grouped_courses = courses|groupby(groupedby)|reverse|list %} {% if groupedby == 'semester' and courses|groupby(groupedby)|length > 1%}
<script> {% set grouped_courses = courses|groupby(groupedby)|reverse|list %}
$(function () { <script>
if($("#xs-check").is(":visible")) { $(function () {
/* Only expand current semester */ if($("#xs-check").is(":visible")) {
$(".collapse[id!='{{grouped_courses[1].grouper|tagid}}']").removeClass('in'); /* Only expand current semester */
} $(".collapse[id!='{{grouped_courses[1].grouper|tagid}}']").removeClass('in');
}); }
</script> });
{% else %} </script>
{% set grouped_courses = courses|groupby(groupedby)|list %} {% else %}
<script> {% set grouped_courses = courses|groupby(groupedby)|list %}
$(function () { <script>
if($("#xs-check").is(":visible")) { $(function () {
$(".collapse[id!='{{grouped_courses[0].grouper|tagid}}']").removeClass('in'); if($("#xs-check").is(":visible")) {
} /* Only expand first group */
}); $(".collapse[id!='{{grouped_courses[0].grouper|tagid}}']").removeClass('in');
</script> }
{% endif %} });
</script>
{% endif %}
{% for g in grouped_courses %} {% for g in grouped_courses %}
<div class="row panel-group" id="accordion-{{ g.grouper|tagid }}"> <div class="row panel-group" id="accordion-{{ g.grouper|tagid }}">
<div class="col-xs-12"><div class="panel panel-default"> <div class="col-xs-12"><div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion-{{ g.grouper|tagid }}" href="#{{g.grouper|tagid}}" style="color: #222;"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion-{{ g.grouper|tagid }}" href="#{{g.grouper|tagid}}" style="color: #222;">
{% if groupedby == 'semester' %} {% if groupedby == 'semester' %}
<h1 class="panel-title">{{g.grouper|semester(long=True)}} ({{g.list|length}} Veranstaltungen) <h1 class="panel-title">{{g.grouper|semester(long=True)}} ({{g.list|length}} Veranstaltungen)
</h1> </h1>
{% else %} {% else %}
<h1 class="panel-title">{{g.grouper}}</h1> <h1 class="panel-title">{{g.grouper}}</h1>
{% endif %} {% endif %}
</a> </a>
</div> </div>
<ul class="{% if not ismod() %}courses-list {% endif %}list-group panel-collapse collapse in" id="{{g.grouper|tagid}}"> <ul class="{% if not ismod() %}courses-list {% endif %}list-group panel-collapse collapse in" id="{{g.grouper|tagid}}">
{% for i in g.list %} {% for i in g.list %}
{% if groupedby == 'semester' %} {% if groupedby == 'semester' %}
{{ course_list_item(i) }} {{ course_list_item(i) }}
{% else %} {% else %}
{{ course_list_item(i, true) }} {{ course_list_item(i, true) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div></div> </div></div>
</div> </div>
{% endfor %} {% endfor %}
{% endif %}
{% endblock %} {% endblock %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment