Commit 396a4a56 authored by Andreas Valder's avatar Andreas Valder
Browse files

added embed page; fixes #25

parent 9bbd182e
...@@ -196,6 +196,7 @@ def faq(): ...@@ -196,6 +196,7 @@ def faq():
return render_template('faq.html') return render_template('faq.html')
@app.route('/play/<int:id>') @app.route('/play/<int:id>')
@app.route('/embed/<int:id>', endpoint='embed')
@handle_errors('course', 'Diese Vorlesung existiert nicht!', 404, IndexError) @handle_errors('course', 'Diese Vorlesung existiert nicht!', 404, IndexError)
def lecture(id): def lecture(id):
lectures = query('SELECT * FROM lectures WHERE id = ? AND (? OR visible)', id, ismod()) lectures = query('SELECT * FROM lectures WHERE id = ? AND (? OR visible)', id, ismod())
...@@ -206,7 +207,8 @@ def lecture(id): ...@@ -206,7 +207,8 @@ def lecture(id):
if not courses: if not courses:
return render_endpoint('course', 'Diese Veranstaltung existiert nicht!'), 404 return render_endpoint('course', 'Diese Veranstaltung existiert nicht!'), 404
chapters = query('SELECT * FROM chapters WHERE lecture_id = ? AND NOT deleted AND (? OR visible) ORDER BY time ASC', id, ismod()) chapters = query('SELECT * FROM chapters WHERE lecture_id = ? AND NOT deleted AND (? OR visible) ORDER BY time ASC', id, ismod())
return render_template('lecture.html', course=courses[0], lecture=lectures[0], videos=videos, chapters=chapters) return render_template('embed.html' if request.endpoint == 'embed' else 'lecture.html', course=courses[0], lecture=lectures[0], videos=videos, chapters=chapters)
@app.route('/search') @app.route('/search')
def search(): def search():
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
{%if ismod() %}<script src="{{url_for('static', filename='moderator.js')}}"></script>{% endif %} {%if ismod() %}<script src="{{url_for('static', filename='moderator.js')}}"></script>{% endif %}
</head> </head>
<body> <body>
{% block navbar %}
<nav class="navbar navbar-default navbar-static-top"> <nav class="navbar navbar-default navbar-static-top">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
...@@ -98,6 +99,7 @@ ...@@ -98,6 +99,7 @@
</div> </div>
</div> </div>
</nav> </nav>
{% endblock %}
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
{% if page_border == 0 %} {% if page_border == 0 %}
...@@ -127,8 +129,6 @@ ...@@ -127,8 +129,6 @@
</div> </div>
{% endfor %} {% endfor %}
{% block content %} {% block content %}
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
{% endblock %} {% endblock %}
</div> </div>
</div> </div>
......
{% from 'macros.html' import player %}
{% from 'macros.html' import video_download_btn %}
{% from 'macros.html' import video_embed_btn %}
{% set page_border = 0 -%}
{% extends "base.html" %}
{% block navbar %}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-xs-12" style="padding: 0px">
{{ player(lecture, videos) }}
</div>
</div>
{% endblock %}
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
<span>Einbetten</span> <span>Einbetten</span>
</a> </a>
<script> <script>
{% set embedcode = '<iframe width="700" height="394" src="https://videoag.fsmpi.rwth-aachen.de/site/embed.php?lecture='+lectureid|string+'" frameborder="0" allowfullscreen="true"></iframe>' %} {% set embedcode = '<iframe width="700" height="394" src="'+url_for('embed', id=lectureid, _external=True)+'" frameborder="0" allowfullscreen="true"></iframe>' %}
$('#embedcodebtn').popover( $('#embedcodebtn').popover(
{ {
html:true, html:true,
......
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