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
f84dcc04
Commit
f84dcc04
authored
May 09, 2014
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make flash messages disappear when dismissed
parent
a45b9e69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
27 deletions
+23
-27
flash.coffee
h/js/flash.coffee
+23
-16
services.coffee
h/js/services.coffee
+0
-11
No files found.
h/js/flash.coffee
View file @
f84dcc04
class
Notification
extends
Annotator
.
Notification
@
INFO
:
'info'
@
ERROR
:
'error'
@
SUCCESS
:
'success'
constructor
:
(
options
)
->
element
=
$
(
@
options
.
html
).
hide
()[
0
]
Annotator
.
Delegator
.
call
(
this
,
element
,
options
)
# Retain the fat arrow binding despite skipping the super-class constructor
# XXX: replace with _appendElement override when we move to Annotator v2.
show
:
(
message
,
status
=
Notification
.
INFO
)
=>
super
@
element
.
prependTo
(
document
.
body
).
slideDown
()
hide
:
=>
super
@
element
.
slideUp
=>
@
element
.
remove
()
class
FlashProvider
queues
:
''
:
[]
...
...
@@ -6,24 +26,16 @@ class FlashProvider
success
:
[]
notice
:
null
constructor
:
->
# Configure notification classes
angular
.
extend
Annotator
.
Notification
,
INFO
:
'info'
ERROR
:
'error'
SUCCESS
:
'success'
$get
:
->
angular
.
bind
this
,
this
.
_flash
_process
:
->
for
q
,
msgs
of
@
queues
if
msgs
.
length
msg
=
msgs
.
shift
()
unless
q
then
[
q
,
msg
]
=
msg
notice
=
new
Hypothesis
.
Notification
()
notice
=
new
Notification
()
notice
.
show
(
msg
,
q
)
notice
.
element
.
hide
().
slideDown
()
this
.
_wait
=>
notice
.
element
.
slideUp
->
notice
.
element
.
remove
()
break
_flash
:
(
queue
,
messages
)
->
...
...
@@ -31,11 +43,6 @@ class FlashProvider
@
queues
[
queue
]
=
@
queues
[
queue
]
?
.
concat
messages
this
.
_process
()
$get
:
[
'$timeout'
,
(
$timeout
)
->
this
.
_wait
=
(
cb
)
->
$timeout
cb
,
5000
angular
.
bind
this
,
this
.
_flash
]
flashInterceptor
=
[
'$q'
,
'flash'
,
(
$q
,
flash
)
->
_intercept
=
(
response
)
->
...
...
h/js/services.coffee
View file @
f84dcc04
...
...
@@ -631,17 +631,6 @@ class Hypothesis extends Annotator
return
@
element
.
injector
().
get
(
'drafts'
).
discard
()
class
Hypothesis
.
Notification
extends
Annotator
.
Notification
constructor
:
(
options
)
->
element
=
$
(
@
options
.
html
).
prependTo
(
'body'
)[
0
]
Annotator
.
Delegator
.
call
(
this
,
element
,
options
)
# Retain the fat arrow binding despite skipping the super-class constructor
# XXX: replace with _appendElement override when we move to Annotator v2.
show
:
=>
super
hide
:
=>
super
class
AuthenticationProvider
constructor
:
->
@
actions
=
...
...
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