Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/projects/list/components/Projects/Projects.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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})
}
Expand Down Expand Up @@ -162,6 +173,7 @@ class Projects extends Component {
<EnhancedGrid {...this.props}
onPageChange={this.onPageChange}
sortHandler={this.sortHandler}
applyFilters={this.applySearchFilter}
onChangeStatus={this.onChangeStatus}
projectsStatus={getStatusCriteriaText(criteria)}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/projects/list/components/Projects/ProjectsGridView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -186,7 +186,7 @@ const ProjectsGridView = props => {
<div className="spacing project-container">
<div className="project-title">
<Link to={url} className="link-title">{item.name}</Link>
{ code && <span className="item-ref-code txt-gray-md">{code}</span> }
{ code && <span className="item-ref-code txt-gray-md" onClick={ () => { applyFilters({ keyword: code })} }>{code}</span> }
</div>
<Link to={url}>
<TextTruncate
Expand Down