refactor: 💡 Simplify template for confirmation dialog (#1580)
This commit is contained in:
1 parent
07cf9fc533
commit
3d0be5ef48
2 files changed
+33
-54
No files matched your search
@@ -38,7 +38,10 @@ export default class ApplicationRoute extends Route {
|
|||||||
if (fromName !== toName && maybeModel?.hasDirtyAttributes) {
|
if (fromName !== toName && maybeModel?.hasDirtyAttributes) {
|
||||||
transition.abort();
|
transition.abort();
|
||||||
try {
|
try {
|
||||||
await this.confirm.confirm('abandon', { isAbandonConfirm: true });
|
await this.confirm.confirm(this.intl.t('questions.abandon-confirm'), {
|
||||||
|
title: 'titles.abandon-confirm',
|
||||||
|
confirm: 'actions.discard',
|
||||||
|
});
|
||||||
maybeModel?.rollbackAttributes();
|
maybeModel?.rollbackAttributes();
|
||||||
transition.retry();
|
transition.retry();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -91,57 +91,33 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<PendingConfirmations as |confirmation accept deny|>
|
<PendingConfirmations as |confirmation accept deny|>
|
||||||
{{#if confirmation.options.isAbandonConfirm}}
|
<Rose::Dialog
|
||||||
<Rose::Dialog
|
@heading={{if
|
||||||
@heading={{t 'titles.abandon-confirm'}}
|
confirmation.options.title
|
||||||
@dismissButtonText={{t 'actions.cancel'}}
|
(t confirmation.options.title)
|
||||||
@icon='flight-icons/svg/alert-triangle-16'
|
(t 'actions.confirm')
|
||||||
@style='warning'
|
}}
|
||||||
@modal={{true}}
|
@dismissButtonText={{t 'actions.cancel'}}
|
||||||
@dismiss={{deny}}
|
@icon='flight-icons/svg/alert-triangle-16'
|
||||||
as |dialog|
|
@style='warning'
|
||||||
>
|
@modal={{true}}
|
||||||
<dialog.body>
|
@dismiss={{deny}}
|
||||||
<p>{{t 'questions.abandon-confirm'}}</p>
|
as |dialog|
|
||||||
</dialog.body>
|
>
|
||||||
<dialog.footer>
|
<dialog.body>
|
||||||
<Rose::Button @style='primary' {{on 'click' accept}}>
|
<p>{{confirmation.text}}</p>
|
||||||
{{t 'actions.discard'}}
|
</dialog.body>
|
||||||
</Rose::Button>
|
<dialog.footer>
|
||||||
<Rose::Button @style='secondary' {{on 'click' deny}}>
|
<Rose::Button @style='primary' {{on 'click' accept}}>
|
||||||
{{t 'actions.cancel'}}
|
{{if
|
||||||
</Rose::Button>
|
confirmation.options.confirm
|
||||||
</dialog.footer>
|
(t confirmation.options.confirm)
|
||||||
</Rose::Dialog>
|
(t 'actions.ok')
|
||||||
{{else}}
|
}}
|
||||||
<Rose::Dialog
|
</Rose::Button>
|
||||||
@heading={{if
|
<Rose::Button @style='secondary' {{on 'click' deny}}>
|
||||||
confirmation.options.title
|
{{t 'actions.cancel'}}
|
||||||
(t confirmation.options.title)
|
</Rose::Button>
|
||||||
(t 'actions.confirm')
|
</dialog.footer>
|
||||||
}}
|
</Rose::Dialog>
|
||||||
@dismissButtonText={{t 'actions.cancel'}}
|
|
||||||
@icon='flight-icons/svg/alert-triangle-16'
|
|
||||||
@style='warning'
|
|
||||||
@modal={{true}}
|
|
||||||
@dismiss={{deny}}
|
|
||||||
as |dialog|
|
|
||||||
>
|
|
||||||
<dialog.body>
|
|
||||||
<p>{{confirmation.text}}</p>
|
|
||||||
</dialog.body>
|
|
||||||
<dialog.footer>
|
|
||||||
<Rose::Button @style='primary' {{on 'click' accept}}>
|
|
||||||
{{if
|
|
||||||
confirmation.options.confirm
|
|
||||||
(t confirmation.options.confirm)
|
|
||||||
(t 'actions.ok')
|
|
||||||
}}
|
|
||||||
</Rose::Button>
|
|
||||||
<Rose::Button @style='secondary' {{on 'click' deny}}>
|
|
||||||
{{t 'actions.cancel'}}
|
|
||||||
</Rose::Button>
|
|
||||||
</dialog.footer>
|
|
||||||
</Rose::Dialog>
|
|
||||||
{{/if}}
|
|
||||||
</PendingConfirmations>
|
</PendingConfirmations>
|
||||||
Reference in new issue
Block a user