Skip to content

Commit 092d487

Browse files
authored
Merge pull request #42 from ember-learn/feature/external-search-2
add ability to pass search component into navbar via yield
2 parents fcb2c69 + 73c41e2 commit 092d487

File tree

3 files changed

+127
-21
lines changed

3 files changed

+127
-21
lines changed

addon/components/es-navbar/template.hbs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,27 @@
3737
{{/each}}
3838
{{/navbar.nav}}
3939
{{#navbar.nav as |nav|}}
40-
<form class="navbar-form navbar-right searchbox">
41-
<div class="input-group">
42-
<label for="search-input" class="control-label sr-only">Search</label>
43-
<input type="text"
44-
class="form-control search input ds-input"
45-
placeholder="Search..."
46-
id="search-input"
47-
role="combobox"
48-
aria-expanded="false"
49-
aria-owns="algolia-autocomplete-listbox-0"
50-
autocorrect="off"
51-
autocapitalize="none"
52-
spellcheck="false"
53-
/>
54-
<span></span>
55-
</div>
56-
</form>
40+
{{#if hasBlock}}
41+
{{yield}}
42+
{{else}}
43+
<form class="navbar-form navbar-right searchbox">
44+
<div class="input-group">
45+
<label for="search-input" class="control-label sr-only">Search</label>
46+
<input type="text"
47+
class="form-control search input ds-input"
48+
placeholder="Search..."
49+
id="search-input"
50+
role="combobox"
51+
aria-expanded="false"
52+
aria-owns="algolia-autocomplete-listbox-0"
53+
autocorrect="off"
54+
autocapitalize="none"
55+
spellcheck="false"
56+
/>
57+
<span></span>
58+
</div>
59+
</form>
60+
{{/if}}
5761
{{/navbar.nav}}
5862
{{/navbar.content}}
5963
{{/bs-navbar}}
@@ -78,4 +82,4 @@
7882
<!-- /.navbar-collapse -->
7983
</div>
8084
<!-- /.container-fluid -->
81-
--}}
85+
--}}

package-lock.json

Lines changed: 104 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/components/es-navbar/component-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ test('it renders', function(assert) {
2020
{{/es-navbar}}
2121
`);
2222

23-
assert.equal(this.$().text().trim(), 'Search');
23+
assert.equal(this.$().text().trim(), 'template block text');
2424
});

0 commit comments

Comments
 (0)