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
d4330992
Commit
d4330992
authored
Jul 20, 2015
by
Jake Hartnell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't via via
Fixes #2371 Adds test.
parent
797bf070
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
share-dialog.coffee
h/static/scripts/directive/share-dialog.coffee
+6
-2
share-dialog-test.coffee
h/static/scripts/directive/test/share-dialog-test.coffee
+7
-0
No files found.
h/static/scripts/directive/share-dialog.coffee
View file @
d4330992
...
@@ -18,7 +18,11 @@ module.exports = ['crossframe', (crossframe) ->
...
@@ -18,7 +18,11 @@ module.exports = ['crossframe', (crossframe) ->
scope
.
$watchCollection
(
->
crossframe
.
frames
),
(
frames
)
->
scope
.
$watchCollection
(
->
crossframe
.
frames
),
(
frames
)
->
if
not
frames
.
length
if
not
frames
.
length
return
return
# XXX: Consider sharing multiple frames in the future?
# Check to see if we are on a via page. If so, we just return the URI.
re
=
/https:\/\/via\.hypothes\.is/
if
re
.
test
(
frames
[
0
].
uri
)
scope
.
viaPageLink
=
frames
[
0
].
uri
else
scope
.
viaPageLink
=
'https://via.hypothes.is/'
+
frames
[
0
].
uri
scope
.
viaPageLink
=
'https://via.hypothes.is/'
+
frames
[
0
].
uri
restrict
:
'A'
restrict
:
'A'
...
...
h/static/scripts/directive/test/share-dialog-test.coffee
View file @
d4330992
...
@@ -30,3 +30,10 @@ describe 'share-dialog', ->
...
@@ -30,3 +30,10 @@ describe 'share-dialog', ->
$scope
.
$digest
()
$scope
.
$digest
()
assert
.
equal
(
$scope
.
viaPageLink
,
assert
.
equal
(
$scope
.
viaPageLink
,
'https://via.hypothes.is/http://example.com'
)
'https://via.hypothes.is/http://example.com'
)
it
'does not generate new via link if already on via'
,
->
$element
=
$compile
(
'<div share-dialog="">'
)(
$scope
)
fakeCrossFrame
.
frames
.
push
({
uri
:
[
'https://via.hypothes.is/http://example.com'
]})
$scope
.
$digest
()
assert
.
equal
(
$scope
.
viaPageLink
,
'https://via.hypothes.is/http://example.com'
)
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