diff --git a/src/projects/list/components/Projects/Projects.jsx b/src/projects/list/components/Projects/Projects.jsx index ec65fb0ad..30d5677e2 100755 --- a/src/projects/list/components/Projects/Projects.jsx +++ b/src/projects/list/components/Projects/Projects.jsx @@ -32,6 +32,7 @@ class Projects extends Component { this.onChangeStatus = this.onChangeStatus.bind(this) this.onPageChange = this.onPageChange.bind(this) this.applyFilters = this.applyFilters.bind(this) + this.applySearchFilter = this.applySearchFilter.bind(this) this.changeView = this.changeView.bind(this) this.init = this.init.bind(this) this.removeScrollPosition = this.removeScrollPosition.bind(this) @@ -132,6 +133,16 @@ class Projects extends Component { this.routeWithParams(criteria) } + applySearchFilter(filter) { + const criteria = _.assign({}, this.props.criteria, filter) + if (criteria && criteria.keyword) { + criteria.keyword = encodeURIComponent(criteria.keyword) + // force sort criteria to best match + criteria.sort = 'best match' + } + this.routeWithParams(criteria) + } + changeView(view) { this.setState({selectedView : view}) } @@ -162,6 +173,7 @@ class Projects extends Component { diff --git a/src/projects/list/components/Projects/ProjectsGridView.jsx b/src/projects/list/components/Projects/ProjectsGridView.jsx index e0185bd00..41b34c135 100644 --- a/src/projects/list/components/Projects/ProjectsGridView.jsx +++ b/src/projects/list/components/Projects/ProjectsGridView.jsx @@ -133,7 +133,7 @@ ProjectTypeIcons.propTypes = { const ProjectsGridView = props => { const { projects, members, totalCount, criteria, pageNum, sortHandler, onPageChange, - error, isLoading, infiniteAutoload, setInfiniteAutoload, projectsStatus, onChangeStatus } = props + error, isLoading, infiniteAutoload, setInfiniteAutoload, projectsStatus, onChangeStatus, applyFilters } = props const currentSortField = _.get(criteria, 'sort', '') // This 'little' array is the heart of the list component. @@ -186,7 +186,7 @@ const ProjectsGridView = props => {
{item.name} - { code && {code} } + { code && { applyFilters({ keyword: code })} }>{code} }