Commit c48327c9 authored by Andreas Valder's avatar Andreas Valder
Browse files

added hints to some edit options, closes #105

parent d754741f
......@@ -14,19 +14,19 @@ editable_tables = {
'idcolumn': 'id',
'editable_fields': {
'visible': {'type': 'boolean'},
'listed': {'type': 'boolean'},
'listed': {'type': 'boolean', 'description': 'Soll die Veranstaltung auf der Hauptseite gelistet werden?'},
'title': {'type': 'shortstring'},
'short': {'type': 'shortstring'},
'short': {'type': 'shortstring', 'description': 'Abkürzung für die Veranstaltung, z.B. für den Drehplan'},
'handle': {'type': 'shortstring'},
'organizer': {'type': 'shortstring'},
'subject': {'type': 'shortstring'},
'semester': {'type': 'shortstring'},
'downloadable': {'type': 'boolean'},
'downloadable': {'type': 'boolean', 'description': 'Hiermit kann der Download-Button disabled werden'},
'internal': {'type': 'text'},
'responsible': {'type': 'shortstring'},
'deleted': {'type': 'boolean'},
'description': {'type': 'text'},
'external': {'type': 'boolean'}},
'external': {'type': 'boolean', 'description': 'Soll die Veranstaltung nicht im Drehplan angezeigt werden?'}},
'creationtime_fields': ['created_by', 'time_created', 'time_updated'] },
'lectures': {
'table': 'lectures_data',
......@@ -42,7 +42,7 @@ editable_tables = {
'duration': {'type': 'duration'},
'jumplist': {'type': ''},
'deleted': {'type': 'boolean'},
'live': {'type': 'boolean'},
'live': {'type': 'boolean', 'description': 'Ist ein Livestream geplant?'},
'norecording': {'type': 'boolean'}},
'creationtime_fields': ['course_id', 'time_created', 'time_updated'] },
'videos': {
......@@ -110,6 +110,13 @@ def parseeditpath(path):
assert column in editable_tables[table]['editable_fields']
type = editable_tables[table]['editable_fields'][column]['type']
return {'table': table, 'id': id, 'column': column, 'type': type, 'tableinfo': editable_tables[table]}
@app.template_filter(name='getfielddescription')
def getfielddescription(path):
p = parseeditpath(path)
desc = p['tableinfo']['editable_fields'][p['column']].get('description', '')
if desc != '':
desc = '<br>'+desc
return desc
@app.route('/internal/edit', methods=['GET', 'POST'])
@mod_required
......
......@@ -202,7 +202,11 @@
{% endif %}
<script>
$( function () {
$('[data-toggle="tooltip"]').tooltip({ 'trigger': 'hover' });
$('[data-toggle="tooltip"]').tooltip(
{
trigger: 'hover',
html: true
});
});
</script>
</body>
......
......@@ -103,9 +103,18 @@ $.ajax({
method: "GET",
url: "{{url_for('stats_generic', req="lecture_views", param=course.id)}}",
dataType: "json",
error: function() {
var counter = $(".viewcounter");
for (var i=0; i<counter.length; i++) {
$(counter[i]).text("0");
}
},
success: function (traces) {
var dates={};
var t = traces[0]
var t = traces[0];
if (!t.x) {
return;
}
for (var i=0; i<t.x.length; i++) {
dates[t.x[i]] = t.y[i];
}
......
......@@ -267,7 +267,7 @@ $('#embedcodebtn').popover(
{% macro moderator_editor (path,value,reload=false) %}
{% if ismod() %}
<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;">
<a class="moderator_editor_sign btn btn-default" title="{{path|join('.')}}{{ path|join('.')|getfielddescription }}" data-toggle="tooltip" tabindex="0" style="padding: 3px; margin-right: 5px;">
<span class="glyphicon glyphicon-pencil"></span>
</a>
<span class="moderator_editor_value">{{ value|fixnl|safe }}</span>
......@@ -279,13 +279,13 @@ $('#embedcodebtn').popover(
{% macro moderator_checkbox (path,value) %}
{% if ismod() %}
<input title="{{path|join('.')}}" data-toggle="tooltip" type="checkbox" data-path="{{path|join('.')}}" {% if value %} checked {% endif %} onchange="moderator.editor.changeboxclick(this)"/>
<input title="{{path|join('.')}}{{ path|join('.')|getfielddescription }}" data-toggle="tooltip" type="checkbox" data-path="{{path|join('.')}}" {% if value %} checked {% endif %} onchange="moderator.editor.changeboxclick(this)"/>
{% endif %}
{% endmacro %}
{% macro moderator_delete (path) %}
{% if ismod() %}
<button class="btn btn-default" style="background-color: red;" data-path="{{path|join('.')}}" onclick="moderator.editor.deletebtnclick(this)">
<button class="btn btn-default" style="background-color: red;" data-path="{{path|join('.')}}" onclick="moderator.editor.deletebtnclick(this)" >
<span class="glyphicon glyphicon-trash"></span>
</button>
{% endif %}
......
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