mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
This reverts commit eb3a1c72179c179af358daf41b167e337cc7b454.
This commit is contained in:
@ -10,7 +10,6 @@ import DaCustomFields from "./fields/da-custom-fields";
|
||||
import DaDateTimeField from "./fields/da-date-time-field";
|
||||
import DaEmailGroupUserField from "./fields/da-email-group-user-field";
|
||||
import DaGroupField from "./fields/da-group-field";
|
||||
import DaGroupsField from "./fields/da-groups-field";
|
||||
import DaKeyValueField from "./fields/da-key-value-field";
|
||||
import DaMessageField from "./fields/da-message-field";
|
||||
import DaPeriodField from "./fields/da-period-field";
|
||||
@ -42,7 +41,6 @@ const FIELD_COMPONENTS = {
|
||||
"trust-levels": DaTrustLevelsField,
|
||||
category: DaCategoryField,
|
||||
group: DaGroupField,
|
||||
groups: DaGroupsField,
|
||||
choices: DaChoicesField,
|
||||
category_notification_level: DaCategoryNotificationlevelField,
|
||||
email_group_user: DaEmailGroupUserField,
|
||||
|
@ -1,55 +0,0 @@
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { hash } from "@ember/helper";
|
||||
import { action } from "@ember/object";
|
||||
import Group from "discourse/models/group";
|
||||
import GroupChooser from "select-kit/components/group-chooser";
|
||||
import BaseField from "./da-base-field";
|
||||
import DAFieldDescription from "./da-field-description";
|
||||
import DAFieldLabel from "./da-field-label";
|
||||
|
||||
export default class GroupsField extends BaseField {
|
||||
@tracked allGroups = [];
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
Group.findAll({
|
||||
ignore_automatic: this.args.field.extra.ignore_automatic ?? false,
|
||||
}).then((groups) => {
|
||||
if (this.isDestroying || this.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.allGroups = groups;
|
||||
});
|
||||
}
|
||||
|
||||
get maximum() {
|
||||
return this.args.field.extra.maximum ?? 10;
|
||||
}
|
||||
|
||||
@action
|
||||
setGroupField(groupIds) {
|
||||
this.mutValue(groupIds);
|
||||
}
|
||||
|
||||
<template>
|
||||
<section class="field group-field">
|
||||
<div class="control-group">
|
||||
<DAFieldLabel @label={{@label}} @field={{@field}} />
|
||||
|
||||
<div class="controls">
|
||||
<GroupChooser
|
||||
@content={{this.allGroups}}
|
||||
@value={{@field.metadata.value}}
|
||||
@labelProperty="name"
|
||||
@onChange={{this.setGroupField}}
|
||||
@options={{hash maximum=this.maximum disabled=@field.isDisabled}}
|
||||
/>
|
||||
|
||||
<DAFieldDescription @description={{@description}} />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
}
|
Reference in New Issue
Block a user