Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
cf39c9dd
Commit
cf39c9dd
authored
Nov 21, 2014
by
csillag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resurrect the removed visual diff support
parent
eb335805
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
annotation.coffee
h/static/scripts/directives/annotation.coffee
+13
-2
annotation.html
h/templates/client/annotation.html
+11
-0
No files found.
h/static/scripts/directives/annotation.coffee
View file @
cf39c9dd
...
@@ -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',
'$sc
e', '$sc
ope', 'annotator', 'drafts', 'flash', 'documentHelpers',
($scope, annotator, drafts, flash, documentHelpers) ->
($sc
e, $sc
ope, 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}")
...
...
h/templates/client/annotation.html
View file @
cf39c9dd
...
@@ -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 -- >
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment