Skip to content

Commit

Permalink
DEV: Use the new topic-list APIs (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Dec 16, 2024
1 parent 568efb4 commit 471cfdf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{raw "assign-topic-buttons" topic=context.topic}}
{{!-- has-modern-replacement --}}{{raw "assign-topic-buttons" topic=context.topic}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import AssignedTopicListColumn from "../components/assigned-topic-list-column";

const ASSIGN_LIST_ROUTES = ["userActivity.assigned", "group.assigned.show"];

const AssignActionsCell = <template>
<td class="assign-topic-buttons">
<AssignedTopicListColumn @topic={{@topic}} />
</td>
</template>;

export default {
name: "assignment-list-dropdowns",

initialize(container) {
const router = container.lookup("service:router");

withPluginApi("1.39.0", (api) => {
api.registerValueTransformer(
"topic-list-columns",
({ value: columns }) => {
if (ASSIGN_LIST_ROUTES.includes(router.currentRouteName)) {
columns.add("assign-actions", {
item: AssignActionsCell,
after: "activity",
});
}

return columns;
}
);
});
},
};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{{view.html}}}
{{!-- has-modern-replacement --}}{{{view.html}}}

0 comments on commit 471cfdf

Please sign in to comment.