discourse/app/assets/javascripts/dialog-holder
Penar Musaraj 4072786f5b
DEV: Support using Ember components in dialog service (#20230)
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.
2023-02-13 13:03:31 -05:00
..
addon DEV: Support using Ember components in dialog service (#20230) 2023-02-13 13:03:31 -05:00
app DEV: Make dialog-holder a monorepo package (#19051) 2022-11-16 16:43:45 +01:00
index.js DEV: Make dialog-holder a monorepo package (#19051) 2022-11-16 16:43:45 +01:00
package.json Build(deps): Bump ember-auto-import in /app/assets/javascripts (#19981) 2023-01-24 22:50:05 +01:00