DEV: Export openNewCategoryModal from discovery-categories (#9501)

This commit is contained in:
Mark VanLandingham 2020-04-22 11:03:28 -05:00 committed by GitHub
parent 45f3517ef6
commit 04fb37c7a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 16 deletions

View File

@ -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;