Commit 19861b32 authored by Andreas Valder's avatar Andreas Valder
Browse files

more work on the mod interface

parent c12fa866
......@@ -198,13 +198,13 @@ def course():
return app.view_functions['videos'](), 404
lectures = query('SELECT * FROM lectures WHERE course_id = ? AND (? OR visible)', courses[0]['id'], ismod())
videos = query('''
SELECT *, formats.description AS format_description
SELECT videos.*, formats.description AS format_description
FROM videos
JOIN lectures ON (videos.lecture_id = lectures.id)
JOIN formats ON (videos.video_format = formats.id)
WHERE lectures.course_id= ?
WHERE lectures.course_id= ? AND (? OR videos.visible)
ORDER BY formats.prio DESC
''', courses[0]['id'])
''', courses[0]['id'], ismod())
return render_template('course.html', course=courses[0], lectures=lectures, videos=videos)
@app.route('/login', methods=['GET', 'POST'])
......
......@@ -42,6 +42,15 @@ var moderatorinterface = {
$(".modeditablevalue",e).html(value);
}
}
moderatorinterface.set(path,value);
},
change: function() {
var event = window.event;
var value = $(event.srcElement)[0].checked;
var path = $($(event.srcElement)[0]).data('path');
moderatorinterface.set(path,value ? 1 : 0);
},
set: function(path,value) {
var req = {};
req[path] = value;
$.ajax({
......@@ -51,7 +60,6 @@ var moderatorinterface = {
contentType: "application/json",
data: JSON.stringify(req)
})
}
};
......
......@@ -94,7 +94,7 @@
<button class="btn btn-primary dropdown-toggle {% if videos|length is equalto 0 %}disabled{% endif %}" type="button" data-toggle="dropdown">Download <span class="caret"></span></button>
<ul class="dropdown-menu">
{% for v in videos %}
<li><a href="{{ videoprefix }}/{{v.path}}">{{v.format_description}} ({{v.file_size|filesizeformat(true)}})</a></li>
<li><a href="{{ videoprefix }}/{{v.path}}">{{ valuecheckbox(['videos',v.id,'visible'], v.visible) }} {{v.format_description}} ({{v.file_size|filesizeformat(true)}})</a></li>
{% endfor %}
</ul>
<noscript>
......@@ -128,13 +128,16 @@ $('#embedcodebtn').popover(
<img class="col-sm-2 col-xs-12"src="https://videoag.fsmpi.rwth-aachen.de/{{lecture.titlefile}}" alt="Vorschaubild">
<span class="col-sm-3 col-xs-12">
<ul class="list-unstyled">
<li>{{ lecture.title }}</li>
{% if lecture.speaker %}<li>Gehalten von {{ lecture.speaker|safe }}</li>{% endif %}
<li>{{ lecture.time }}</li>
<li>{{ valueeditor(['lectures',lecture.id,'title'], lecture.title) }}</li>
{% if lecture.speaker or ismod() %}<li>Gehalten von {{ valueeditor(['lectures',lecture.id,'speaker'], lecture.speaker) }}</li>{% endif %}
<li>{{ valueeditor(['lectures',lecture.id,'time'], lecture.time) }} </li>
</ul>
</span>
<span class="col-sm-4 col-xs-12">
{{ lecture.comment|safe }}
<ul class="list-unstyled">
<li>{{ valueeditor(['lectures',lecture.id,'comment'], lecture.comment) }}</li>
{% if ismod() %}<li>{{ valueeditor(['lectures',lecture.id,'internal'], lecture.internal) }}</li>{% endif %}
</ul>
</span>
<span class="col-sm-3 col-xs-12">
<span class="pull-right">
......@@ -157,4 +160,10 @@ $('#embedcodebtn').popover(
{% else %}
{{value|safe}}
{% endif %}
{% endmacro%}
{% endmacro %}
{% macro valuecheckbox (path,value) %}
{% if ismod() %}
<input type="checkbox" data-path="{{path|join('.')}}" {% if value %} checked {% endif %} onchange="moderatorinterface.change()"/>
{% endif %}
{% endmacro %}
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