-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add generic filter that allows user to choose which property is filtered #130
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f270f85
Add generic filter that allows user to choose which property is filtered
ritvje 83f9422
Merge branch 'master' into feature/generic-filters
ritvje 0f10b48
Add country as possible field
ritvje 58609d9
Import properties to current selection from GenericPropertyFilterCont…
ritvje 2a9aa57
Change properties to be a list of object
ritvje 728da35
Merge branch 'master' into feature/generic-filters
emilvirkki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/client/components/ParticipantListPage/containers/GenericPropertyFilterContainer.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react'; | ||
import { Input } from 'react-bootstrap'; | ||
import { getPropertyFilterContainer } from './PropertyFilterContainer'; | ||
|
||
export function getGenericPropertyFilterContainer(searchFilterStore, searchFilterActions) { | ||
const PropertyFilterContainer = getPropertyFilterContainer(searchFilterStore, searchFilterActions); | ||
|
||
const properties = [ | ||
['childNaps', 'Lapsi nukkuu päiväunet'], | ||
['accommodation', 'Majoittautuminen'], | ||
]; | ||
|
||
class GenericPropertyFilterContainer extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
property: '', | ||
}; | ||
this.onPropertyChange = this.onPropertyChange.bind(this); | ||
this.onValueChange = this.onValueChange.bind(this); | ||
} | ||
|
||
onPropertyChange(e) { | ||
this.props.onChange(this.state.property, null); | ||
this.setState({ property: e.target.value }); | ||
searchFilterActions.loadOptions.defer(e.target.value); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ylimääräinen tyhjä rivi? |
||
} | ||
|
||
onValueChange(e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tän vois poistaa |
||
this.props.onChange(); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<Input type="select" label="Kenttä" value={ this.state.property } onChange={ this.onPropertyChange }> | ||
<option value=""></option> | ||
{ properties.map((property, index) => <option value={ property[0] } key={ index }>{ property[1] }</option>) } | ||
</Input> | ||
<PropertyFilterContainer | ||
onChange={ this.props.onChange } | ||
currentSelection={ this.props.currentSelection } | ||
label="" | ||
property={ this.state.property } | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
GenericPropertyFilterContainer.propTypes = { | ||
onChange: React.PropTypes.func.isRequired, | ||
currentSelection: React.PropTypes.object.isRequired, | ||
}; | ||
|
||
return GenericPropertyFilterContainer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Onko joku syy miksei tää oo vain objekti, kun nää on nimi-arvopareja?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Koska sekä nimeä että arvoa käytetään? Voishan ne muuttaa objekteiksi, mutta ei se mun mielestä helpota mitään...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se ois ehkä snadisti tyylikkäämpää mun mielestä, nää arrayt joissa on array sisällä on mun mielestä vähemmän dokumentoivia. Tämmönen rakenne on perusteltu sillon kun halutaan tietty järjestys, jos se on tarkoitus niin sitä tää on tosi hyvä näin :)