diff --git a/common/lib/xmodule/xmodule/css/annotatable/display.scss b/common/lib/xmodule/xmodule/css/annotatable/display.scss index 3c5437dac7..9b2cbc3763 100644 --- a/common/lib/xmodule/xmodule/css/annotatable/display.scss +++ b/common/lib/xmodule/xmodule/css/annotatable/display.scss @@ -14,12 +14,24 @@ } } +.annotatable-toggle { + display: block; + font-size: $body-font-size; +} + span.annotatable { color: $blue; cursor: pointer; .annotatable-icon { margin: auto 2px auto 4px; } + &.hide { + cursor: none; + color: inherit; + .annotatable-icon { + display: none; + } + } } .annotatable-icon { @@ -64,4 +76,7 @@ span.annotatable { &.opaque { opacity: 0.4; } + &.hide { + display: none; + } } diff --git a/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee b/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee index 52feb686ba..4a5e2e42d6 100644 --- a/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee @@ -4,6 +4,7 @@ class @Annotatable wrapperSelector: '.annotatable-wrapper' spanSelector: 'span.annotatable[data-span-id]' discussionSelector: '.annotatable-discussion[data-discussion-id]' + toggleSelector: '.annotatable-toggle' constructor: (el) -> console.log 'loaded Annotatable' if @_debug @@ -11,10 +12,14 @@ class @Annotatable @init() init: () -> + @hideAnnotations = false + @spandata = {} @loadSpanData() @initEvents() initEvents: () -> + $(@toggleSelector, @el).bind('click', @_bind @onClickToggleAnnotations) + $(@wrapperSelector, @el).delegate(@spanSelector, { 'click': @_bind @onSpanEvent @onClickSpan 'mouseenter': @_bind @onSpanEvent @onEnterSpan @@ -30,6 +35,11 @@ class @Annotatable getDiscussionEl: (discussion_id) -> $(@discussionSelector, @el).filter('[data-discussion-id="'+discussion_id+'"]') + onClickToggleAnnotations: (e) -> + @hideAnnotations = !@hideAnnotations + $(@spanSelector, @el).add(@discussionSelector, @el).toggleClass('hide', @hideAnnotations) + $(@toggleSelector, @el).text(if @hideAnnotations then 'Show Annotations' else 'Hide Annotations') + onSpanEvent: (fn) -> (e) => span_el = e.currentTarget @@ -44,7 +54,8 @@ class @Annotatable id: discussion_id el: discussion_el } - fn.call this, span, discussion + if !@hideAnnotations + fn.call this, span, discussion onClickSpan: (span, discussion) -> @scrollToDiscussion(discussion.el) diff --git a/lms/templates/annotatable.html b/lms/templates/annotatable.html index fb0b36d9ee..78c2d5a97a 100644 --- a/lms/templates/annotatable.html +++ b/lms/templates/annotatable.html @@ -6,6 +6,7 @@
${display_name}
% endif
Annotated Reading + Guided Discussion
+ Hide Annotations