minor search page fixes
This commit is contained in:
@@ -14,16 +14,21 @@ var SearchResultsPage = React.createClass({
|
||||
return SearchStore.getSearchResultsState();
|
||||
},
|
||||
render: function() {
|
||||
var content;
|
||||
|
||||
if (this.state.items.length > 0) {
|
||||
content = <ItemList items={this.state.items} />
|
||||
} else {
|
||||
|
||||
content = <div>Nema rezultata za vašu pretragu.</div>
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<h1>Resultati pretrage za {this.state.q}</h1>
|
||||
<div>
|
||||
<h2>Rezultati pretrage za '{this.state.q}'</h2>
|
||||
|
||||
|
||||
<ItemList items={this.state.items} />
|
||||
</div>
|
||||
|
||||
{content}
|
||||
</div>
|
||||
);
|
||||
|
||||
},
|
||||
componentWillReceiveProps: function() {
|
||||
this.update();
|
||||
|
||||
@@ -10,7 +10,7 @@ var SearchBox = React.createClass({
|
||||
return SearchStore.getSearchBoxState();
|
||||
},
|
||||
onSearchClick: function(e) {
|
||||
NavigationActions.goToSearchResults(this.state.q);
|
||||
this.doSearch();
|
||||
e.preventDefault();
|
||||
},
|
||||
componentDidMount: function() {
|
||||
@@ -25,12 +25,17 @@ var SearchBox = React.createClass({
|
||||
}
|
||||
},
|
||||
onSearchBoxChange: function(e) {
|
||||
SearchActions.searchBoxChange(e.currentTarget.value);
|
||||
SearchActions.searchBoxChange(e.currentTarget.value);
|
||||
},
|
||||
doSearch: function() {
|
||||
if(this.state.q.trim() !== '') {
|
||||
NavigationActions.goToSearchResults(this.state.q);
|
||||
}
|
||||
},
|
||||
onKeyPress: function(e) {
|
||||
var enterKeyCode = 13;
|
||||
if(e.which == enterKeyCode) {
|
||||
NavigationActions.goToSearchResults(this.state.q);
|
||||
this.doSearch();
|
||||
}
|
||||
},
|
||||
render: function() {
|
||||
|
||||
Reference in New Issue
Block a user