From 661f4c362054bdab007262249576e34a7b07cfa7 Mon Sep 17 00:00:00 2001 From: Andrei Prigorshnev Date: Tue, 2 Apr 2024 21:03:35 +0400 Subject: [PATCH] WIP: combobox options --- .../discourse/components/topic-assignments.hbs | 2 +- .../discourse/components/topic-assignments.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/assets/javascripts/discourse/components/topic-assignments.hbs b/assets/javascripts/discourse/components/topic-assignments.hbs index 4ed2dd8..6aade76 100644 --- a/assets/javascripts/discourse/components/topic-assignments.hbs +++ b/assets/javascripts/discourse/components/topic-assignments.hbs @@ -7,6 +7,6 @@ /> \ No newline at end of file diff --git a/assets/javascripts/discourse/components/topic-assignments.js b/assets/javascripts/discourse/components/topic-assignments.js index 59c858c..19b71d8 100644 --- a/assets/javascripts/discourse/components/topic-assignments.js +++ b/assets/javascripts/discourse/components/topic-assignments.js @@ -1,20 +1,25 @@ import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; -import { action } from "@ember/object"; -import { inject as service } from "@ember/service"; export default class TopicAssignments extends Component { @tracked selectedAssignmentId = 0; + @tracked selectedAssignment; TOPIC_ID = 0; - get topicAssignment() { - return this.args.assignments[0]; + constructor() { + super(...arguments); + this.selectedAssignment = this.args.assignments[0]; // fixme andrei } get assignmentOptions() { return this.args.assignments.map((a) => this.#toComboBoxOption(a)); } + synchronizeAssignment(selectedAssignmentId) { + this.selectedAssignmentId = selectedAssignmentId; + this.selectedAssignment = this.args.assignments[0]; // fixme andrei + } + #toComboBoxOption(assignment) { if (assignment.type === "Topic") { return { id: this.TOPIC_ID, name: "Topic" };