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

made chapter editor better, closes #196

parent da15c877
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
<div class="col-xs-12" style="padding-bottom: 5px;"> <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> <a href="{{url_for('course', handle=course.handle)}}#lecture-{{lecture.id}}" class="btn btn-default" >Zur Veranstaltungsseite</a>
<ul class="list-inline pull-right"> <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>{{ video_embed_btn(lecture.id, course=course.handle) }}</li>
<li class="dropdown">{{ video_download_btn(videos) }}</li> <li class="dropdown">{{ video_download_btn(videos) }}</li>
</ul> </ul>
...@@ -42,7 +41,9 @@ ...@@ -42,7 +41,9 @@
</div> </div>
{% if (chapters|length > 0) or ismod() %} {% if (chapters|length > 0) or ismod() %}
<div class="col-xs-12 table-responsive" style="padding-top: 10px;"> <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"> <table class="table table-hover">
<tr> <tr>
<th style="width: 130px;">Start</th> <th style="width: 130px;">Start</th>
...@@ -86,8 +87,12 @@ function hintchapterclick (src) { ...@@ -86,8 +87,12 @@ function hintchapterclick (src) {
data: $(src).serialize(), data: $(src).serialize(),
success: function(data) success: function(data)
{ {
{% if not ismod() %}
alert("Kapitelmarker vorgeschlagen. Danke!"); alert("Kapitelmarker vorgeschlagen. Danke!");
$('#hintnewchapter').popover('hide'); {% else %}
window.location.reload();
{% endif %}
$('#hintnewchapter').click();
} }
}); });
return false; return false;
...@@ -97,6 +102,8 @@ $(function() { ...@@ -97,6 +102,8 @@ $(function() {
{ {
html:true, html:true,
title:'Kapitelmarkierung vorschlagen', title:'Kapitelmarkierung vorschlagen',
placement: 'bottom',
container: 'body',
content: function() { content: function() {
var zeropad = function (num, places) { var zeropad = function (num, places) {
var zero = places - num.toString().length + 1; var zero = places - num.toString().length + 1;
...@@ -107,7 +114,7 @@ $(function() { ...@@ -107,7 +114,7 @@ $(function() {
var m = zeropad( Math.trunc((timestamp%3600)/60),2); var m = zeropad( Math.trunc((timestamp%3600)/60),2);
var s = zeropad( Math.trunc(timestamp%60),2); var s = zeropad( Math.trunc(timestamp%60),2);
var timeasstring = h+':'+m+':'+s; 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>';
} }
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment