From 91e5fa506d68ccf8f5e944431b505b0fe562a632 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9rgio=20Saquetim?=
<1108771+megothss@users.noreply.github.com>
Date: Mon, 14 Aug 2023 17:03:19 -0300
Subject: [PATCH] DEV: Add @model/@models support in d-navigation-item (#23074)
---
.../discourse/app/components/d-navigation-item.hbs | 12 +++++++++---
.../discourse/app/components/d-navigation-item.js | 5 +++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/app/assets/javascripts/discourse/app/components/d-navigation-item.hbs b/app/assets/javascripts/discourse/app/components/d-navigation-item.hbs
index 66b1018c4fb..9b4688f8b68 100644
--- a/app/assets/javascripts/discourse/app/components/d-navigation-item.hbs
+++ b/app/assets/javascripts/discourse/app/components/d-navigation-item.hbs
@@ -4,7 +4,13 @@
class={{@class}}
...attributes
>
-
- {{yield}}
-
+ {{#if this.models}}
+
+ {{yield}}
+
+ {{else}}
+
+ {{yield}}
+
+ {{/if}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/d-navigation-item.js b/app/assets/javascripts/discourse/app/components/d-navigation-item.js
index 3aee34f7a31..101d3c23bca 100644
--- a/app/assets/javascripts/discourse/app/components/d-navigation-item.js
+++ b/app/assets/javascripts/discourse/app/components/d-navigation-item.js
@@ -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);
+ }
}