Skip to content
Snippets Groups Projects
Commit d644e637 authored by Andreas Valder's avatar Andreas Valder
Browse files

added a way to suggest chapters, #22

parent 2cd50ae9
No related branches found
No related tags found
No related merge requests found
......@@ -386,7 +386,13 @@ def suggest_chapter(lectureid):
time = request.values['time']
text = request.values['text']
assert(time and text)
time = int(time)
try:
x = datetime.strptime(time,'%H:%M:%S')
time= timedelta(hours=x.hour,minutes=x.minute,seconds=x.second).total_seconds()
time = int(time)
except ValueError:
flash('Falsches Zeitformat, "%H:%M:%S" wird erwartet. Z.B. "01:39:42" für eine Kapitel bei Stunde 1, Minute 39, Sekunde 42')
submitter = None
if not ismod():
submitter = request.environ['REMOTE_ADDR']
......
......@@ -16,6 +16,7 @@
</div>
<div class="col-sm-6 col-xs-12">
<ul class="list-inline pull-right">
<li><button class="btn btn-default" id="hintnewchapter">Kapitelmarker vorschlagen</button></li>
<li>{{ video_embed_btn(lecture.id) }}</li>
<li class="dropdown">{{ video_download_btn(videos) }}</li>
</ul>
......@@ -25,8 +26,21 @@
<div class="col-xs-12" style="padding: 0px">
{{ player(lecture, videos) }}
</div>
<div class="col-xs-12" style="padding-top: 10px;">
</div>
</div>
</div>
</div>
<script>
$(function() {
$( "#hintnewchapter" ).popover(
{
html:true,
title:'Kapitelmarkierung vorschlagen',
content:'<form method="post" action="{{url_for('suggest_chapter', ref=request.url, lectureid=lecture.id)}}"><input placeholder="00:00.000" name="time" type="text"><br><input placeholder="Kapitel" name="text" type="texz"><br><input type="submit" value="Vorschlagen"></form>'
})
});
</script>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment