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
65ba2482
Commit
65ba2482
authored
Jan 19, 2015
by
Aron Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove annotator dependency from controllers
parent
997d177f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
37 deletions
+35
-37
controllers.coffee
h/static/scripts/controllers.coffee
+31
-33
streamsearch.coffee
h/static/scripts/streamsearch.coffee
+4
-4
No files found.
h/static/scripts/controllers.coffee
View file @
65ba2482
...
...
@@ -54,18 +54,17 @@ class UISyncController
class
AppController
this
.
$inject
=
[
'$document'
,
'$location'
,
'$route'
,
'$scope'
,
'$window'
,
'annotator'
,
'auth'
,
'drafts'
,
'identity'
,
'permissions'
,
'streamer'
,
'streamfilter'
'$document'
,
'$location'
,
'$route'
,
'$scope'
,
'$window'
,
'$rootScope'
,
'auth'
,
'documentHelpers'
,
'drafts'
,
'identity'
,
'permissions'
,
'streamer'
,
'streamfilter'
,
'crossFrameUI'
,
'annotationLoader'
,
'threading'
]
constructor
:
(
$document
,
$location
,
$route
,
$scope
,
$window
,
a
nnotator
,
auth
,
drafts
,
identity
,
permissions
,
streamer
,
streamfilter
,
$document
,
$location
,
$route
,
$scope
,
$window
,
$rootScope
,
a
uth
,
documentHelpers
,
drafts
,
identity
,
permissions
,
streamer
,
streamfilter
,
crossFrameUI
,
annotationLoader
,
threading
)
->
{
plugins
,
host
,
providers
}
=
annotator
$scope
.
auth
=
auth
isFirstRun
=
$location
.
search
().
hasOwnProperty
(
'firstrun'
)
...
...
@@ -78,10 +77,10 @@ class AppController
return
unless
data
?
.
length
switch
action
when
'create'
,
'update'
,
'past'
annotat
o
r
.
loadAnnotations
data
annotat
ionLoade
r
.
loadAnnotations
data
when
'delete'
for
annotation
in
data
annotator
.
publish
'annotationDeleted'
,
(
annotation
)
$rootScope
.
$emit
(
'annotationDeleted'
,
annotation
)
streamer
.
onmessage
=
(
data
)
->
return
if
!
data
or
data
.
type
!=
'annotation-notification'
...
...
@@ -97,12 +96,12 @@ class AppController
# Clean up any annotations that need to be unloaded.
for
id
,
container
of
$scope
.
threading
.
idTable
when
container
.
message
# Remove annotations not belonging to this user when highlighting.
if
annotator
.
tool
is
'highlight'
and
annotation
.
user
!=
auth
.
user
annotator
.
publish
'annotationDeleted'
,
container
.
message
if
crossFrameUI
.
tool
is
'highlight'
and
annotation
.
user
!=
auth
.
user
$rootScope
.
$emit
(
'annotationDeleted'
,
container
.
message
)
drafts
.
remove
annotation
# Remove annotations the user is not authorized to view.
else
if
not
permissions
.
permits
'read'
,
container
.
message
,
auth
.
user
annotator
.
publish
'annotationDeleted'
,
container
.
message
$rootScope
.
$emit
(
'annotationDeleted'
,
container
.
message
)
drafts
.
remove
container
.
message
$scope
.
$watch
'sort.name'
,
(
name
)
->
...
...
@@ -123,7 +122,7 @@ class AppController
# Update any edits in progress.
for
draft
in
drafts
.
all
()
annotator
.
publish
'beforeAnnotationCreated'
,
draft
$rootScope
.
$emit
(
'beforeAnnotationCreated'
,
draft
)
# Reopen the streamer.
streamer
.
close
()
...
...
@@ -167,18 +166,18 @@ class AppController
delete
$scope
.
selectedAnnotationsCount
$scope
.
sort
=
name
:
'Location'
$scope
.
threading
=
plugins
.
T
hreading
$scope
.
threading
=
t
hreading
$scope
.
threadRoot
=
$scope
.
threading
?
.
root
class
AnnotationViewerController
this
.
$inject
=
[
'$location'
,
'$routeParams'
,
'$scope'
,
'
annotator'
,
'streamer'
,
'store'
,
'streamfilt
er'
'
streamer'
,
'store'
,
'streamfilter'
,
'annotationLoad
er'
]
constructor
:
(
$location
,
$routeParams
,
$scope
,
annotator
,
streamer
,
store
,
streamfilt
er
streamer
,
store
,
streamfilter
,
annotationLoad
er
)
->
# Tells the view that these annotations are standalone
$scope
.
isEmbedded
=
false
...
...
@@ -195,11 +194,10 @@ class AnnotationViewerController
id
=
$routeParams
.
id
store
.
SearchResource
.
get
_id
:
id
,
({
rows
})
->
annotat
o
r
.
loadAnnotations
(
rows
)
annotat
ionLoade
r
.
loadAnnotations
(
rows
)
$scope
.
threadRoot
=
children
:
[
$scope
.
threading
.
getContainer
(
id
)]
store
.
SearchResource
.
get
references
:
id
,
({
rows
})
->
annotat
o
r
.
loadAnnotations
(
rows
)
annotat
ionLoade
r
.
loadAnnotations
(
rows
)
streamfilter
.
setMatchPolicyIncludeAny
()
...
...
@@ -210,12 +208,12 @@ class AnnotationViewerController
class
ViewerController
this
.
$inject
=
[
'$scope'
,
'$route'
,
'a
nnotator'
,
'a
uth'
,
'flash'
,
'streamer'
,
'streamfilter'
,
'store'
'$scope'
,
'$route'
,
'crossFrameUI'
,
'annotationLoader'
,
'auth'
,
'flash'
,
'streamer'
,
'streamfilter'
,
'store'
]
constructor
:
(
$scope
,
$route
,
a
nnotator
,
a
uth
,
flash
,
streamer
,
streamfilter
,
store
$scope
,
$route
,
crossFrameUI
,
annotationLoader
,
auth
,
flash
,
streamer
,
streamfilter
,
store
)
->
# Tells the view that these annotations are embedded into the owner doc
$scope
.
isEmbedded
=
true
...
...
@@ -225,42 +223,42 @@ class ViewerController
loadAnnotations
=
->
query
=
limit
:
200
if
annotator
.
tool
is
'highlight'
if
crossFrameUI
.
tool
is
'highlight'
return
unless
auth
.
user
query
.
user
=
auth
.
user
for
p
in
annotator
.
providers
for
p
in
crossFrameUI
.
providers
for
e
in
p
.
entities
when
e
not
in
loaded
loaded
.
push
e
store
.
SearchResource
.
get
angular
.
extend
(
uri
:
e
,
query
),
(
results
)
->
annotat
o
r
.
loadAnnotations
(
results
.
rows
)
annotat
ionLoade
r
.
loadAnnotations
(
results
.
rows
)
streamfilter
.
resetFilter
().
addClause
(
'/uri'
,
'one_of'
,
loaded
)
if
auth
.
user
and
annotator
.
tool
is
'highlight'
if
auth
.
user
and
crossFrameUI
.
tool
is
'highlight'
streamfilter
.
addClause
(
'/user'
,
auth
.
user
)
streamer
.
send
({
filter
:
streamfilter
.
getFilter
()})
$scope
.
$watch
(
->
annotator
.
tool
),
(
newVal
,
oldVal
)
->
$scope
.
$watch
(
->
crossFrameUI
.
tool
),
(
newVal
,
oldVal
)
->
return
if
newVal
is
oldVal
$route
.
reload
()
$scope
.
$watchCollection
(
->
annotator
.
providers
),
loadAnnotations
$scope
.
$watchCollection
(
->
crossFrameUI
.
providers
),
loadAnnotations
$scope
.
focus
=
(
annotation
)
->
if
angular
.
isObject
annotation
highlights
=
[
annotation
.
$
$tag
]
else
highlights
=
[]
for
p
in
annotator
.
providers
for
p
in
crossFrameUI
.
providers
p
.
channel
.
notify
method
:
'focusAnnotations'
params
:
highlights
$scope
.
scrollTo
=
(
annotation
)
->
if
angular
.
isObject
annotation
for
p
in
annotator
.
providers
for
p
in
crossFrameUI
.
providers
p
.
channel
.
notify
method
:
'scrollToAnnotation'
params
:
annotation
.
$
$tag
...
...
h/static/scripts/streamsearch.coffee
View file @
65ba2482
class
StreamSearchController
this
.
inject
=
[
'$scope'
,
'$rootScope'
,
'$routeParams'
,
'a
nnotator'
,
'a
uth'
,
'queryparser'
,
'searchfilter'
,
'store'
,
'streamer'
,
'streamfilter'
'auth'
,
'queryparser'
,
'searchfilter'
,
'store'
,
'streamer'
,
'streamfilter'
,
'annotationLoader'
]
constructor
:
(
$scope
,
$rootScope
,
$routeParams
a
nnotator
,
a
uth
,
queryparser
,
searchfilter
,
store
,
streamer
,
streamfilter
auth
,
queryparser
,
searchfilter
,
store
,
streamer
,
streamfilter
,
annotationLoader
)
->
# Initialize the base filter
streamfilter
...
...
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