DEV: Export openNewCategoryModal from discovery-categories (#9501)
This commit is contained in:
parent
45f3517ef6
commit
04fb37c7a4
|
@ -110,22 +110,7 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||
},
|
||||
|
||||
createCategory() {
|
||||
const groups = this.site.groups,
|
||||
everyoneName = groups.findBy("id", 0).name;
|
||||
|
||||
const model = this.store.createRecord("category", {
|
||||
color: "0088CC",
|
||||
text_color: "FFFFFF",
|
||||
group_permissions: [{ group_name: everyoneName, permission_type: 1 }],
|
||||
available_groups: groups.map(g => g.name),
|
||||
allow_badges: true,
|
||||
topic_featured_link_allowed: true,
|
||||
custom_fields: {},
|
||||
search_priority: searchPriorities.normal
|
||||
});
|
||||
|
||||
showModal("edit-category", { model });
|
||||
this.controllerFor("edit-category").set("selectedTab", "general");
|
||||
openNewCategoryModal(this);
|
||||
},
|
||||
|
||||
reorderCategories() {
|
||||
|
@ -148,4 +133,22 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||
}
|
||||
});
|
||||
|
||||
export function openNewCategoryModal(context) {
|
||||
const groups = context.site.groups,
|
||||
everyoneName = groups.findBy("id", 0).name;
|
||||
|
||||
const model = context.store.createRecord("category", {
|
||||
color: "0088CC",
|
||||
text_color: "FFFFFF",
|
||||
group_permissions: [{ group_name: everyoneName, permission_type: 1 }],
|
||||
available_groups: groups.map(g => g.name),
|
||||
allow_badges: true,
|
||||
topic_featured_link_allowed: true,
|
||||
custom_fields: {},
|
||||
search_priority: searchPriorities.normal
|
||||
});
|
||||
|
||||
showModal("edit-category", { model }).set("selectedTab", "general");
|
||||
}
|
||||
|
||||
export default DiscoveryCategoriesRoute;
|
||||
|
|
Loading…
Reference in New Issue