Clear search value

This commit is contained in:
Belen Curcio
2017-06-15 14:32:50 -03:00
parent d7c6d7dfac
commit 685695bf43
5 changed files with 24 additions and 6 deletions
+12 -2
View File
@@ -52,6 +52,16 @@ export const toggleSelectCommentInUserDetail = (id, active) => {
};
};
export const toggleStorySearch = (active) => ({type: active ? actions.SHOW_STORY_SEARCH : actions.HIDE_STORY_SEARCH});
export const toggleStorySearch = (active) => ({
type: active ? actions.SHOW_STORY_SEARCH : actions.HIDE_STORY_SEARCH
});
export const storySearchChange = (e) => ({type: actions.CHANGE_ASSET_SEARCH_STRING, value: e.target.value});
export const storySearchChange = (value) => ({
type: actions.CHANGE_ASSET_SEARCH_STRING,
value
});
export const storySearchClear = () => ({
type: actions.CHANGE_ASSET_SEARCH_STRING,
value: ''
});
@@ -34,7 +34,9 @@ export default class Moderation extends Component {
}
closeSearch = () => {
this.props.toggleStorySearch(false);
const {storySearchClear, toggleStorySearch} = this.props;
toggleStorySearch(false);
storySearchClear();
}
openSearch = () => {
@@ -208,7 +210,10 @@ export default class Moderation extends Component {
acceptComment={props.acceptComment}
rejectComment={props.rejectComment} />
)}
<StorySearch visible={this.props.moderation.storySearchVisible} closeSearch={this.closeSearch}/>
<StorySearch
visible={this.props.moderation.storySearchVisible}
closeSearch={this.closeSearch}
/>
</div>
);
}
@@ -19,7 +19,7 @@ const StorySearch = (props) => {
props.router.push(`/admin/moderate/${id}`);
props.closeSearch();
};
return (
<div className={styles.container}>
<div className={styles.positionShim}>
@@ -25,6 +25,7 @@ import {
viewUserDetail,
hideUserDetail,
setSortOrder,
storySearchClear
} from 'actions/moderation';
import {Spinner} from 'coral-ui';
@@ -306,6 +307,7 @@ const mapDispatchToProps = (dispatch) => ({
viewUserDetail,
hideUserDetail,
setSortOrder,
storySearchClear
}, dispatch),
});
@@ -8,7 +8,8 @@ import {storySearchChange} from 'coral-admin/src/actions/moderation';
class StorySearchContainer extends React.Component {
searchChange = (e) => {
this.props.storySearchChange(e.target.value);
const value = e.target.value;
this.props.storySearchChange(value);
this.props.data.refetch();
}