Skip to content

Commit

Permalink
Remove the breadcrumb title spacing functionality
Browse files Browse the repository at this point in the history
This removes the space between each breadcrumb title part when passing multiple positional arguments.

This is a better default since spaces can be added very easily but to remove them the user has to use the `{{concat}}` helper. This also makes it more consistent with how the `{{concat}}` and `{{page-title}}` helpers works.
  • Loading branch information
Windvis committed May 17, 2021
1 parent 3e119fe commit 986a8c5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ Usage
This helper allows you to add breadcrumbs and is the equivalent of the `page-title` helper but for breadcrumbs.

#### Positional argument(s)
Positional arguments are used as the title for the breadcrumb. Multiple positional arguments will be combined into a single title (separated by spaces).
Positional arguments are used as the title for the breadcrumb. Multiple positional arguments will be combined into a single title.

```hbs
{{breadcrumb "Home"}}
{{! "Home" }}
{{breadcrumb "Hottest JS framework 🔥:" this.hottestFramework }}
{{breadcrumb "Hottest JS framework 🔥: " this.hottestFramework}}
{{! "Hottest JS framework 🔥: Ember" }}
```
> The title can be accessed with the `title` property of the breadcrumb object.
Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class BreadcrumbHelper extends Helper {
}

compute(breadcrumbTitleParts, optionalData) {
let breadcrumbTitle = breadcrumbTitleParts.join(' ');
let breadcrumbTitle = breadcrumbTitleParts.join('');

let breadcrumbData = {
data: optionalData,
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/templates/foo/bar.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{page-title "Bar"}}
{{breadcrumb "Bar:" this.number route="foo.bar"}}
{{breadcrumb "Bar: " this.number route="foo.bar"}}
{{outlet}}

<button type="button" {{on "click" this.getRandomNumber}}>Random</button>
2 changes: 1 addition & 1 deletion tests/dummy/app/templates/foo/bar/baz.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{page-title "Baz"}}
{{breadcrumb "Baz:" this.model route="foo.bar.baz"}}
{{breadcrumb "Baz: " this.model route="foo.bar.baz"}}
{{outlet}}
2 changes: 1 addition & 1 deletion tests/integration/helpers/breadcrumb-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module('Integration | Helper | breadcrumb', function (hooks) {
{{/each}}
</ol>
{{breadcrumb "foo" "bar" "baz"}}
{{breadcrumb "foo" " bar " "baz"}}
`);

assert.dom('[data-test-breadcrumb-item]').hasText('foo bar baz');
Expand Down

0 comments on commit 986a8c5

Please sign in to comment.