track modal model updates
This commit is contained in:
parent
e1d473b8cf
commit
88ee6aeaf8
|
|
@ -1,7 +1,7 @@
|
|||
<DModal class="assign" @title={{this.title}} @closeModal={{@closeModal}}>
|
||||
<:body>
|
||||
<AssignUserForm
|
||||
@model={{@model}}
|
||||
@model={{this.model}}
|
||||
@onSubmit={{this.onSubmit}}
|
||||
@formApi={{this.formApi}}
|
||||
/>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
class="btn-primary"
|
||||
@action={{this.formApi.submit}}
|
||||
@label={{if
|
||||
@model.reassign
|
||||
this.model.reassign
|
||||
"discourse_assign.reassign.title"
|
||||
"discourse_assign.assign_modal.assign"
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { TrackedObject } from "@ember-compat/tracked-built-ins";
|
||||
import I18n from "I18n";
|
||||
|
||||
export default class AssignUser extends Component {
|
||||
@service taskActions;
|
||||
|
||||
model = new TrackedObject(this.args.model);
|
||||
|
||||
// `submit` property will be mutated by the `AssignUserForm` component
|
||||
formApi = {
|
||||
submit() {},
|
||||
|
|
@ -14,7 +17,7 @@ export default class AssignUser extends Component {
|
|||
get title() {
|
||||
let i18nSuffix;
|
||||
|
||||
switch (this.args.model.targetType) {
|
||||
switch (this.model.targetType) {
|
||||
case "Post":
|
||||
i18nSuffix = "_post_modal";
|
||||
break;
|
||||
|
|
@ -25,7 +28,7 @@ export default class AssignUser extends Component {
|
|||
|
||||
return I18n.t(
|
||||
`discourse_assign.assign${i18nSuffix}.${
|
||||
this.args.model.reassign ? "reassign_title" : "title"
|
||||
this.model.reassign ? "reassign_title" : "title"
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
|
@ -33,6 +36,6 @@ export default class AssignUser extends Component {
|
|||
@action
|
||||
async onSubmit() {
|
||||
this.args.closeModal();
|
||||
await this.taskActions.assign(this.args.model);
|
||||
await this.taskActions.assign(this.model);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue