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
4d8f1c77
Commit
4d8f1c77
authored
Jan 07, 2013
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client-side flash message implementation
closes #233
parent
075ad159
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
25 deletions
+89
-25
app.scss
h/css/app.scss
+0
-18
common.scss
h/css/common.scss
+39
-0
controllers.coffee
h/js/controllers.coffee
+11
-7
services.coffee
h/js/services.coffee
+39
-0
No files found.
h/css/app.scss
View file @
4d8f1c77
...
...
@@ -204,24 +204,6 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
}
}
.info
{
color
:
#3a87ad
;
background-color
:
#d9edf7
;
border-color
:
#98BED1
;
}
.good
{
color
:
#468847
;
background-color
:
#dff0d8
;
border-color
:
#8DC98E
;
}
.bad
{
color
:
#b94a48
;
background-color
:
#f2dede
;
border-color
:
#F5A1A0
;
}
.nav-tabs
{
padding-left
:
1
.3em
;
}
...
...
h/css/common.scss
View file @
4d8f1c77
...
...
@@ -119,6 +119,45 @@ button, input[type=submit], .btn {
}
//FLASH/TOAST/ALERTS///////////////////////////////
.toast
,
.annotator-notice
{
@include
border-radius
(
.5em
);
@include
smallshadow
;
@include
single-transition
(
opacity
,
.2s
);
left
:
50%
;
margin-left
:
-15%
;
opacity
:
0
;
pointer-events
:
none
;
position
:
fixed
;
text-align
:
center
;
top
:
.25em
;
width
:
30%
;
z-index
:
2000
;
&
.show
,
&
.annotator-notice-show
{
opacity
:
1
;
pointer-events
:
initial
;
}
}
.info
,
.annotator-notice-info
{
color
:
#3a87ad
;
background-color
:
#d9edf7
;
border-color
:
#98BED1
;
}
.success
,
.annotator-notice-success
{
color
:
#468847
;
background-color
:
#dff0d8
;
border-color
:
#8DC98E
;
}
.error
,
.annotator-notice-error
{
color
:
#b94a48
;
background-color
:
#f2dede
;
border-color
:
#F5A1A0
;
}
//CLOSER////////////////////////////////
.close
{
...
...
h/js/controllers.coffee
View file @
4d8f1c77
...
...
@@ -9,11 +9,11 @@ class App
this
.
$inject
=
[
'$compile'
,
'$element'
,
'$http'
,
'$location'
,
'$scope'
,
'annotator'
,
'threading'
'annotator'
,
'
flash'
,
'
threading'
]
constructor
:
(
$compile
,
$element
,
$http
,
$location
,
$scope
,
annotator
,
threading
annotator
,
flash
,
threading
)
->
$scope
.
reset
=
=>
angular
.
extend
$scope
,
@
scope
...
...
@@ -131,9 +131,9 @@ class App
'Content-Type'
:
'application/x-www-form-urlencoded'
withCredentials
:
true
.
success
(
data
)
=>
# Extend the scope with updated model data
angular
.
extend
(
$scope
,
data
.
model
)
if
data
.
model
?
# TODO: flash data.error server messages
if
data
.
model
?
then
angular
.
extend
(
$scope
,
data
.
model
)
if
data
.
flash
?
then
flash
q
,
msgs
for
q
,
msgs
of
data
.
flash
if
data
.
status
is
'failure'
then
flash
'error'
,
data
.
reason
$scope
.
toggleShow
=
->
if
annotator
.
visible
...
...
@@ -158,7 +158,10 @@ class App
if
oldValue
?
and
not
newValue
?
$http
.
post
'logout'
,
''
,
withCredentials
:
true
.
success
(
data
)
=>
$scope
.
reset
()
.
success
(
data
)
=>
$scope
.
reset
()
if
data
.
model
?
then
angular
.
extend
(
$scope
,
data
.
model
)
if
data
.
flash
?
then
flash
q
,
msgs
for
q
,
msgs
of
data
.
flash
$scope
.
$watch
'token'
,
(
newValue
,
oldValue
)
=>
if
plugins
.
Auth
?
...
...
@@ -186,7 +189,8 @@ class App
$http
.
get
''
,
withCredentials
:
true
.
success
(
data
)
=>
angular
.
extend
$scope
,
data
.
model
if
data
.
model
?
then
angular
.
extend
$scope
,
data
.
model
if
data
.
flash
?
then
flash
q
,
msgs
for
q
,
msgs
of
data
.
flash
$scope
.
$evalAsync
'reset()'
...
...
h/js/services.coffee
View file @
4d8f1c77
...
...
@@ -377,6 +377,45 @@ class Hypothesis extends Annotator
annotation
.
id
class
FlashProvider
queues
:
info
:
[]
error
:
[]
success
:
[]
notice
:
null
timeout
:
null
constructor
:
->
# Configure notification classes
angular
.
extend
Annotator
.
Notification
,
INFO
:
'info'
ERROR
:
'error'
SUCCESS
:
'success'
_process
:
->
@
timeout
=
null
for
q
,
msgs
of
@
queues
if
msgs
.
length
notice
=
Annotator
.
showNotification
msgs
.
shift
(),
q
@
timeout
=
this
.
_wait
=>
# work around Annotator.Notification not removing classes
for
_
,
klass
of
notice
.
options
.
classes
notice
.
element
.
removeClass
klass
this
.
_process
()
break
$get
:
[
'$timeout'
,
'annotator'
,
(
$timeout
,
annotator
)
->
this
.
_wait
=
(
cb
)
->
$timeout
cb
,
5000
angular
.
bind
this
,
this
.
_flash
]
_flash
:
(
queue
,
messages
)
->
if
@
queues
[
queue
]
?
@
queues
[
queue
]
=
@
queues
[
queue
]
?
.
concat
messages
this
.
_process
()
unless
@
timeout
?
angular
.
module
(
'h.services'
,
[])
.
provider
(
'flash'
,
FlashProvider
)
.
service
(
'annotator'
,
Hypothesis
)
.
value
(
'threading'
,
mail
.
messageThread
())
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