Skip to content
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

Update inverse template for autocomplete as it doesnt accept parameters #322

Merged

Conversation

kat3kasper
Copy link
Contributor

Inverse component templates can not recieve parameters. This means
there is no access to searchText in the inverse block.

  • Try to render notFoundComponent then inverse block then default notFoundMsg
  • Update documentation app to reflect that searchText is not available in inverse bloc.

See: emberjs/ember.js#11084

{{else}}
<li>{{notFoundMsg}}</li>
{{/if}}
<li>{{notFoundMsg}}</li>
{{/if}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can be a bit more friendlier and backwards compatible at the same time.
What do you think about:

{{#if notFoundComponent}}
  <li>{{component notFoundComponent searchText=searchText}}</li>
{{else if (has-block "inverse")}}
  <li>{{yield to="inverse"}}</li>
{{else}}
  <li>{{notFoundMsg}}</li>
{{/if}}

@miguelcobain
Copy link
Owner

Can you please add a new CHANGELOG entry under a new version named master?

Inverse component templates can not recieve parameters. This means
there is no access to `searchText` in the inverse block.

- Removed inverse template rendering. Instead try to render
notFoundComponent then default to notFoundMsg
- Update documentation app to reflect these changes

See: emberjs/ember.js#11084
@kat3kasper kat3kasper force-pushed the fix/autocomplete-inverse-template branch from c73b47c to 44af8ba Compare March 30, 2016 16:58
@kat3kasper kat3kasper changed the title Remove inverse template for autocomplete as it doesnt accept parameters Update inverse template for autocomplete as it doesnt accept parameters Mar 30, 2016
@kat3kasper kat3kasper force-pushed the fix/autocomplete-inverse-template branch from 89de460 to 5524e84 Compare March 30, 2016 17:03
@kat3kasper
Copy link
Contributor Author

@miguelcobain took the suggestion for not breaking backwards compatibility. I like this idea and implemented it. My only concern is that it doesn't match the ordering of what happens when an item is found. There we follow hasBlock, itemComponent, default. I think it will still work as people expect though either implementing an inverse block or a notFoundComponent.

@miguelcobain
Copy link
Owner

I think it's ok since people will generally use just one of them. Thanks again.

@miguelcobain miguelcobain merged commit 7116c0b into miguelcobain:master Mar 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants