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
4dbe612d
Commit
4dbe612d
authored
Oct 28, 2014
by
Aron Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check to see if an annotation has multiple titles
Fixes the issue where a document title appears in square brackets.
parent
cbb12b52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
annotation.coffee
h/static/scripts/directives/annotation.coffee
+5
-1
annotation-test.coffee
tests/js/directives/annotation-test.coffee
+6
-0
No files found.
h/static/scripts/directives/annotation.coffee
View file @
4dbe612d
...
...
@@ -187,11 +187,15 @@ AnnotationController = [
break
domain = extractURIComponent(uri, 'hostname')
documentTitle = if Array.isArray(model.document.title)
model.document.title[0]
else
model.document.title
@document =
uri: uri
domain: domain
title:
model.document.t
itle or domain
title:
documentT
itle or domain
if @document.title.length > 30
@document.title = @document.title[0..29] + '…'
...
...
tests/js/directives/annotation-test.coffee
View file @
4dbe612d
...
...
@@ -36,6 +36,12 @@ describe 'h.directives.annotation', ->
$scope
.
$digest
()
assert
.
equal
(
controller
.
document
.
title
,
'A special document'
)
it
'uses the first title when there are more than one'
,
->
annotation
.
document
.
title
=
[
'first title'
,
'second title'
]
controller
=
createController
()
$scope
.
$digest
()
assert
.
equal
(
controller
.
document
.
title
,
'first title'
)
it
'truncates long titles'
,
->
annotation
.
document
.
title
=
'''A very very very long title that really
shouldn't be found on a page on the internet.'''
...
...
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