DEV: allows categories-admin-dropdown to have custom items (#9931)

Usage:

```
modifySelectKit("categories-admin-dropdown").appendContent(function() {
  return {
    id: "foo",
    name: I18n.t("foo"),
    description: I18n.t("foo_description"),
    icon: "gear",
    onChange: () => alert("Foo.")
  };
});
```
This commit is contained in:
Joffrey JAFFEUX 2020-05-29 21:01:19 +02:00 committed by GitHub
parent 2b2434b82d
commit 931bfca454
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -36,5 +36,13 @@ export default DropdownSelectBoxComponent.extend({
}
return items;
})
}),
_onChange(value, item) {
if (item.onChange) {
item.onChange(value, item);
} else if (this.attrs.onChange) {
this.attrs.onChange(value, item);
}
}
});