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
30cbdbf1
Commit
30cbdbf1
authored
Dec 02, 2014
by
Randall Leeds
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1710 from hypothesis/1673-focus-share-link
Focus share link when pop-up opens
parents
f42bf08e
3485febd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
annotation.coffee
h/static/scripts/directives/annotation.coffee
+8
-2
annotation.html
h/templates/client/annotation.html
+1
-1
annotation-test.coffee
tests/js/directives/annotation-test.coffee
+26
-1
No files found.
h/static/scripts/directives/annotation.coffee
View file @
30cbdbf1
...
...
@@ -302,8 +302,8 @@ AnnotationController = [
# an embedded widget.
###
annotation
=
[
'annotator'
,
(
annotator
)
->
'
$document'
,
'
annotator'
,
(
$document
,
annotator
)
->
linkFn
=
(
scope
,
elem
,
attrs
,
[
ctrl
,
thread
,
threadFilter
,
counter
])
->
# Helper function to remove the temporary thread created for a new reply.
prune
=
(
message
)
->
...
...
@@ -327,6 +327,12 @@ annotation = [
scope
.
$evalAsync
->
ctrl
.
save
()
scope
.
share
=
(
event
)
->
scope
.
$evalAsync
->
$container
=
angular
.
element
(
event
.
target
).
parent
()
$container
.
addClass
(
'open'
).
find
(
'input'
).
focus
().
select
()
$document
.
one
(
'click'
,
(
event
)
->
$container
.
removeClass
(
'open'
))
# Keep track of edits going on in the thread.
if
counter
?
# Expand the thread if descendants are editing.
...
...
h/templates/client/annotation.html
View file @
30cbdbf1
...
...
@@ -117,7 +117,7 @@
ng-click=
"vm.reply()"
><i
class=
"h-icon-reply"
></i>
Reply
</a>
<span
class=
"magicontrol share-dialog-wrapper"
>
<a
class=
"small
dropdown-toggle"
href=
""
title=
"Share
"
<a
class=
"small
"
href=
""
title=
"Share"
ng-click=
"share($event)
"
><i
class=
"h-icon-export"
></i>
Share
</a>
<span
class=
"share-dialog"
ng-click=
"$event.stopPropagation()"
>
<a
class=
"h-icon-export"
...
...
tests/js/directives/annotation-test.coffee
View file @
30cbdbf1
...
...
@@ -2,6 +2,8 @@ assert = chai.assert
sandbox
=
sinon
.
sandbox
.
create
()
describe
'h.directives.annotation'
,
->
$compile
=
null
$document
=
null
$scope
=
null
$timeout
=
null
annotator
=
null
...
...
@@ -10,8 +12,11 @@ describe 'h.directives.annotation', ->
flash
=
null
beforeEach
module
(
'h'
)
beforeEach
module
(
'h.templates'
)
beforeEach
inject
(
$controller
,
$rootScope
,
_$timeout_
)
->
beforeEach
inject
(
_$compile_
,
$controller
,
_$document_
,
$rootScope
,
_$timeout_
)
->
$compile
=
_$compile_
$document
=
_$document_
$timeout
=
_$timeout_
$scope
=
$rootScope
.
$new
()
$scope
.
annotationGet
=
(
locals
)
->
annotation
...
...
@@ -262,3 +267,23 @@ describe 'h.directives.annotation', ->
$scope
.
$destroy
()
$timeout
.
flush
()
$timeout
.
verifyNoPendingTasks
()
describe
'share'
,
->
$element
=
null
$isolateScope
=
null
dialog
=
null
beforeEach
->
template
=
'<div annotation="annotation">'
$scope
.
annotation
=
annotation
$element
=
$compile
(
template
)(
$scope
)
$scope
.
$digest
()
$isolateScope
=
$element
.
isolateScope
()
dialog
=
$element
.
find
(
'.share-dialog-wrapper'
)
it
'sets and unsets the open class on the share wrapper'
,
->
$element
.
find
(
'a'
).
filter
(
->
this
.
title
==
'Share'
).
click
()
$isolateScope
.
$digest
()
assert
.
ok
(
dialog
.
hasClass
(
'open'
))
$document
.
click
()
assert
.
notOk
(
dialog
.
hasClass
(
'open'
))
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