DEV: converts activation-edit modal to gjs (#29827)

* DEV: converts activation-edit modal to gjs

* Update app/assets/javascripts/discourse/app/components/modal/activation-edit.gjs

---------

Co-authored-by: Jarek Radosz <jarek@cvx.dev>
This commit is contained in:
Joffrey JAFFEUX 2024-11-19 23:19:51 +01:00 committed by GitHub
parent e02a37b0d7
commit 921416a741
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 21 deletions

View File

@ -2,8 +2,12 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object"; import { action } from "@ember/object";
import { service } from "@ember/service"; import { service } from "@ember/service";
import ActivationEmailForm from "discourse/components/activation-email-form";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import { extractError } from "discourse/lib/ajax-error"; import { extractError } from "discourse/lib/ajax-error";
import { changeEmail } from "discourse/lib/user-activation"; import { changeEmail } from "discourse/lib/user-activation";
import { i18n } from "discourse-i18n";
import ActivationResent from "./activation-resent"; import ActivationResent from "./activation-resent";
export default class ActivationEdit extends Component { export default class ActivationEdit extends Component {
@ -38,4 +42,28 @@ export default class ActivationEdit extends Component {
updateNewEmail(email) { updateNewEmail(email) {
this.newEmail = email; this.newEmail = email;
} }
<template>
<DModal
@closeModal={{@closeModal}}
@title={{i18n "login.change_email"}}
@flash={{this.flash}}
>
<:body>
<ActivationEmailForm
@email={{@model.newEmail}}
@updateNewEmail={{this.updateNewEmail}}
/>
</:body>
<:footer>
<DButton
@action={{this.changeEmail}}
@label="login.submit_new_email"
@disabled={{this.submitDisabled}}
class="btn-primary"
/>
<DButton @action={{@closeModal}} @label="close" />
</:footer>
</DModal>
</template>
} }

View File

@ -1,21 +0,0 @@
<DModal
@closeModal={{@closeModal}}
@title={{i18n "login.change_email"}}
@flash={{this.flash}}
>
<:body>
<ActivationEmailForm
@email={{@model.newEmail}}
@updateNewEmail={{this.updateNewEmail}}
/>
</:body>
<:footer>
<DButton
@action={{this.changeEmail}}
@label="login.submit_new_email"
@disabled={{this.submitDisabled}}
class="btn-primary"
/>
<DButton @action={{@closeModal}} @label="close" />
</:footer>
</DModal>