Skip to content

Commit

Permalink
Merge pull request #178 from labzero/develop
Browse files Browse the repository at this point in the history
Merge to master
  • Loading branch information
JeffreyATW authored Apr 16, 2018
2 parents 1e6ea7e + 8ee856d commit 9bb3f54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/components/NameFilterForm/NameFilterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class NameFilterForm extends Component {
}

hideForm = () => {
this.props.setFlipMove(false);
this.props.setNameFilter('');
this.setState(() => ({
shown: false,
Expand Down Expand Up @@ -84,6 +85,7 @@ class NameFilterForm extends Component {
value={nameFilter}
onChange={this.setNameFilterValue}
onFocus={this.setFlipMoveFalse}
onBlur={this.setFlipMoveTrue}
ref={i => { this.input = i; }}
/>
</div>
Expand Down
20 changes: 11 additions & 9 deletions src/components/TagFilterForm/TagFilterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ class TagFilterForm extends Component {
}

componentDidUpdate(prevProps, prevState) {
if (this.state.shown !== prevState.shown) {
if (this.state.shown) {
this.autosuggest.input.focus();
} else {
this.props.setFlipMove(true);
}
if (this.state.shown !== prevState.shown && this.state.shown) {
this.autosuggest.input.focus();
}
this.props.setFlipMove(true);
}

setAutosuggestValue = (event, { newValue, method }) => {
Expand All @@ -52,6 +49,7 @@ class TagFilterForm extends Component {
if (method === 'enter') {
event.preventDefault();
}
this.props.setFlipMove(false);
this.props.addTag(suggestion.id);
this.setState(() => ({
autosuggestValue: '',
Expand All @@ -60,26 +58,30 @@ class TagFilterForm extends Component {

hideForm = () => {
this.props.clearTags();
this.props.setFlipMove(false);
this.setState(() => ({
autosuggestValue: '',
shown: false,
}));
}

showForm = () => {
this.props.setFlipMove(false);
this.setState(() => ({
shown: true,
}));
}

removeTagFilter = (tag) => {
this.props.removeTag(tag);
this.props.setFlipMove(false);
}

render() {
const {
addByName,
addedTags,
allTags,
exclude,
removeTag,
restaurantIds,
} = this.props;

Expand Down Expand Up @@ -122,7 +124,7 @@ class TagFilterForm extends Component {
<TagContainer
id={tag}
showDelete
onDeleteClicked={() => removeTag(tag)}
onDeleteClicked={() => this.removeTagFilter(tag)}
exclude={exclude}
/>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Restaurant.findAllWithTagIds = ({ team_id }) =>
order: [
[Restaurant.associations.decisions, 'id', 'NULLS LAST'],
sequelize.literal('(COUNT(*) OVER(PARTITION BY "restaurant"."id")) DESC'),
[Restaurant.associations.votes, 'created_at', 'DESC', 'NULLS LAST'],
sequelize.literal('all_decision_count ASC'),
sequelize.literal('all_vote_count DESC'),
['name', 'ASC'],
Expand Down

0 comments on commit 9bb3f54

Please sign in to comment.