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
2f70cd60
Commit
2f70cd60
authored
May 17, 2012
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
editor scaffolding
parent
01e84648
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
9 deletions
+37
-9
hypothesis.coffee
hypothesis/js/src/hypothesis.coffee
+37
-9
No files found.
hypothesis/js/src/hypothesis.coffee
View file @
2f70cd60
...
...
@@ -27,16 +27,13 @@ class Hypothesis extends Annotator
# Set up interface elements
this
.
_setupHeatmap
().
_setupSidebar
()
@
heatmap
.
element
.
prependTo
(
@
sidebar
)
@
heatmap
.
element
.
appendTo
(
@
sidebar
)
@
viewer
.
element
.
appendTo
(
@
sidebar
)
@
editor
.
element
.
appendTo
(
@
sidebar
)
@
sidebar
.
prependTo
(
@
wrapper
)
#
# Interface patching. Nasty nasty. We should make this easier.
#
# Pull the viewer and editor into the sidebar, instead of the wrapper
@
viewer
.
element
.
detach
().
appendTo
(
@
sidebar
)
@
editor
.
element
.
detach
().
appendTo
(
@
sidebar
)
@
plugins
.
Auth
.
withToken
(
token
)
=>
@
plugins
.
Permissions
.
setUser
token
.
userId
this
...
...
@@ -64,6 +61,18 @@ class Hypothesis extends Annotator
$
(
document
.
documentElement
).
addClass
(
'hyp-collapse'
)
@
sidebar
.
removeClass
(
'collapse'
)
showEditor
:
(
annotation
)
=>
if
@
plugins
.
Permissions
?
.
user
annotation
[
'user'
]
=
@
plugins
.
Permissions
.
user
@
editor
.
element
.
find
(
'.annotator-listing'
).
replaceWith
(
Handlebars
.
templates
[
'editor'
](
annotation
)
)
@
editor
.
load
(
annotation
)
$
(
document
.
documentElement
).
addClass
(
'hyp-collapse'
)
@
sidebar
.
removeClass
(
'collapse'
)
else
alert
(
"Not logged in!"
)
# Sets up the selection event listeners to watch mouse actions on the document.
#
# Returns itself for chaining.
...
...
@@ -108,5 +117,24 @@ class Hypothesis extends Annotator
$
(
field
).
html
(
"<i>
#{
_t
'No Comment'
}
</i>"
)
this
.
publish
(
'annotationViewerTextField'
,
[
field
,
annotation
])
})
.
element
.
appendTo
(
@
wrapper
)
this
# Creates an instance of the Annotator.Editor and assigns it to @editor.
# Appends this to the @wrapper and sets up event listeners.
#
# Returns itself for chaining.
_setupEditor
:
->
@
editor
=
new
Annotator
.
Editor
()
@
editor
.
hide
()
.
on
(
'hide'
,
this
.
onEditorHide
)
.
on
(
'save'
,
this
.
onEditorSubmit
)
.
addField
({
type
:
'textarea'
,
label
:
_t
(
'Comments'
)
+
'
\u
2026'
load
:
(
field
,
annotation
)
->
$
(
field
).
find
(
'textarea'
).
val
(
annotation
.
text
||
''
)
submit
:
(
field
,
annotation
)
->
annotation
.
text
=
$
(
field
).
find
(
'textarea'
).
val
()
})
this
\ No newline at end of file
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