Skip to content

Commit

Permalink
toggle visibility depending on state
Browse files Browse the repository at this point in the history
  • Loading branch information
emillon committed Oct 31, 2014
1 parent d284654 commit b017caa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
13 changes: 11 additions & 2 deletions static/coffee/view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,14 @@ view_init = (docid) ->
$('#subnav').show()
$('#exitfullscreen').hide()

$('#toggle_annotations_button').click (e) ->
$('.annotation').toggle()
$('.view-states-btn').click ->
switch $(this).data 'view'
when 'everything'
$('.annotation-open').show()
$('.annotation-closed').show()
when 'only-open'
$('.annotation-open').show()
$('.annotation-closed').hide()
when 'nothing'
$('.annotation-open').hide()
$('.annotation-closed').hide()
11 changes: 7 additions & 4 deletions templates/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@
<span class="glyphicon glyphicon-fullscreen"></span>
Full screen
</a>
<a id="toggle_annotations_button" href="#" class="list-group-item">
<span class="glyphicon glyphicon-eye-open"></span>
Toggle annotations
</a>
<a href="{{url_for('.view_list', id=doc.id)}}" class="list-group-item">
<span class="glyphicon glyphicon-list"></span>
List mode
</a>
</div>
<h3><span class="glyphicon glyphicon-eye-open"></span> View</h3>

<div class="btn-group">
<button class="view-states-btn btn btn-default" data-view="nothing">Nothing</button>
<button class="view-states-btn btn btn-default" data-view="only-open">Only open</button>
<button class="view-states-btn btn btn-default" data-view="everything">Everything</button>
</div>

<h3><span class="glyphicon glyphicon-pencil"></span> History</h3>

Expand Down

0 comments on commit b017caa

Please sign in to comment.