Commit cf39c9dd authored by csillag's avatar csillag

Resurrect the removed visual diff support

parent eb335805
...@@ -37,8 +37,8 @@ validate = (value) -> ...@@ -37,8 +37,8 @@ validate = (value) ->
# {@link annotator annotator service} for persistence. # {@link annotator annotator service} for persistence.
### ###
AnnotationController = [ AnnotationController = [
'$scope', 'annotator', 'drafts', 'flash', 'documentHelpers', '$sce', '$scope', 'annotator', 'drafts', 'flash', 'documentHelpers',
($scope, annotator, drafts, flash, documentHelpers) -> ($sce, $scope, annotator, drafts, flash, documentHelpers) ->
@annotation = {} @annotation = {}
@action = 'view' @action = 'view'
@document = null @document = null
...@@ -227,6 +227,17 @@ AnnotationController = [ ...@@ -227,6 +227,17 @@ AnnotationController = [
else else
this.render() 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), => $scope.$watch (=> @annotation.id), =>
vm.annotationURI = documentHelpers.absoluteURI("/a/#{@annotation.id}") vm.annotationURI = documentHelpers.absoluteURI("/a/#{@annotation.id}")
......
...@@ -44,10 +44,21 @@ ...@@ -44,10 +44,21 @@
<section class="annotation-target" <section class="annotation-target"
ng-repeat="target in vm.annotation.target track by $index"> ng-repeat="target in vm.annotation.target track by $index">
<blockquote class="annotation-quote" <blockquote class="annotation-quote"
ng-hide="target.showDiff"
ng-bind-html="selector.exact" ng-bind-html="selector.exact"
ng-repeat="selector in target.selector ng-repeat="selector in target.selector
| filter : {'type': 'TextQuoteSelector'} | filter : {'type': 'TextQuoteSelector'}
track by $index"></blockquote> 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> </section>
<!-- / Excerpts -- > <!-- / 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