DEV: Add @model/@models support in d-navigation-item (#23074)

This commit is contained in:
Sérgio Saquetim 2023-08-14 17:03:19 -03:00 committed by GitHub
parent a5542eeab0
commit 91e5fa506d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -4,7 +4,13 @@
class={{@class}}
...attributes
>
<LinkTo @route={{@route}}>
{{yield}}
</LinkTo>
{{#if this.models}}
<LinkTo @route={{@route}} @models={{this.models}}>
{{yield}}
</LinkTo>
{{else}}
<LinkTo @route={{@route}}>
{{yield}}
</LinkTo>
{{/if}}
</li>

View File

@ -1,5 +1,6 @@
import Component from "@glimmer/component";
import { inject as service } from "@ember/service";
import { makeArray } from "discourse-common/lib/helpers";
export default class DNavigationItem extends Component {
@service router;
@ -26,4 +27,8 @@ export default class DNavigationItem extends Component {
return "page";
}
}
get models() {
return makeArray(this.args.models || this.args.model);
}
}