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