Skip to content

Commit

Permalink
color annotations based on their state
Browse files Browse the repository at this point in the history
  • Loading branch information
emillon committed Oct 31, 2014
1 parent 0e18771 commit d284654
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion static/coffee/annotation.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Annotation
constructor: (@$tld, @docid, @page, @text, @annid, @geom) ->
constructor: (@$tld, @docid, @page, @text, @annid, @geom, @state) ->
@$div = jQuery('<div>').addClass 'annotation'
@$div = jQuery('<div>').addClass ('annotation-' + @state)
setGeom @$div, @geom
$closeBtn = jQuery('<a>').text '[X]'
@$div.append $closeBtn
Expand Down
8 changes: 4 additions & 4 deletions static/coffee/pdfpage.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class PdfPage
@$div.append @$textLayerDiv

selection = new Selection @$textLayerDiv, (geom) =>
@addAnnotation "", null, geom
@addAnnotation "", null, geom, 'open'
@$div.append selection.$div

anns = annotations[@i]
if anns
for ann in anns
@addAnnotation ann.text, ann.id, ann
@addAnnotation ann.text, ann.id, ann, ann.state

addAnnotation: (text, id, geom) ->
ann = new Annotation @$textLayerDiv, @docid, @i, text, id, geom
addAnnotation: (text, id, geom, state) ->
ann = new Annotation @$textLayerDiv, @docid, @i, text, id, geom, state
@$div.append ann.$div
9 changes: 8 additions & 1 deletion static/css/view.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
}

.annotation {
background-color: orange;
position: absolute !important; /* important is needed for http://bugs.jqueryui.com/ticket/6939 */
}

.annotation-open {
background-color: orange;
}

.annotation-closed {
background-color: lightgreen;
}

0 comments on commit d284654

Please sign in to comment.