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
9008013c
Commit
9008013c
authored
Sep 25, 2013
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wire update notifications into the new toolbar
Closes #779
parent
51cd14ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
25 deletions
+46
-25
inject.scss
h/css/inject.scss
+10
-0
sidebar.scss
h/css/sidebar.scss
+0
-17
controllers.coffee
h/js/controllers.coffee
+4
-5
host.coffee
h/js/host.coffee
+4
-0
toolbar.coffee
h/js/plugin/toolbar.coffee
+28
-3
No files found.
h/css/inject.scss
View file @
9008013c
...
...
@@ -357,6 +357,16 @@ $baseFontSize: 14px;
}
// Toolbar notification counter
.annotator-notification-counter
{
font-family
:
$sansFontFamily
;
pointer-events
:
none
;
position
:
absolute
;
margin-left
:
.7em
;
margin-top
:
.25em
;
z-index
:
2
;
font-size
:
$baseFontSize
*
.86
;
}
/*
...
...
h/css/sidebar.scss
View file @
9008013c
...
...
@@ -72,23 +72,6 @@ svg { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }
.inner
{
margin
:
0
.5em
0
.5em
;
}
.notification-counter
{
font-family
:
$sansFontFamily
;
position
:
absolute
;
margin-left
:
.75em
;
float
:
left
;
margin-top
:
0
.37em
;
z-index
:
2
;
font-size
:
12px
;
cursor
:
w-resize
;
}
&
.shown
{
.notification-counter
{
cursor
:
ew-resize
;
}
}
}
.bottombar
{
...
...
h/js/controllers.coffee
View file @
9008013c
...
...
@@ -436,11 +436,10 @@ class App
else
text
=
'changes.'
notif
.
text
=
'Click to load '
+
updates
+
' '
+
text
return
unless
updates
$element
.
find
(
'.tri'
).
toggle
(
'fg_highlight'
,{
color
:
'lightblue'
})
$timeout
->
$element
.
find
(
'.tri'
).
toggle
(
'fg_highlight'
,{
color
:
'lightblue'
})
,
500
for
p
in
annotator
.
providers
p
.
channel
.
notify
method
:
'updateNotificationCounter'
params
:
updates
$scope
.
$watch
'show_search'
,
(
value
,
old
)
->
if
value
and
not
old
...
...
h/js/host.coffee
View file @
9008013c
...
...
@@ -93,6 +93,10 @@ class Annotator.Host extends Annotator.Guest
Math
.
max
.
apply
(
Math
,
all
)
)
.
bind
(
'updateNotificationCounter'
,
(
ctx
,
count
)
=>
this
.
publish
'updateNotificationCounter'
,
count
)
_setupDragEvents
:
->
el
=
document
.
createElementNS
'http://www.w3.org/1999/xhtml'
,
'canvas'
el
.
width
=
el
.
height
=
1
...
...
h/js/plugin/toolbar.coffee
View file @
9008013c
$
=
Annotator
.
$
class
Annotator
.
Plugin
.
Toolbar
extends
Annotator
.
Plugin
events
:
'updateNotificationCounter'
:
'onUpdateNotificationCounter'
html
:
'<div class="annotator-toolbar"></div>'
html
:
element
:
'<div class="annotator-toolbar"></div>'
notification
:
'<div class="annotator-notification-counter"></div>"'
options
:
items
:
[
...
...
@@ -51,12 +55,15 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin
]
pluginInit
:
->
@
annotator
.
toolbar
=
@
toolbar
=
$
(
@
html
)
@
annotator
.
toolbar
=
@
toolbar
=
$
(
@
html
.
element
)
if
@
options
.
container
?
$
(
@
options
.
container
).
append
@
toolbar
else
$
(
@
element
).
append
@
toolbar
@
notificationCounter
=
$
(
@
html
.
notification
)
@
toolbar
.
append
(
@
notificationCounter
)
@
buttons
=
@
options
.
items
.
reduce
(
buttons
,
item
)
=>
button
=
$
(
'<a></a>'
)
.
attr
(
'href'
,
''
)
...
...
@@ -66,5 +73,23 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin
.
data
(
'state'
,
false
)
buttons
.
add
button
,
$
()
@
toolbar
.
append
(
@
buttons
).
wrapInner
(
'<ul></ul>'
)
list
=
$
(
'<ul></ul>'
)
@
buttons
.
appendTo
(
list
)
@
buttons
.
wrap
(
'<li></li>'
)
@
toolbar
.
append
(
list
)
onUpdateNotificationCounter
:
(
count
)
->
element
=
$
(
@
buttons
[
0
])
element
.
toggle
(
'fg_highlight'
,
{
color
:
'lightblue'
})
setTimeout
->
element
.
toggle
(
'fg_highlight'
,
{
color
:
'lightblue'
})
,
500
switch
when
count
>
9
@
notificationCounter
.
text
(
'>9'
)
when
0
<
count
<
9
@
notificationCounter
.
text
(
"+
#{
count
}
"
)
else
@
notificationCounter
.
text
(
''
)
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