From fa9c40341e2193eed2bb34366152a984beb3ac10 Mon Sep 17 00:00:00 2001 From: Tim Daniel Metzler Date: Fri, 15 Sep 2023 15:37:38 +0200 Subject: [PATCH] When a cell is not present in the notebook, do not try to render an AnnotationUI --- .../apps/formgrader/static/js/formgrade_models.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/e2xgrader/server_extensions/apps/formgrader/static/js/formgrade_models.js b/e2xgrader/server_extensions/apps/formgrader/static/js/formgrade_models.js index eb394246..4c78958a 100644 --- a/e2xgrader/server_extensions/apps/formgrader/static/js/formgrade_models.js +++ b/e2xgrader/server_extensions/apps/formgrader/static/js/formgrade_models.js @@ -175,6 +175,12 @@ let Comments = Backbone.Collection.extend({ let AnnotationUI = Backbone.View.extend({ initialize: function () { + if (this.$el.length == 0) { + console.log( + "Failed to create AnnotationUI. Cell is not present in the notebook" + ); + return; + } this.$switch = this.$el.find('input[name="annotate"]'); this.$switch.prop("checked", "checked");