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
ac0e853c
Commit
ac0e853c
authored
Jul 22, 2014
by
Randall Leeds
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1320 from hypothesis/427-standalone-app
Turn the standalone page into the app
parents
d7ca3ffa
66348097
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
app.coffee
h/static/scripts/app.coffee
+3
-1
controllers.coffee
h/static/scripts/controllers.coffee
+29
-2
No files found.
h/static/scripts/app.coffee
View file @
ac0e853c
...
...
@@ -5,7 +5,6 @@ imports = [
'h.controllers'
'h.directives'
'h.app_directives'
'h.displayer'
'h.helpers'
'h.flash'
'h.filters'
...
...
@@ -38,6 +37,9 @@ configure = [
$delegate
]
$routeProvider
.
when
'/a/:id'
,
controller
:
'ViewerController'
templateUrl
:
'viewer.html'
$routeProvider
.
when
'/editor'
,
controller
:
'EditorController'
templateUrl
:
'editor.html'
...
...
h/static/scripts/controllers.coffee
View file @
ac0e853c
...
...
@@ -260,6 +260,9 @@ class App
$scope
.
search
.
show
=
not
angular
.
equals
(
$location
.
search
(),
{})
unless
next
.
$
$route
.
originalPath
is
'/stream'
if
current
and
next
.
$
$route
.
originalPath
is
'/a/:id'
$scope
.
reloadAnnotations
()
$scope
.
search
.
update
=
(
searchCollection
)
->
return
unless
annotator
.
discardDrafts
()
return
unless
searchCollection
.
models
.
length
...
...
@@ -284,7 +287,10 @@ class App
query
.
quote
=
query
.
quote
.
concat
(
value
.
split
(
/\s+/
))
unless
angular
.
equals
$location
.
search
(),
query
if
$location
.
path
()
==
'/viewer'
$location
.
path
(
'/page_search'
).
search
(
query
)
else
$location
.
path
(
'/stream'
).
search
(
query
)
$scope
.
search
.
clear
=
->
$location
.
url
(
'/viewer'
)
...
...
@@ -301,6 +307,27 @@ class App
$scope
.
$root
.
annotations
=
[]
$scope
.
store
=
plugins
.
Store
_id
=
$route
.
current
.
params
.
id
_promise
=
null
# Load any initial annotations that should be displayed
if
_id
if
$scope
.
loadAnnotations
# Load annotations from inline page data
plugins
.
Store
.
_onLoadAnnotations
$scope
.
loadAnnotations
delete
$scope
.
loadAnnotations
_promise
=
$scope
.
loadAnnotations
else
# Load annotations from the API
# XXX: Two requests here is less than ideal
_promise
=
plugins
.
Store
.
loadAnnotationsFromSearch
({
_id
})
.
then
->
plugins
.
Store
.
loadAnnotationsFromSearch
({
references
:
_id
})
$q
.
when
_promise
,
->
thread
=
annotator
.
threading
.
getContainer
_id
$scope
.
$root
.
annotations
=
[
thread
.
message
]
return
unless
Store
# XXX: Hacky hacky stuff to ensure that any search requests in-flight
...
...
@@ -346,7 +373,7 @@ class App
annotations
=
(
a
for
a
in
annotations
when
a
not
in
deleted
)
if
annotations
.
length
is
0
annotator
.
unsubscribe
'annotationsLoaded'
,
cleanup
$ro
ute
.
reload
()
$ro
otScope
.
$digest
()
,
10
cleanup
(
a
for
a
in
annotations
when
a
.
thread
)
annotator
.
subscribe
'annotationsLoaded'
,
cleanup
...
...
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