Fixed "search" button in post list
This commit is contained in:
parent
b4992926a1
commit
d8414c4f9b
2 changed files with 11 additions and 2 deletions
|
@ -70,6 +70,7 @@ App.Presenters.PostListPresenter = function(
|
||||||
|
|
||||||
$searchInput.val(searchArgs.query);
|
$searchInput.val(searchArgs.query);
|
||||||
$searchInput.keydown(searchInputKeyPressed);
|
$searchInput.keydown(searchInputKeyPressed);
|
||||||
|
$el.find('form').submit(searchFormSubmitted);
|
||||||
|
|
||||||
keyboard.keyup('p', function() {
|
keyboard.keyup('p', function() {
|
||||||
$el.find('.posts li a').eq(0).focus();
|
$el.find('.posts li a').eq(0).focus();
|
||||||
|
@ -101,7 +102,15 @@ App.Presenters.PostListPresenter = function(
|
||||||
if (e.which !== KEY_RETURN) {
|
if (e.which !== KEY_RETURN) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
updateSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchFormSubmitted(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
updateSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSearch() {
|
||||||
$searchInput.blur();
|
$searchInput.blur();
|
||||||
pagerPresenter.setSearchParams({
|
pagerPresenter.setSearchParams({
|
||||||
query: $searchInput.val(),
|
query: $searchInput.val(),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<div id="post-list">
|
<div id="post-list">
|
||||||
<div class="search">
|
<form class="search">
|
||||||
<input type="text" name="query" placeholder="Search query..."/>
|
<input type="text" name="query" placeholder="Search query..."/>
|
||||||
<button type="submit">Search</button>
|
<button type="submit">Search</button>
|
||||||
</div>
|
</form>
|
||||||
|
|
||||||
<div class="pagination-target">
|
<div class="pagination-target">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
Loading…
Reference in a new issue