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
f8442789
Commit
f8442789
authored
Oct 27, 2015
by
Robert Knight
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2681 from hypothesis/remove-diff-remnants
Remove the remnants of a once-functional visual diff feature
parents
731bcb3c
680d2579
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
145 deletions
+0
-145
annotation.coffee
h/static/scripts/directive/annotation.coffee
+0
-26
annotation-test.coffee
h/static/scripts/directive/test/annotation-test.coffee
+0
-104
annotations.scss
h/static/styles/annotations.scss
+0
-5
annotation.html
h/templates/client/annotation.html
+0
-10
No files found.
h/static/scripts/directive/annotation.coffee
View file @
f8442789
...
...
@@ -57,8 +57,6 @@ AnnotationController = [
@preview = 'no'
@editing = false
@isSidebar = false
@hasDiff = false
@showDiff = undefined
@timestamp = null
model = $scope.annotationGet()
...
...
@@ -223,19 +221,6 @@ AnnotationController = [
this.render()
this.view()
# Calculates the visual diff flags from the targets
#
# hasDiff is set to true is there are any targets with a difference
# shouldShowDiff is set to true if there are some meaningful differences
# - that is, more than just uppercase / lowercase
diffFromTargets = (targets = []) ->
hasDiff = targets.some (t) ->
t.diffHTML?
shouldShowDiff = hasDiff and targets.some (t) ->
t.diffHTML? and not t.diffCaseOnly
{hasDiff, shouldShowDiff}
# Update the given annotation domain model object with the data from the
# given annotation view model object.
updateDomainModel = (domainModel, viewModel) ->
...
...
@@ -350,17 +335,6 @@ AnnotationController = [
# Form the tags for ngTagsInput.
@annotation.tags = ({text} for text in (model.tags or []))
# Calculate the visual diff flags
diffFlags = diffFromTargets(@annotation.target)
@hasDiff = diffFlags.hasDiff
if @hasDiff
# We don't want to override the showDiff value manually changed
# by the user, that's why we use a conditional assignment here,
# instead of directly setting showDiff to the calculated value
@showDiff ?= diffFlags.shouldShowDiff
else
@showDiff = undefined
updateTimestamp = (repeat=false) =>
@timestamp = time.toFuzzyString model.updated
fuzzyUpdate = time.nextFuzzyUpdate model.updated
...
...
h/static/scripts/directive/test/annotation-test.coffee
View file @
f8442789
...
...
@@ -340,110 +340,6 @@ describe 'annotation', ->
controller
.
render
()
assert
(
controller
.
document
.
title
==
'example.com'
)
describe
'when there are no targets'
,
->
beforeEach
->
annotation
.
target
=
[]
controller
.
render
()
targets
=
controller
.
annotation
.
target
it
'sets `hasDiff` to false and `showDiff` to undefined'
,
->
controller
.
render
()
assert
.
isFalse
(
controller
.
hasDiff
)
assert
.
isUndefined
(
controller
.
showDiff
)
describe
'when a single target has text identical to what was in the selectors'
,
->
it
'sets `showDiff` to undefined and `hasDiff` to false'
,
->
controller
.
render
()
assert
.
isFalse
(
controller
.
hasDiff
)
assert
.
isUndefined
(
controller
.
showDiff
)
describe
'when a single target has different text, compared to what was in the selector'
,
->
targets
=
null
beforeEach
->
annotation
.
target
=
[
{
diffHTML
:
"This is <ins>not</ins> the same quote"
,
diffCaseOnly
:
false
},
]
controller
.
render
()
targets
=
controller
.
annotation
.
target
it
'sets both `hasDiff` and `showDiff` to true'
,
->
controller
.
render
()
assert
.
isTrue
(
controller
.
hasDiff
)
assert
.
isTrue
(
controller
.
showDiff
)
describe
'when there are only upper case/lower case difference between the text in the single target, and what was saved in a selector'
,
->
targets
=
null
beforeEach
->
annotation
.
target
=
[
{
diffHTML
:
"<ins>s</ins><del>S</del>tuff"
,
diffCaseOnly
:
true
},
]
controller
.
render
()
targets
=
controller
.
annotation
.
target
it
'sets `hasDiff` to true and `showDiff` to false'
,
->
controller
.
render
()
assert
.
isTrue
(
controller
.
hasDiff
)
assert
.
isFalse
(
controller
.
showDiff
)
describe
'when there are multiple targets, some with differences in text'
,
->
targets
=
null
beforeEach
->
annotation
.
target
=
[
{
otherProperty
:
'bar'
},
{
diffHTML
:
"This is <ins>not</ins> the same quote"
,
diffCaseOnly
:
false
},
{
diffHTML
:
"<ins>s</ins><del>S</del>tuff"
,
diffCaseOnly
:
true
},
]
controller
.
render
()
targets
=
controller
.
annotation
.
target
it
'sets `hasDiff` to true'
,
->
assert
.
isTrue
(
controller
.
hasDiff
)
it
'sets `showDiff` to true'
,
->
assert
.
isTrue
(
controller
.
showDiff
)
it
'preserves the `showDiff` value on update'
,
->
controller
.
showDiff
=
false
annotation
.
target
=
annotation
.
target
.
slice
(
1
)
controller
.
render
()
assert
.
isFalse
(
controller
.
showDiff
)
it
'unsets `hasDiff` if differences go away'
,
->
annotation
.
target
=
annotation
.
target
.
splice
(
0
,
1
)
controller
.
render
()
assert
.
isFalse
(
controller
.
hasDiff
)
describe
'when there are multiple targets, some with differences, but only upper case / lower case'
,
->
targets
=
null
beforeEach
->
annotation
.
target
=
[
{
otherProperty
:
'bar'
},
{
diffHTML
:
"<ins>s</ins><del>S</del>tuff"
,
diffCaseOnly
:
true
},
]
controller
.
render
()
targets
=
controller
.
annotation
.
target
it
'sets `hasDiff` to true'
,
->
assert
.
isTrue
(
controller
.
hasDiff
)
it
'sets `showDiff` to false'
,
->
assert
.
isFalse
(
controller
.
showDiff
)
it
'preserves the `showDiff` value on update'
,
->
controller
.
showDiff
=
true
annotation
.
target
=
annotation
.
target
.
slice
(
1
)
controller
.
render
()
assert
.
isTrue
(
controller
.
showDiff
)
it
'unsets `hasDiff` if differences go away'
,
->
annotation
.
target
=
annotation
.
target
.
splice
(
0
,
1
)
controller
.
render
()
assert
.
isFalse
(
controller
.
hasDiff
)
describe
'timestamp'
,
->
clock
=
null
...
...
h/static/styles/annotations.scss
View file @
f8442789
...
...
@@ -122,11 +122,6 @@
}
}
.show-differences
{
border-left
:
3px
solid
#D3D3D3
;
padding
:
0
.3em
0
.615em
;
}
//PRIVACY CONTROL////////////////////////////
privacy
{
...
...
h/templates/client/annotation.html
View file @
f8442789
...
...
@@ -58,21 +58,11 @@
ng-repeat=
"target in vm.annotation.target track by $index"
>
<excerpt
enabled=
"feature('truncate_annotations')"
>
<blockquote
class=
"annotation-quote"
ng-hide=
"target.diffHTML && vm.showDiff"
ng-bind-html=
"selector.exact"
ng-repeat=
"selector in target.selector
| filter : {'type': 'TextQuoteSelector'}
track by $index"
></blockquote>
</excerpt>
<blockquote
class=
"annotation-quote"
ng-bind-html=
"target.diffHTML"
ng-show=
"target.diffHTML && vm.showDiff"
></blockquote>
<div
class=
"small show-differences"
ng-show=
"vm.hasDiff"
>
<input
type=
"checkbox"
ng-model=
"vm.showDiff"
ng-click=
"$event.stopPropagation()"
>
Show differences
</input>
</div>
</section>
<!-- / 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