Fixed "search" button in post list

This commit is contained in:
Marcin Kurczewski 2014-10-03 23:02:13 +02:00
parent b4992926a1
commit d8414c4f9b
2 changed files with 11 additions and 2 deletions

View file

@ -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(),

View file

@ -1,8 +1,8 @@
<div id="post-list">
<div class="search">
<form class="search">
<input type="text" name="query" placeholder="Search query..."/>
<button type="submit">Search</button>
</div>
</form>
<div class="pagination-target">
<div class="wrapper">