Commit d7ca3ffa authored by Randall Leeds's avatar Randall Leeds

Merge pull request #1330 from hypothesis/search-visibility-quirks

Fix quirks with show/hide on the search bar
parents f26656d0 6c2640d4
......@@ -49,6 +49,11 @@ class App
socialView: annotator.socialView
ongoingHighlightSwitch: false
model: {}
search:
facets: SEARCH_FACETS
values: SEARCH_VALUES
query: $location.search()
show: not angular.equals($location.search(), {})
_reset()
......@@ -114,6 +119,12 @@ class App
$scope.reloadAnnotations()
$scope.initUpdater()
$scope.$watch 'search.show', (visible) ->
if visible
$timeout ->
$element.find('.visual-search').find('input').last().focus()
, 10
$scope.$watch 'socialView.name', (newValue, oldValue) ->
return if newValue is oldValue
console.log "Social View changed to '" + newValue + "'. Reloading annotations."
......@@ -145,12 +156,6 @@ class App
.focus()
, 10
$scope.$watch 'show_search', (value, old) ->
if value and not old
$timeout ->
$element.find('.visual-search').find('input').last().focus()
, 10
$scope.$watch 'store.entities', (entities, oldEntities) ->
return if entities is oldEntities
......@@ -248,19 +253,12 @@ class App
$rootScope.applySort "Location"
$scope.query = $location.search()
$scope.searchFacets = SEARCH_FACETS
$scope.searchValues = SEARCH_VALUES
$scope.search = {}
$scope.search.update = angular.noop
$scope.search.clear = angular.noop
$scope.show_search = Object.keys($scope.query).length > 0
$rootScope.$on '$routeChangeSuccess', (event, next, current) ->
unless next.$$route? then return
$scope.search.query = $location.search()
$scope.search.show = not angular.equals($location.search(), {})
unless next.$$route.originalPath is '/stream'
$scope.search.update = (searchCollection) ->
return unless annotator.discardDrafts()
......@@ -290,7 +288,6 @@ class App
$scope.search.clear = ->
$location.url('/viewer')
$scope.show_search = false
$scope.reloadAnnotations = ->
Store = plugins.Store
......
......@@ -61,8 +61,6 @@ class StreamSearch
$scope.updater.then (sock) ->
sock.send(JSON.stringify(sockmsg))
$scope.search.query = $location.search()
angular.module('h.streamsearch', imports, configure)
.constant('searchFacets', SEARCH_FACETS)
......
......@@ -782,11 +782,9 @@ pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; }
//Visual Search////////////////////////////////
//Override their css here
.search-container {
.VS-search {
overflow: hidden;
}
.VS-search {
* {
@include box-sizing(content-box);
}
......
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