diff --git a/src/main/resources/i18n/en.properties b/src/main/resources/i18n/en.properties index b128891f..d5a819e9 100644 --- a/src/main/resources/i18n/en.properties +++ b/src/main/resources/i18n/en.properties @@ -125,4 +125,5 @@ about.shortcuts.open_current_entry_in_new_window_background=open current entry i about.shortcuts.star_unstar=star/unstar current entry about.shortcuts.mark_current_entry=mark as read/unread current entry about.shortcuts.mark_all_as_read=mark all entries as read -about.shortcuts.open_in_new_tab_mark_as_read=open entry in new tab and mark as read \ No newline at end of file +about.shortcuts.open_in_new_tab_mark_as_read=open entry in new tab and mark as read +about.shortcuts.feed_search=navigate to a subscription by entering the subscription name \ No newline at end of file diff --git a/src/main/webapp/js/controllers.js b/src/main/webapp/js/controllers.js index cc019c31..dc7a27c3 100644 --- a/src/main/webapp/js/controllers.js +++ b/src/main/webapp/js/controllers.js @@ -26,6 +26,9 @@ module.run(['$rootScope', function($rootScope) { $rootScope.$on('emitReload', function(event, args) { $rootScope.$broadcast('reload'); }); + $rootScope.$on('emitFeedSearch', function(event, args) { + $rootScope.$broadcast('feedSearch'); + }); }]); module.controller('SubscribeCtrl', ['$scope', 'FeedService', 'CategoryService', 'MobileService', @@ -42,6 +45,10 @@ function($scope, FeedService, CategoryService, MobileService) { $scope.CategoryService = CategoryService; $scope.MobileService = MobileService; + + $scope.search = function() { + $scope.$emit('emitFeedSearch'); + } $scope.open = function() { $scope.sub = { @@ -556,23 +563,95 @@ function($scope, $http, $state, $stateParams, $route, $location, }; }]); -module.controller('FeedCtrl', ['$scope', '$state', 'CategoryService', -function($scope, $state, CategoryService) { - $scope.CategoryService = CategoryService; +module.controller('FeedSearchCtrl', ['$scope', '$state', '$filter', '$timeout', 'CategoryService', +function($scope, $state, $filter, $timeout, CategoryService) { $scope.feedSearchModal = false; + $scope.filter = null; + $scope.focus = null; + $scope.CategoryService = CategoryService; + + $scope.$watch('filter', function() { + $timeout(function() { + if ($scope.filtered){ + $scope.focus = $scope.filtered[0]; + } + }, 0); + }); + + var getCurrentIndex = function() { + var index = -1; + + if(!$scope.focus) { + return index; + } + + var filtered = $scope.filtered; + for (var i = 0; i < filtered.length; i++) { + if ($scope.focus.id == filtered[i].id) { + index = i; + break; + } + } + return index; + } + + $scope.focusPrevious = function(e) { + var index = getCurrentIndex(); + if (index === 0) { + return; + } + $scope.focus = $scope.filtered[index - 1]; + + e.stopPropagation(); + e.preventDefault(); + }; + + $scope.focusNext = function(e) { + var index = getCurrentIndex(); + if (index == ($scope.filtered.length - 1)) { + return; + } + $scope.focus = $scope.filtered[index + 1]; + + e.stopPropagation(); + e.preventDefault(); + }; + + $scope.openFocused = function() { + if (!$scope.focus) { + return; + } + $scope.goToFeed($scope.focus.id); + } - $scope.goToFeed = function(id) { - $state.transitionTo('feeds.view', {_type : 'feed', _id : id}); - $scope.feedSearchModal=false; - $scope.feedFilter=''; + $scope.goToFeed = function(id) { + $scope.close(); + $state.transitionTo('feeds.view', { + _type : 'feed', + _id : id + } + ); + }; + + $scope.open = function() { + $scope.filter = null; + $scope.feedSearchModal = true; + }; + + $scope.close = function() { + $scope.feedSearchModal = false; }; Mousetrap.bind('g u', function(e) { $scope.$apply(function() { - $scope.feedSearchModal = true; + $scope.open(); }); return false; }); + + $scope.$on('feedSearch', function() { + $scope.open(); + }); }]); diff --git a/src/main/webapp/sass/components/_subscription-list.scss b/src/main/webapp/sass/components/_subscription-list.scss index 5bd8a835..bc5c5aa9 100644 --- a/src/main/webapp/sass/components/_subscription-list.scss +++ b/src/main/webapp/sass/components/_subscription-list.scss @@ -1,8 +1,24 @@ /* feed search dialog */ -.item-filter-dialog .modal-body { +.feed-search-dialog .modal-body { overflow: hidden; } +.feed-search-dialog .filter-input { + width: 90%; +} + +.feed-search-dialog .feed-link { + font-size: large; +} + +.feed-search-dialog a:hover { + text-decoration: none; +} + +.feed-search-dialog .focus a { + color: black; +} + /* tree*/ .sidebar-nav-fixed { margin-top: 10px; diff --git a/src/main/webapp/sass/generic/_misc.scss b/src/main/webapp/sass/generic/_misc.scss index 47f163c7..2b792671 100644 --- a/src/main/webapp/sass/generic/_misc.scss +++ b/src/main/webapp/sass/generic/_misc.scss @@ -2,6 +2,10 @@ cursor: pointer; } +.block { + display: block; +} + .rtl { direction: rtl; } diff --git a/src/main/webapp/templates/_feedsearch.html b/src/main/webapp/templates/_feedsearch.html new file mode 100644 index 00000000..4b983eb2 --- /dev/null +++ b/src/main/webapp/templates/_feedsearch.html @@ -0,0 +1,27 @@ +