Commit cf39c9dd authored by csillag's avatar csillag

Resurrect the removed visual diff support

parent eb335805
......@@ -37,8 +37,8 @@ validate = (value) ->
# {@link annotator annotator service} for persistence.
###
AnnotationController = [
'$scope', 'annotator', 'drafts', 'flash', 'documentHelpers',
($scope, annotator, drafts, flash, documentHelpers) ->
'$sce', '$scope', 'annotator', 'drafts', 'flash', 'documentHelpers',
($sce, $scope, annotator, drafts, flash, documentHelpers) ->
@annotation = {}
@action = 'view'
@document = null
......@@ -227,6 +227,17 @@ AnnotationController = [
else
this.render()
# Calculate things neded for the visual diff support
$scope.$watch (-> model.target), (targets) =>
for target in targets
if target.diffHTML?
target.trustedDiffHTML = $sce.trustAsHtml target.diffHTML
target.showDiff = not target.diffCaseOnly
else
delete target.trustedDiffHTML
target.showDiff = false
this.render()
$scope.$watch (=> @annotation.id), =>
vm.annotationURI = documentHelpers.absoluteURI("/a/#{@annotation.id}")
......
......@@ -44,10 +44,21 @@
<section class="annotation-target"
ng-repeat="target in vm.annotation.target track by $index">
<blockquote class="annotation-quote"
ng-hide="target.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.trustedDiffHTML"
ng-show="target.showDiff"></blockquote>
<div class="small pull-right"
ng-show="target.trustedDiffHTML">
<input type="checkbox"
ng-model="target.showDiff"
ng-click="$event.stopPropagation()"> Show differences</input>
</div>
</section>
<!-- / Excerpts -- >
......
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