Commit f08abab8 authored by Ujvari Gergely's avatar Ujvari Gergely

Use clearSearch callback for actual collapse

Introduce show_search boolean in class Hypothesis
parent fa290837
......@@ -232,6 +232,12 @@ class App
$scope.createUnattachedAnnotation = ->
console.log "Should create unattached annotation"
$scope.showSearchBar = =>
annotator.show_search = true
$scope.isSearchShown = =>
annotator.show_search
class Annotation
this.$inject = ['$element', '$location', '$scope', 'annotator', 'drafts', '$timeout']
constructor: ($element, $location, $scope, annotator, drafts, $timeout) ->
......
......@@ -44,6 +44,7 @@ class Hypothesis extends Annotator
# Internal state
dragging: false # * To enable dragging only when we really want to
ongoing_edit: false # * Is there an interrupted edit by login
show_search: false # * Toggle showing the visualsearchbar
# Here as a noop just to make the Permissions plugin happy
# XXX: Change me when Annotator stops assuming things about viewers
......@@ -126,6 +127,9 @@ class Hypothesis extends Annotator
query: ''
callbacks:
search: (query, searchCollection) =>
unless query
return
matched = []
whole_document = true
for searchItem in searchCollection.models
......@@ -203,6 +207,10 @@ class Hypothesis extends Annotator
when 'area' then callback ['sidebar', 'document']
when 'time'
callback ['5 minutes', '1 hour', '1 day', '1 week', '1 month', '1 year']
clearSearch: (original) =>
original()
@show_search = false
$rootScope.$digest()
_setupXDM: ->
$location = @element.injector().get '$location'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment