diff --git a/src/components/grid/grid.jsx b/src/components/grid/grid.jsx index 93572840d..9100cacbc 100644 --- a/src/components/grid/grid.jsx +++ b/src/components/grid/grid.jsx @@ -27,12 +27,12 @@ var Grid = React.createClass({ return (
- {this.props.items.map(function (item) { + {this.props.items.map(function (item, key) { var href = '/' + this.props.itemType + '/' + item.id + '/'; if (this.props.itemType == 'projects') { return ( - + imgElement = {this.props.alt} ; - titleElement = {this.props.title}; + titleElement = + {this.props.title} + ; } else { imgElement = ; titleElement = this.props.title; diff --git a/src/views/search/search.jsx b/src/views/search/search.jsx index f3d0e5e1c..87b4ce78d 100644 --- a/src/views/search/search.jsx +++ b/src/views/search/search.jsx @@ -51,14 +51,16 @@ var Search = injectIntl(React.createClass({ while (term.indexOf('&') > -1) { term = term.substring(0, term.indexOf('&')); } - term = term.split('+').join(' '); - this.getSearchMore(); - this.props.dispatch(navigationActions.setSearchTerm(decodeURI(term))); + term = decodeURI(term.split('+').join(' ')); + this.props.dispatch(navigationActions.setSearchTerm(term)); + }, + componentDidUpdate: function (prevProps) { + if (this.props.searchTerm !== prevProps.searchTerm) this.getSearchMore(); }, getSearchMore: function () { var termText = ''; if (this.props.searchTerm !== '') { - termText = '&q=' + this.props.searchTerm; + termText = '&q=' + encodeURIComponent(this.props.searchTerm.split(' ').join('+')); } api({ uri: '/search/' + this.props.tab + @@ -76,7 +78,7 @@ var Search = injectIntl(React.createClass({ }.bind(this)); }, onSearchSubmit: function (formData) { - window.location.href = '/search/projects?q=' + formData.q; + window.location.href = '/search/projects?q=' + encodeURIComponent(formData.q); }, getTab: function (type) { var term = this.props.searchTerm.split(' ').join('+');