From d8414c4f9b6c01a68b93c81d787adad4c4d9b8b4 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Fri, 3 Oct 2014 23:02:13 +0200 Subject: [PATCH] Fixed "search" button in post list --- public_html/js/Presenters/PostListPresenter.js | 9 +++++++++ public_html/templates/post-list.tpl | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/public_html/js/Presenters/PostListPresenter.js b/public_html/js/Presenters/PostListPresenter.js index 40423206..8a046775 100644 --- a/public_html/js/Presenters/PostListPresenter.js +++ b/public_html/js/Presenters/PostListPresenter.js @@ -70,6 +70,7 @@ App.Presenters.PostListPresenter = function( $searchInput.val(searchArgs.query); $searchInput.keydown(searchInputKeyPressed); + $el.find('form').submit(searchFormSubmitted); keyboard.keyup('p', function() { $el.find('.posts li a').eq(0).focus(); @@ -101,7 +102,15 @@ App.Presenters.PostListPresenter = function( if (e.which !== KEY_RETURN) { return; } + updateSearch(); + } + function searchFormSubmitted(e) { + e.preventDefault(); + updateSearch(); + } + + function updateSearch() { $searchInput.blur(); pagerPresenter.setSearchParams({ query: $searchInput.val(), diff --git a/public_html/templates/post-list.tpl b/public_html/templates/post-list.tpl index 5124fd04..fa65f761 100644 --- a/public_html/templates/post-list.tpl +++ b/public_html/templates/post-list.tpl @@ -1,8 +1,8 @@
- +