We often have the need to use rich HTML in dialog messages (to show lists, icons, etc.). Previously, our only option was to wrap the message in an `htmlSafe()` call. This PR adds the ability to pass a component name and model to the dialog, which means that we can write the HTML in regular Ember components.
Example, whereas previously we would do this:
```
this.dialog.deleteConfirm({
message: htmlSafe(`<li>Some text</li>`),
});
```
instead we can now do this:
```javascript
import SecondFactorConfirmPhrase from "discourse/components/dialog-messages/second-factor-confirm-phrase";
...
this.dialog.deleteConfirm({
title: I18n.t("user.second_factor.disable_confirm"),
bodyComponent: SecondFactorConfirmPhrase,
bodyComponentModel: model,
})
```
The model passed to the component is optional and will be available as `@model` in the Handlebars template.
|
||
|---|---|---|
| .. | ||
| admin | ||
| bootstrap-json | ||
| confirm-new-email | ||
| dialog-holder | ||
| discourse | ||
| discourse-common | ||
| discourse-ensure-deprecation-order | ||
| discourse-hbr | ||
| discourse-plugins | ||
| discourse-widget-hbs | ||
| docs | ||
| ember-addons | ||
| ember-cli-progress-ci | ||
| locales | ||
| pretty-text | ||
| select-kit | ||
| truth-helpers | ||
| wizard | ||
| .licensee.json | ||
| .npmrc | ||
| discourse-js-processor.js | ||
| handlebars-shim.js | ||
| package.json | ||
| polyfills.js | ||
| service-worker.js.erb | ||
| yarn.lock | ||