discourse/app/assets/javascripts/dialog-holder/addon/components/dialog-holder.hbs
Jarek Radosz 1c87bb7fe9
DEV: Update DButton uses (#23333)
1. Use `this.` instead of `{{action}}` where applicable
2. Use `{{fn}}` instead of `@actionParam` where applicable
3. Use non-`@` versions of class/type/tabindex/aria-controls/aria-expanded
4. Remove `btn` class (it's added automatically to all DButtons)
5. Remove `type="button"` (it's the default)
6. Use `concat-class` helper
2023-08-31 11:49:35 +02:00

64 lines
2.0 KiB
Handlebars

<div
id="dialog-holder"
class="dialog-container {{this.dialog.class}}"
aria-labelledby={{this.dialog.titleElementId}}
aria-hidden="true"
>
<div class="dialog-overlay" data-a11y-dialog-hide></div>
{{#if this.dialog.type}}
<div class="dialog-content" role="document">
{{#if this.dialog.title}}
<div class="dialog-header">
<h3 id={{this.dialog.titleElementId}}>{{this.dialog.title}}</h3>
<DButton
@icon="times"
@action={{action this.dialog.cancel}}
@title="modal.close"
class="btn-flat dialog-close close"
/>
</div>
{{/if}}
{{#if (or this.dialog.message this.dialog.bodyComponent)}}
<div class="dialog-body">
{{#if this.dialog.bodyComponent}}
<this.dialog.bodyComponent
@model={{this.dialog.bodyComponentModel}}
/>
{{else if this.dialog.message}}
<p>{{this.dialog.message}}</p>
{{/if}}
</div>
{{/if}}
{{#if (notEq this.dialog.type "notice")}}
<div class="dialog-footer">
{{#each this.dialog.buttons as |button|}}
<DButton
@icon={{button.icon}}
@action={{fn this.handleButtonAction button}}
@translatedLabel={{button.label}}
class={{button.class}}
/>
{{else}}
<DButton
@disabled={{this.dialog.confirmButtonDisabled}}
@action={{this.dialog.didConfirmWrapped}}
@icon={{this.dialog.confirmButtonIcon}}
@label={{this.dialog.confirmButtonLabel}}
class={{this.dialog.confirmButtonClass}}
/>
{{#if this.dialog.shouldDisplayCancel}}
<DButton
@action={{this.dialog.cancel}}
@label={{this.dialog.cancelButtonLabel}}
class={{this.dialog.cancelButtonClass}}
/>
{{/if}}
{{/each}}
</div>
{{/if}}
</div>
{{/if}}
</div>