From 44af8bafbcc9a1f001918800574169cf7492151e Mon Sep 17 00:00:00 2001 From: Katelyn Kasperowicz Date: Fri, 25 Mar 2016 14:56:37 -0700 Subject: [PATCH] Remove inverse template for autocomplete as it doesnt accept parameters 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: https://github.com/emberjs/ember.js/pull/11084 --- app/templates/components/paper-autocomplete.hbs | 12 ++++-------- tests/dummy/app/templates/autocomplete.hbs | 8 +++----- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/templates/components/paper-autocomplete.hbs b/app/templates/components/paper-autocomplete.hbs index 4d6fe0727..7a5c99f0e 100644 --- a/app/templates/components/paper-autocomplete.hbs +++ b/app/templates/components/paper-autocomplete.hbs @@ -58,15 +58,11 @@ {{else}} {{#if showLoadingBar}} - {{!-- Render block template, then named component then default --}} - {{#if hasBlock}} -
  • {{yield searchText to="inverse"}}
  • + {{!-- Render named component then default --}} + {{#if notFoundComponent}} +
  • {{component notFoundComponent searchText=searchText}}
  • {{else}} - {{#if notFoundComponent}} -
  • {{component notFoundComponent searchText=searchText}}
  • - {{else}} -
  • {{notFoundMsg}}
  • - {{/if}} +
  • {{notFoundMsg}}
  • {{/if}} {{/if}} {{/each}} diff --git a/tests/dummy/app/templates/autocomplete.hbs b/tests/dummy/app/templates/autocomplete.hbs index 611369181..73c3c6c72 100644 --- a/tests/dummy/app/templates/autocomplete.hbs +++ b/tests/dummy/app/templates/autocomplete.hbs @@ -177,13 +177,11 @@

    Template

    {{#code-block language="handlebars"}} -\{{#paper-autocomplete minLength=0 placeholder="Type e.g. ember, paper, one, two etc." source=arrayOfItems model=fourthModel as |searchText item index|}}} +\{{#paper-autocomplete minLength=0 placeholder="Type e.g. ember, paper, one, two etc." source=arrayOfItems model=fourthModel notFoundMessage="Whoops! Could not find \"%@\." as |searchText item index|}}} <span class="item-title"> \{{paper-icon "star"}} <span> \{{paper-autocomplete-highlight searchText=searchText label=item}} </span> </span> -\{{else}} - Whoops! Could not find "\{{searchText}}". \{{/paper-autocomplete}}{{/code-block}}

    The custom template receives 3 block parameters (searchText, item and index). @@ -192,8 +190,8 @@

    Blockless Custom template