From 552859b0ff432c12313b3f8bed5da23f50d878c5 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 17 Apr 2024 13:11:50 +0200 Subject: [PATCH] DEV: converts discard-draft modal to gjs (#26637) --- .../app/components/modal/discard-draft.gjs | 54 +++++++++++++++++++ .../app/components/modal/discard-draft.hbs | 32 ----------- .../app/components/modal/discard-draft.js | 16 ------ 3 files changed, 54 insertions(+), 48 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/components/modal/discard-draft.gjs delete mode 100644 app/assets/javascripts/discourse/app/components/modal/discard-draft.hbs delete mode 100644 app/assets/javascripts/discourse/app/components/modal/discard-draft.js diff --git a/app/assets/javascripts/discourse/app/components/modal/discard-draft.gjs b/app/assets/javascripts/discourse/app/components/modal/discard-draft.gjs new file mode 100644 index 00000000000..54432c86a7c --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/modal/discard-draft.gjs @@ -0,0 +1,54 @@ +import Component from "@glimmer/component"; +import { action } from "@ember/object"; +import DButton from "discourse/components/d-button"; +import DModal from "discourse/components/d-modal"; +import i18n from "discourse-common/helpers/i18n"; + +export default class DiscardDraftModal extends Component { + @action + async discardDraft() { + await this.args.model.onDestroyDraft(); + this.args.closeModal(); + } + + @action + async saveDraftAndClose() { + await this.args.model.onSaveDraft(); + this.args.closeModal(); + } + + +} diff --git a/app/assets/javascripts/discourse/app/components/modal/discard-draft.hbs b/app/assets/javascripts/discourse/app/components/modal/discard-draft.hbs deleted file mode 100644 index fd966f5b665..00000000000 --- a/app/assets/javascripts/discourse/app/components/modal/discard-draft.hbs +++ /dev/null @@ -1,32 +0,0 @@ - - <:body> -
- {{i18n "post.cancel_composer.confirm"}} -
- - - <:footer> - - {{#if @model.showSaveDraftButton}} - - {{/if}} - - -
\ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/modal/discard-draft.js b/app/assets/javascripts/discourse/app/components/modal/discard-draft.js deleted file mode 100644 index d113e5af19b..00000000000 --- a/app/assets/javascripts/discourse/app/components/modal/discard-draft.js +++ /dev/null @@ -1,16 +0,0 @@ -import Component from "@glimmer/component"; -import { action } from "@ember/object"; - -export default class DiscardDraftModal extends Component { - @action - async discardDraft() { - await this.args.model.onDestroyDraft(); - this.args.closeModal(); - } - - @action - async saveDraftAndClose() { - await this.args.model.onSaveDraft(); - this.args.closeModal(); - } -}