From 862b44fea97413ebdc63baba5ca349cce094302d Mon Sep 17 00:00:00 2001 From: Andrei Prigorshnev Date: Tue, 2 Apr 2024 20:46:44 +0400 Subject: [PATCH] WIP: combobox options --- .../components/modal/edit-topic-assignments.js | 1 + .../discourse/components/topic-assignments.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/components/modal/edit-topic-assignments.js b/assets/javascripts/discourse/components/modal/edit-topic-assignments.js index 206283a..eae6f98 100644 --- a/assets/javascripts/discourse/components/modal/edit-topic-assignments.js +++ b/assets/javascripts/discourse/components/modal/edit-topic-assignments.js @@ -12,6 +12,7 @@ export default class EditTopicAssignments extends Component { constructor() { super(...arguments); const topicAssignment = { + type: "Topic", username: "", group_name: "", status: "", diff --git a/assets/javascripts/discourse/components/topic-assignments.js b/assets/javascripts/discourse/components/topic-assignments.js index c30fe1c..59c858c 100644 --- a/assets/javascripts/discourse/components/topic-assignments.js +++ b/assets/javascripts/discourse/components/topic-assignments.js @@ -12,7 +12,14 @@ export default class TopicAssignments extends Component { } get assignmentOptions() { - const topicAssignment = { id: this.TOPIC_ID, name: "Topic" }; - return [topicAssignment]; + return this.args.assignments.map((a) => this.#toComboBoxOption(a)); + } + + #toComboBoxOption(assignment) { + if (assignment.type === "Topic") { + return { id: this.TOPIC_ID, name: "Topic" }; + } else { + return null; + } } }