Skip to content

Commit

Permalink
WIP: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPrigorshnev committed Mar 4, 2024
1 parent c80e107 commit 286efd1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions assets/javascripts/discourse/widgets/assigned-to.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getOwner } from "@ember/application";
import { hbs } from "ember-cli-htmlbars";
import { h } from "virtual-dom";
import RenderGlimmer from "discourse/widgets/render-glimmer";
Expand Down Expand Up @@ -39,12 +40,21 @@ export const AssignedToWidget = ["assigned-to", {
<DMenu @inline={{true}} @label="...">
<Menu::Buttons::UnassignPost @post={{@data.post}} />
<Menu::Buttons::EditPostAssignment @post={{@data.post}} />
<button {{on "click" @data.editAssignment}}>Edit assignment...</button>
</DMenu>
`,
{
post: this.attrs.post,
editAssignment: () => this.editAssignment()
}
)
];
},

editAssignment() {
const taskActions = getOwner(this).lookup("service:task-actions");
taskActions.showAssignModal(this.attrs.post, {
targetType: "Post",
});
}
}];

0 comments on commit 286efd1

Please sign in to comment.