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
719f2284
Commit
719f2284
authored
Mar 13, 2015
by
Randall Leeds
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2034 from hypothesis/2033-fix-focusing
Fix sidebar's focusing on annotation cards
parents
9020e2d5
abe12c47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
annotation-ui-service.coffee
h/static/scripts/annotation-ui-service.coffee
+2
-2
controllers.coffee
h/static/scripts/controllers.coffee
+1
-1
annotation-ui-service-test.coffee
h/static/scripts/test/annotation-ui-service-test.coffee
+4
-4
No files found.
h/static/scripts/annotation-ui-service.coffee
View file @
719f2284
...
...
@@ -13,7 +13,7 @@ createAnnotationUI = ->
visibleHighlights
:
false
# Contains a map of annotation
id
:true pairs.
# Contains a map of annotation
tag
:true pairs.
focusedAnnotationMap
:
null
# Contains a map of annotation id:true pairs.
...
...
@@ -28,7 +28,7 @@ createAnnotationUI = ->
###
focusAnnotations: (annotations) ->
selection = {}
selection[
id] = true for {id
} in annotations
selection[
$$tag] = true for {$$tag
} in annotations
@focusedAnnotationMap = value(selection)
###
*
...
...
h/static/scripts/controllers.coffee
View file @
719f2284
...
...
@@ -251,7 +251,7 @@ class ViewerController
true
$scope
.
hasFocus
=
(
annotation
)
->
annotation
?
.
$
$tag
in
(
$scope
.
focusedAnnotations
?
[])
!!
(
$scope
.
focusedAnnotations
?
{})[
annotation
?
.
$
$tag
]
angular
.
module
(
'h'
)
.
controller
(
'AppController'
,
AppController
)
...
...
h/static/scripts/test/annotation-ui-service-test.coffee
View file @
719f2284
...
...
@@ -17,25 +17,25 @@ describe 'AnnotationUI', ->
describe
'.focusAnnotations()'
,
->
it
'adds the passed annotations to the focusedAnnotationMap'
,
->
annotationUI
.
focusAnnotations
([{
id
:
1
},
{
id
:
2
},
{
id
:
3
}])
annotationUI
.
focusAnnotations
([{
$
$tag
:
1
},
{
$
$tag
:
2
},
{
$
$tag
:
3
}])
assert
.
deepEqual
(
annotationUI
.
focusedAnnotationMap
,
{
1
:
true
,
2
:
true
,
3
:
true
})
it
'replaces any annotations originally in the map'
,
->
annotationUI
.
focusedAnnotationMap
=
{
1
:
true
}
annotationUI
.
focusAnnotations
([{
id
:
2
},
{
id
:
3
}])
annotationUI
.
focusAnnotations
([{
$
$tag
:
2
},
{
$
$tag
:
3
}])
assert
.
deepEqual
(
annotationUI
.
focusedAnnotationMap
,
{
2
:
true
,
3
:
true
})
it
'does not modify the original map object'
,
->
orig
=
annotationUI
.
focusedAnnotationMap
=
{
1
:
true
}
annotationUI
.
focusAnnotations
([{
id
:
2
},
{
id
:
3
}])
annotationUI
.
focusAnnotations
([{
$
$tag
:
2
},
{
$
$tag
:
3
}])
assert
.
notEqual
(
annotationUI
.
focusedAnnotationMap
,
orig
)
it
'nulls the map if no annotations are focused'
,
->
orig
=
annotationUI
.
focusedAnnotationMap
=
{
1
:
true
}
orig
=
annotationUI
.
focusedAnnotationMap
=
{
$
$tag
:
true
}
annotationUI
.
focusAnnotations
([])
assert
.
isNull
(
annotationUI
.
focusedAnnotationMap
)
...
...
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