Commit 629a61e7 authored by Andreas Valder's avatar Andreas Valder
Browse files

made chapter editor better, closes #196

parent da15c877
......@@ -27,7 +27,6 @@
<div class="col-xs-12" style="padding-bottom: 5px;">
<a href="{{url_for('course', handle=course.handle)}}#lecture-{{lecture.id}}" class="btn btn-default" >Zur Veranstaltungsseite</a>
<ul class="list-inline pull-right">
<li><button class="btn btn-default" id="hintnewchapter">Kapitelmarker vorschlagen</button></li>
<li>{{ video_embed_btn(lecture.id, course=course.handle) }}</li>
<li class="dropdown">{{ video_download_btn(videos) }}</li>
</ul>
......@@ -42,7 +41,9 @@
</div>
{% if (chapters|length > 0) or ismod() %}
<div class="col-xs-12 table-responsive" style="padding-top: 10px;">
<p>Kapitel:</p>
<p>Kapitel:
<button class="btn btn-default" id="hintnewchapter">{% if ismod() %}Neues Kapitel{% else %}Kapitelmarker vorschlagen{% endif %}</button>
</p>
<table class="table table-hover">
<tr>
<th style="width: 130px;">Start</th>
......@@ -86,8 +87,12 @@ function hintchapterclick (src) {
data: $(src).serialize(),
success: function(data)
{
alert("Kapitelmarker vorgeschlagen. Danke!");
$('#hintnewchapter').popover('hide');
{% if not ismod() %}
alert("Kapitelmarker vorgeschlagen. Danke!");
{% else %}
window.location.reload();
{% endif %}
$('#hintnewchapter').click();
}
});
return false;
......@@ -97,6 +102,8 @@ $(function() {
{
html:true,
title:'Kapitelmarkierung vorschlagen',
placement: 'bottom',
container: 'body',
content: function() {
var zeropad = function (num, places) {
var zero = places - num.toString().length + 1;
......@@ -107,7 +114,7 @@ $(function() {
var m = zeropad( Math.trunc((timestamp%3600)/60),2);
var s = zeropad( Math.trunc(timestamp%60),2);
var timeasstring = h+':'+m+':'+s;
return '<form method="post" data-url="{{ url_for('suggest_chapter', lectureid=lecture.id) }}" onSubmit="return hintchapterclick(this);"><input class="form-control" placeholder="00:00.000" name="time" type="text" value="'+timeasstring+'"><br><input class="form-control" placeholder="Kapitel" name="text" type="text"><br><input type="submit" class="btn btn-default" value="Vorschlagen"></form>';
return '<form method="post" data-url="{{ url_for('suggest_chapter', lectureid=lecture.id) }}" onSubmit="return hintchapterclick(this);"><input class="form-control" placeholder="00:00.000" name="time" type="text" value="'+timeasstring+'"><br><input class="form-control" placeholder="Kapitel" name="text" type="text"><br><input type="submit" class="btn btn-default" value="{% if ismod() %}Hinzufügen{% else %}Vorschlagen{% endif %}"></form>';
}
})
......
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