Commit 47c63905 authored by Andreas Valder's avatar Andreas Valder
Browse files

changed chapter editor and now showing comment on lecture site, closes #202

parent 31613714
......@@ -78,7 +78,7 @@ var moderator = {
'<textarea class="form-control editor_value ctrl_enter_submit" rows="3" data-path="'+$(this.parentElement).data('path')+'">'+this.parentElement.getElementsByClassName('moderator_editor_value')[0].innerHTML+'</textarea>'+
'</span>'+
'<span class="col-xs-12">'+
'<input class="btn btn-default pull-right" type="submit" data-path="'+$(this.parentElement).data('path')+'" value="save" onClick="moderator.editor.editbtnclick(this)">'+
'<input class="btn btn-default pull-right" type="submit" data-path="'+$(this.parentElement).data('path')+'" data-reload="'+$(this.parentElement).data('reload')+'" value="save" onClick="moderator.editor.editbtnclick(this)">'+
'</span>'+
'</div>';
}
......@@ -97,6 +97,7 @@ var moderator = {
},
editbtnclick: function (src) {
var path = $($(src)[0]).data('path');
var reload = $($(src)[0]).data('reload');
var value = $('.editor_value',src.parentElement.parentElement).val();
var editable = $('.moderator_editor');
......@@ -108,7 +109,7 @@ var moderator = {
$(".moderator_editor_value",e).html(value);
}
}
moderator.api.set(path,value);
moderator.api.set(path,value,reload);
},
changeboxclick: function(src) {
var value = $(src)[0].checked;
......
......@@ -3,6 +3,7 @@
{% from 'macros.html' import video_embed_btn %}
{% from 'macros.html' import vtttime %}
{% from 'macros.html' import moderator_editor %}
{% from 'macros.html' import moderator_editor_time %}
{% from 'macros.html' import moderator_delete %}
{% from 'macros.html' import moderator_checkbox %}
{% set page_border = 1 -%}
......@@ -36,28 +37,41 @@
<div class="col-xs-12" style="padding: 0px">
{{ player(lecture, videos, get_flashed_messages(category_filter=['player'])) }}
</div>
<div class="col-xs-12" style="padding-top: 20px">
<p>{{ moderator_editor(['lectures',lecture.id,'comment'], lecture.comment) }}</p>
</div>
{% if (chapters|length > 0) or ismod() %}
<div class="col-xs-12 table-responsive" style="padding-top: 10px;">
<p>Kapitel:</p>
<table class="table table-hover">
<tr>
<th style="width: 130px;">Start</th>
<th>Kapitel</th>
{% if ismod() %}
<th>Sichtbar</th>
<th></th>
{% endif %}
</tr>
{% for c in chapters|sort(attribute='time') %}
<tr>
<td>
<a href="javascript:videojs('videoplayer').currentTime({{c['time']}})">{{ '%02d:%02d:%02d'|format( c['time']//3600, (c['time']//60)%60, c['time']%60) }}</a>
<br>
{% if ismod() %}
{{ moderator_editor(['chapters',c.id,'time'],c['time'],true) }}
{% endif %}
</td>
<td>{{ moderator_editor(['chapters',c.id,'text'],c['text']|e) }}</td>
{% if ismod() %}
<td>{{ moderator_checkbox(['chapters',c.id,'visible'], c.visible) }}</td>
<td>{{ moderator_delete(['chapters',c.id,'deleted']) }}</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% if ismod() %}
<div class="col-xs-12" style="padding-top: 10px;">
<p>Kapitel:</p>
<table class="table table-hover">
<tr>
<th>Index</th>
<th>Start</th>
<th>Kapitel</th>
<th>Sichtbar</th>
<th></th>
</tr>
{% for c in chapters|sort(attribute='time') %}
<tr>
<td>{{ loop.index }}</td>
<td><a href="javascript:videojs('videoplayer').currentTime({{c['time']}})">{{ vtttime(c['time']) }}</a></td>
<td>{{ moderator_editor(['chapters',c.id,'text'],c['text']|e) }}</td>
<td>{{ moderator_checkbox(['chapters',c.id,'visible'], c.visible) }}</td>
<td>{{ moderator_delete(['chapters',c.id,'deleted']) }}</td>
</tr>
{% endfor %}
</table>
</div>
<div class="col-xs-12 plot-view" data-url="{{url_for('stats_viewsperday', req="lecture", param=lecture.id)}}"></div>
<div class="col-xs-12 plot-view" data-url="{{url_for('stats_generic', req="live_views", param=lecture.id)}}"></div>
{% endif %}
......@@ -93,7 +107,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="texz"><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="Vorschlagen"></form>';
}
})
......
......@@ -242,9 +242,9 @@ $('#embedcodebtn').popover(
</li>
{% endmacro %}
{% macro moderator_editor (path,value) %}
{% macro moderator_editor (path,value,reload=false) %}
{% if ismod() %}
<span class="moderator_editor" data-path="{{path|join('.')}}" >
<span class="moderator_editor" data-path="{{path|join('.')}}" data-reload="{{ reload|int }}" >
<a class="moderator_editor_sign btn btn-default" title="{{path|join('.')}}" data-toggle="tooltip" tabindex="0" style="padding: 3px; margin-right: 5px;">
<span class="glyphicon glyphicon-pencil"></span>
</a>
......
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