Commit 8a500a03 authored by Randall Leeds's avatar Randall Leeds

Track diff per-target and set/unset showDiff

parent fbd715dd
......@@ -45,6 +45,8 @@ AnnotationController = [
@preview = 'no'
@editing = false
@embedded = false
@hasDiff = false
@showDiff = undefined
highlight = annotator.tool is 'highlight'
model = $scope.annotationGet()
......@@ -206,8 +208,10 @@ AnnotationController = [
@annotation.tags = ({text} for text in (model.tags or []))
# Calculate the visual diff flags
@hasDiff = @annotation.target.filter((t) -> t.diffHTML?).length > 0
@showDiff ?= @hasDiff && @annotation.target.filter((t) -> t.diffHTML? and not t.diffCaseOnly).length > 0
@hasDiff = false
for t in @annotation.target or [] when t.diffHTML? and not t.diffCaseOnly
@hasDiff = t.hasDiff = true
@showDiff ?= @hasDiff or undefined
# Export the baseURI for the share link
this.baseURI = documentHelpers.baseURI
......
......@@ -44,14 +44,14 @@
<section class="annotation-target"
ng-repeat="target in vm.annotation.target track by $index">
<blockquote class="annotation-quote"
ng-hide="vm.showDiff"
ng-hide="target.hasDiff && vm.showDiff"
ng-bind-html="selector.exact"
ng-repeat="selector in target.selector
| filter : {'type': 'TextQuoteSelector'}
track by $index"></blockquote>
<blockquote class="annotation-quote"
ng-bind-html="target.diffHTML"
ng-show="vm.showDiff"></blockquote>
ng-show="target.hasDiff && vm.showDiff"></blockquote>
</section>
<div class="small pull-right"
ng-show="vm.hasDiff">
......
Markdown is supported
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