Commit 4a3fdf61 authored by Julian Rother's avatar Julian Rother
Browse files

Restructured featured template

parent 68d58456
{% from 'macros.html' import preview, course_list_item %}
{% from 'macros.html' import preview, featured_content %}
{% extends "base.html" %}
{% set page_border = 0 %}
{% if ismod() %}
......@@ -98,32 +98,7 @@
{% endif %}
</h1>
</div>
{% if item.type == 'image' %}
<!-- Putting image tag here makes it borderless. This should be replaced by a bootstrap-compatible solution. -->
<img src="{{item.param}}" style="width: 100%;"/>
{% if ismod() %}
<p>{{moderator_editor(('featured',item.id,'param'), item.param)}}</p>
{% endif %}
{% endif %}
{% if item.text or ismod() %}
<div class="panel-body">
{{ moderator_editor(('featured',item.id,'text'), item.text) }}
</div>
{% endif %}
{% if item.type == 'courses' %}
<ul class="courses-list list-group">
{% for i in item.courses %}
{{ course_list_item(i) }}
{% endfor %}
</ul>
<div class="panel-footer">
{% if ismod() %}
<p>Kategorie: {{ moderator_editor(('featured',item.id,'param'), item.param) }}</p>
<p>Parameter: {{ moderator_editor(('featured',item.id,'param2'), item.param2) }}</p>
{% endif %}
Die vollständige Liste findest du <a href="{{ url_for('courses') }}">hier</a>.
</div>
{% endif %}
{{ featured_content(item) }}
</div>
{% endfor %}
</div>
......
......@@ -306,3 +306,46 @@ $('#embedcodebtn').popover(
});
</script>
{% endmacro %}
{% macro featured_content(item) %} {# This macro is used in a panel div after the panel header #}
{% if item.type == 'image' %}
<!-- Putting image tag here makes it borderless. This should be replaced by a bootstrap-compatible solution. -->
<img src="{{item.param}}" style="width: 100%;"/>
{% if ismod() %}
<p>{{moderator_editor(('featured',item.id,'param'), item.param)}}</p>
{% endif %}
{% if item.text or ismod() %}
<div class="panel-body">{{ moderator_editor(('featured',item.id,'text'), item.text) }}</div>
{% endif %}
{% elif item.type == 'courses' %}
{% if item.text or ismod() %}
<div class="panel-body">{{ moderator_editor(('featured',item.id,'text'), item.text) }}</div>
{% endif %}
<ul class="courses-list list-group">
{% for i in item.courses %}
{{ course_list_item(i) }}
{% endfor %}
</ul>
<div class="panel-footer">
{% if ismod() %}
<ul class="list-inline">
<li><div class="dropdown">
{% set params = {'semester': 'Semester', 'title': 'Veranstaltung', 'organizer': 'Dozent', 'subject': 'Kategorie'} %}
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">{{params[item.param]}}: <span class="caret"></span></button>
<ul class="dropdown-menu">
{% for key, name in params.items() %}
<li><a href="{{url_for('edit', **{'featured.'+item.id|string+'.param': key, 'ref': request.url})}}">{{name}}</a></li>
{% endfor %}
</ul>
</div></li>
<li>{{ moderator_editor(('featured',item.id,'param2'), item.param2) }}</li>
</ul>
{% endif %}
Die vollständige Liste findest du <a href="{{ url_for('courses') }}">hier</a>.
</div>
{% else %}
{% if item.text or ismod() %}
<div class="panel-body">{{ moderator_editor(('featured',item.id,'text'), item.text) }}</div>
{% endif %}
{% endif %}
{% endmacro %}
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