Commit 1e025a1b authored by Ujvari Gergely's avatar Ujvari Gergely Committed by gergely-ujvari

Hide viewState when not needed, kill not used code

parent 5cb065a7
......@@ -5,13 +5,6 @@ imports = [
'h.searchfilters'
]
SEARCH_FACETS = ['text', 'tags', 'uri', 'quote', 'since', 'user', 'results']
SEARCH_VALUES =
group: ['Public', 'Private'],
since: ['5 min', '30 min', '1 hour', '12 hours',
'1 day', '1 week', '1 month', '1 year']
class App
scope:
frame:
......@@ -47,8 +40,6 @@ class App
socialView: annotator.socialView
ongoingHighlightSwitch: false
search:
facets: SEARCH_FACETS
values: SEARCH_VALUES
query: $location.search()
show: not angular.equals($location.search(), {})
session: session
......@@ -229,8 +220,6 @@ class App
$rootScope.applySort "Location"
$scope.query = $location.search()
$scope.searchFacets = SEARCH_FACETS
$scope.searchValues = SEARCH_VALUES
$scope.search = {}
$scope.search.update = angular.noop
......@@ -241,6 +230,14 @@ class App
$rootScope.$on '$routeChangeSuccess', (event, next, current) ->
unless next.$$route? then return
$scope.search.query = $location.search()
$scope.search.show = not angular.equals($location.search(), {})
if next.$$route.originalPath is '/viewer'
$rootScope.viewState.show = true
else
$rootScope.viewState.show = false
unless next.$$route.originalPath is '/stream'
if current and next.$$route.originalPath is '/a/:id'
$scope.reloadAnnotations()
......
......@@ -400,19 +400,21 @@ fuzzytime = ['$filter', '$window', ($filter, $window) ->
simpleSearch = ['$parse', ($parse) ->
link: (scope, elem, attr, ctrl) ->
_search = $parse(attr.onsearch)
_clear = $parse(attr.onclear)
scope.dosearch = ->
#_search(scope.generateSearchResults())
scope.search.update(scope.searchtext)
_search(scope, {"this": scope.searchtext})
scope.reset = (event) ->
event.preventDefault()
scope.searchtext = ''
scope.search.clear()
_clear(scope) if attr.onclear
scope.$watch attr.query, (query) ->
if query.query?
scope.searchtext = query.query
scope.search.update(scope.searchtext)
_search(scope, {"this": scope.searchtext})
restrict: 'C'
template: '''
......
......@@ -9,12 +9,6 @@ imports = [
'h.searchfilters'
]
SEARCH_FACETS = ['text', 'tags', 'uri', 'quote', 'since', 'user', 'results']
SEARCH_VALUES =
group: ['Public', 'Private'],
since: ['5 min', '30 min', '1 hour', '12 hours',
'1 day', '1 week', '1 month', '1 year']
class StreamSearch
this.inject = [
'$location', '$scope', '$rootScope',
......@@ -66,6 +60,4 @@ class StreamSearch
angular.module('h.streamsearch', imports, configure)
.constant('searchFacets', SEARCH_FACETS)
.constant('searchValues', SEARCH_VALUES)
.controller('StreamSearchController', StreamSearch)
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