From e489bb16654d955ff9a0629fa147edc13d189fca Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Sun, 16 Oct 2016 18:15:50 +0200
Subject: [PATCH] hinting chapter marks now works without beeing logged in.
 closes #166

---
 static/moderator.js    | 12 ------------
 templates/lecture.html | 15 ++++++++++++++-
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/static/moderator.js b/static/moderator.js
index 4f832d6..494f234 100644
--- a/static/moderator.js
+++ b/static/moderator.js
@@ -105,18 +105,6 @@ var moderator = {
 			if (confirm('Really delete this?')) { 
 				moderator.api.set($(src).data('path'),1,true); 
 			}
-		},
-		hintchapterclick: function(src) {
-			$.ajax({
-				method: "GET",
-				url: $(src).data('url'),
-				data: $(src).serialize(),
-				success: function(data)
-				{
-					alert("Kapitelmarker vorgeschlagen. Danke!");
-				}
-			});
-			return false;
 		}
 	},
 	permissioneditor: {
diff --git a/templates/lecture.html b/templates/lecture.html
index d351c1c..ff63a94 100644
--- a/templates/lecture.html
+++ b/templates/lecture.html
@@ -65,6 +65,19 @@
 	</div>
 </div>
 <script>
+function hintchapterclick (src) {
+	$.ajax({
+		method: "GET",
+		url: $(src).data('url'),
+		data: $(src).serialize(),
+		success: function(data)
+		{
+			alert("Kapitelmarker vorgeschlagen. Danke!");
+			$('#hintnewchapter').popover('hide');
+		}
+	});
+	return false;
+}
 $(function() {
 	$( "#hintnewchapter" ).popover(
 			{
@@ -80,7 +93,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 moderator.editor.hintchapterclick(this);"><input placeholder="00:00.000" name="time" type="text" value="'+timeasstring+'"><br><input placeholder="Kapitel" name="text" type="texz"><br><input type="submit" value="Vorschlagen"></form>';
+					return '<form method="post" data-url="{{ url_for('suggest_chapter', lectureid=lecture.id) }}" onSubmit="return hintchapterclick(this);"><input placeholder="00:00.000" name="time" type="text" value="'+timeasstring+'"><br><input placeholder="Kapitel" name="text" type="texz"><br><input type="submit" value="Vorschlagen"></form>';
 				}
 			})
 
-- 
GitLab