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
9b87cd8e
Commit
9b87cd8e
authored
Jul 01, 2014
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code clarity through local variables
parent
529b5f53
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
controllers.coffee
h/js/controllers.coffee
+17
-18
No files found.
h/js/controllers.coffee
View file @
9b87cd8e
...
...
@@ -199,7 +199,7 @@ class App
when
'Comments'
for
p
in
providers
p
.
channel
.
notify
method
:
'setDynamicBucketMode'
,
params
:
false
annotations
=
annotator
.
plugins
.
Store
.
annotations
annotations
=
plugins
.
Store
?
.
annotations
comments
=
annotations
.
filter
(
a
)
->
annotator
.
isComment
(
a
)
$rootScope
.
annotations
=
comments
...
...
@@ -273,12 +273,12 @@ class App
$scope
.
reloadAnnotations
=
->
$rootScope
.
applyView
"Document"
return
unless
annotator
.
plugins
.
Store
return
unless
plugins
.
Store
$scope
.
$root
.
annotations
=
[]
annotator
.
threading
.
thread
[]
annotator
.
threading
.
idTable
=
{}
Store
=
annotator
.
plugins
.
Store
Store
=
plugins
.
Store
annotations
=
Store
.
annotations
.
slice
()
# XXX: Hacky hacky stuff to ensure that any search requests in-flight
...
...
@@ -297,7 +297,7 @@ class App
# * Make the update function into a noop.
Store
.
updateAnnotation
=
angular
.
noop
# * Remove the plugin and re-add it to the annotator.
delete
annotator
.
plugins
.
Store
delete
plugins
.
Store
annotator
.
addPlugin
'Store'
,
annotator
.
options
.
Store
# Even though most operations on the old Store are now noops the Annotator
...
...
@@ -321,7 +321,7 @@ class App
annotator
.
deleteAnnotation
(
l
)
deleted
.
push
l
if
existing
annotator
.
plugins
.
Threading
.
thread
existing
plugins
.
Threading
.
thread
existing
annotations
=
(
a
for
a
in
annotations
when
a
not
in
deleted
)
if
annotations
.
length
is
0
annotator
.
unsubscribe
'annotationsLoaded'
,
cleanup
...
...
@@ -342,7 +342,7 @@ class App
streamfilter
.
setPastDataNone
()
.
setMatchPolicyIncludeAny
()
.
addClause
(
'/uri'
,
'one_of'
,
Object
.
keys
(
annotator
.
plugins
.
Store
.
entities
))
.
addClause
(
'/uri'
,
'one_of'
,
Object
.
keys
(
plugins
.
Store
.
entities
))
.
getFilter
()
$scope
.
updater
=
socket
()
...
...
@@ -379,8 +379,8 @@ class App
if
container
?
.
message
?
container
.
message
.
_updatedAnnotation
=
true
# Temporary workarund to force publish changes
if
annotator
.
plugins
.
Store
?
annotator
.
plugins
.
Store
.
_onLoadAnnotations
[
container
.
message
]
if
plugins
.
Store
?
plugins
.
Store
.
_onLoadAnnotations
[
container
.
message
]
else
annotation
.
_updatedAnnotation
=
true
...
...
@@ -390,13 +390,13 @@ class App
# XXX: Temporary workaround until solving the race condition for annotationsLoaded event
# Between threading and bridge plugins
for
annotation
in
data
annotator
.
plugins
.
Threading
.
thread
annotation
plugins
.
Threading
.
thread
annotation
$scope
.
markAnnotationUpdate
data
$scope
.
$apply
=>
if
annotator
.
plugins
.
Store
?
annotator
.
plugins
.
Store
.
_onLoadAnnotations
data
if
plugins
.
Store
?
plugins
.
Store
.
_onLoadAnnotations
data
# XXX: Ugly workaround to update the scope content
switch
$rootScope
.
viewState
.
view
when
'Document'
...
...
@@ -407,7 +407,7 @@ class App
$rootScope
.
annotations
.
push
annotation
when
'update'
$scope
.
markAnnotationUpdate
data
annotator
.
plugins
.
Store
.
_onLoadAnnotations
data
plugins
.
Store
.
_onLoadAnnotations
data
when
'delete'
$scope
.
markAnnotationUpdate
data
for
annotation
in
data
...
...
@@ -415,8 +415,8 @@ class App
if
container
.
message
# XXX: This is a temporary workaround until real client-side only
# XXX: delete will be introduced
index
=
annotator
.
plugins
.
Store
.
annotations
.
indexOf
container
.
message
annotator
.
plugins
.
Store
.
annotations
[
index
..
index
]
=
[]
if
index
>
-
1
index
=
plugins
.
Store
.
annotations
.
indexOf
container
.
message
plugins
.
Store
.
annotations
[
index
..
index
]
=
[]
if
index
>
-
1
annotator
.
deleteAnnotation
container
.
message
# Finally blink the changed tabs
...
...
@@ -445,7 +445,7 @@ class Annotation
$window
,
annotator
,
baseURI
,
drafts
)
->
threading
=
annotator
.
threading
{
plugins
,
threading
}
=
annotator
$scope
.
action
=
'create'
$scope
.
editing
=
false
...
...
@@ -509,7 +509,7 @@ class Annotation
$scope
.
reply
=
(
$event
)
->
$event
?
.
stopPropagation
()
unless
annotator
.
plugins
.
Auth
?
and
annotator
.
plugins
.
Auth
.
haveValidToken
()
unless
plugins
.
Auth
?
and
plugins
.
Auth
.
haveValidToken
()
$window
.
alert
"In order to reply, you need to sign in."
return
...
...
@@ -548,8 +548,7 @@ class Annotation
if
$scope
.
form
.
privacy
.
$viewValue
is
'Private'
and
replies
#Cascade delete its children
for
reply
in
$scope
.
thread
.
flattenChildren
()
if
annotator
.
plugins
?
.
Permissions
?
and
annotator
.
plugins
.
Permissions
.
authorize
'delete'
,
reply
if
plugins
?
.
Permissions
?
.
authorize
'delete'
,
reply
annotator
.
deleteAnnotation
reply
annotator
.
deleteAnnotation
$scope
.
model
...
...
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