summaryrefslogtreecommitdiffstats
path: root/js/build/app.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-03-21 12:17:35 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2015-03-21 13:36:50 +0100
commit7b7b0fd5eefddf03a94274f99b8e117c9651166b (patch)
tree27f272bf22cb70a536ca6b6b81764b80aaa19308 /js/build/app.js
parentf6bf8ce402ed43c6a42354e64dda7b3cc081196f (diff)
clear search on route change and fix nav/content
Diffstat (limited to 'js/build/app.js')
-rw-r--r--js/build/app.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/js/build/app.js b/js/build/app.js
index bc178ff8c..d383c012f 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -2845,7 +2845,7 @@ app.directive('newsScroll', ["$timeout", "ITEM_AUTO_PAGE_SIZE", "MARK_READ_TIMEO
}
};
}]);
-app.directive('newsSearch', ["$timeout", function ($timeout) {
+app.directive('newsSearch', ["$document", "$timeout", "$location", function ($document, $timeout, $location) {
'use strict';
var timer;
@@ -2856,7 +2856,10 @@ app.directive('newsSearch', ["$timeout", function ($timeout) {
'onSearch': '='
},
link: function (scope) {
- $('#searchbox').on('search keyup', function () {
+ var box = $('#searchbox');
+ box.val($location.search().search);
+
+ box.on('search keyup', function () {
var value = $(this).val();
if (timer) {
$timeout.cancel(timer);
@@ -2868,6 +2871,17 @@ app.directive('newsSearch', ["$timeout", function ($timeout) {
});
}, 500);
});
+
+ // carry over search on route change
+ scope.$watch(function () {
+ return $location.search();
+ }, function (search) {
+ if (search && search.search) {
+ box.val(search.search);
+ } else {
+ box.val('');
+ }
+ });
}
};
}]);