-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV: Use the new topic-list APIs (#622)
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
assets/javascripts/discourse/connectors/topic-list-after-columns/assign-buttons.hbr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |
34 changes: 34 additions & 0 deletions
34
assets/javascripts/discourse/initializers/assignment-list-actions.gjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
); | ||
}); | ||
}, | ||
}; |
2 changes: 1 addition & 1 deletion
2
assets/javascripts/discourse/raw-templates/assign-topic-buttons.hbr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{{{view.html}}} | ||
{{!-- has-modern-replacement --}}{{{view.html}}} |