diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py
index 14d98be1e6..37cd2a8fa4 100644
--- a/common/lib/capa/capa/inputtypes.py
+++ b/common/lib/capa/capa/inputtypes.py
@@ -980,6 +980,7 @@ class AnnotationInput(InputTypeBase):
self.comment_prompt = xml.findtext('./comment_prompt', 'Type a commentary below:')
self.tag_prompt = xml.findtext('./tag_prompt', 'Select one or more tags:')
self.options = self._find_options()
+ self.return_to_annotation = True
# Need to provide a value that JSON can parse if there is no
# student-supplied value yet.
@@ -1024,6 +1025,7 @@ class AnnotationInput(InputTypeBase):
'comment_prompt': self.comment_prompt,
'tag_prompt': self.tag_prompt,
'options': self.options,
+ 'return_to_annotation': self.return_to_annotation,
'debug': self.debug
}
unpacked_value = self._unpack_value()
diff --git a/common/lib/capa/capa/templates/annotationinput.html b/common/lib/capa/capa/templates/annotationinput.html
index 38f8f5f726..dce0434555 100644
--- a/common/lib/capa/capa/templates/annotationinput.html
+++ b/common/lib/capa/capa/templates/annotationinput.html
@@ -44,7 +44,9 @@
% endif
- Return to Annotation
+ % if return_to_annotation:
+ Return to Annotation
+ % endif
diff --git a/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee b/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
index 22e84c6c07..7d0a70810f 100644
--- a/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
+++ b/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee
@@ -1,5 +1,5 @@
class @Annotatable
- _debug: true
+ _debug: false
wrapperSelector: '.annotatable-wrapper'
toggleSelector: '.annotatable-toggle'
@@ -8,11 +8,9 @@ class @Annotatable
problemXModuleSelector: '.xmodule_CapaModule'
problemSelector: 'section.problem'
+ problemInputSelector: '.annotation-input'
problemReturnSelector: 'section.problem .annotation-return'
- discussionXModuleSelector: '.xmodule_DiscussionModule'
- discussionSelector: '.discussion-module'
-
constructor: (el) ->
console.log 'loaded Annotatable' if @_debug
@el = el
@@ -24,7 +22,6 @@ class @Annotatable
init: () ->
@initEvents()
@initTips()
- @initDiscussion()
initEvents: () ->
# For handling hide/show of annotations
@@ -36,14 +33,12 @@ class @Annotatable
# (see the qtip2 options, this must be set explicitly, otherwise they render in the body).
@$(@wrapperSelector).delegate @replySelector, 'click', @onClickReply
- # This is a silly hack, but it assumes two things:
+ # For handling 'return to annotation' events from capa problems. Assumes that:
# 1) There are annotationinput capa problems rendered on the page
- # 2) Each one has its an embedded "return to annotation" link.
+ # 2) Each one has an embedded "return to annotation" link (from the capa problem template).
# The capa problem's html is injected via AJAX so this just sets a listener on the body and
# handles the click event there.
$('body').delegate @problemReturnSelector, 'click', @onClickReturn
-
- initDiscussion: () -> 1
initTips: () ->
@savedTips = []
@@ -103,17 +98,10 @@ class @Annotatable
getProblem: (el) ->
problem_id = @getProblemId(el)
- $(@problemSelector).eq(problem_id)
-
- getDiscussion: () ->
- discussion_id = @getDiscussionId()
- $(@discussionXModuleSelector).find(@discussionSelector).filter("[data-discussion-id='#{discussion_id}']")
+ $(@problemSelector).has(@problemInputSelector).eq(problem_id)
getProblemId: (el) ->
$(el).data('problem-id')
-
- getDiscussionId: () ->
- @$(@wrapperSelector).data('discussion-id')
toggleAnnotations: () ->
hide = (@annotationsHidden = not @annotationsHidden)
@@ -142,10 +130,6 @@ class @Annotatable
offset: offset
}) if $(el).length > 0
- afterScrollToDiscussion: (discussion_el) ->
- btn = $('.discussion-show', discussion_el)
- btn.click() if !btn.hasClass('shown')
-
afterScrollToProblem: (problem_el) ->
problem_el.effect 'highlight', {}, 500