diff --git a/app/assets/javascripts/discourse/app/components/bread-crumbs.js b/app/assets/javascripts/discourse/app/components/bread-crumbs.js index a93c9e9a3bb..4f0925706fa 100644 --- a/app/assets/javascripts/discourse/app/components/bread-crumbs.js +++ b/app/assets/javascripts/discourse/app/components/bread-crumbs.js @@ -7,6 +7,8 @@ import { filter } from "@ember/object/computed"; export default Component.extend({ classNameBindings: ["hidden:hidden", ":category-breadcrumb"], tagName: "ol", + editingCategory: false, + editingCategoryTab: null, @discourseComputed("categories") filteredCategories(categories) { @@ -47,6 +49,11 @@ export default Component.extend({ }); }, + @discourseComputed("siteSettings.tagging_enabled", "editingCategory") + showTagsSection(taggingEnabled, editingCategory) { + return taggingEnabled && !editingCategory; + }, + @discourseComputed("category") parentCategory(category) { deprecated( diff --git a/app/assets/javascripts/discourse/app/lib/url.js b/app/assets/javascripts/discourse/app/lib/url.js index e107bfef6f0..67732d5144a 100644 --- a/app/assets/javascripts/discourse/app/lib/url.js +++ b/app/assets/javascripts/discourse/app/lib/url.js @@ -1,5 +1,6 @@ import getURL, { withoutPrefix } from "discourse-common/lib/get-url"; import { next, schedule } from "@ember/runloop"; +import Category from "discourse/models/category"; import EmberObject from "@ember/object"; import LockOn from "discourse/lib/lock-on"; import Session from "discourse/models/session"; @@ -515,4 +516,13 @@ export function getCategoryAndTagUrl(category, subcategories, tag) { return getURL(url || "/"); } +export function getEditCategoryUrl(category, subcategories, tab) { + let url = `/c/${Category.slugFor(category)}/edit`; + + if (tab) { + url += `/${tab}`; + } + return getURL(url); +} + export default _urlInstance; diff --git a/app/assets/javascripts/discourse/app/templates/components/bread-crumbs.hbs b/app/assets/javascripts/discourse/app/templates/components/bread-crumbs.hbs index 354e4de4ecb..df1de24a368 100644 --- a/app/assets/javascripts/discourse/app/templates/components/bread-crumbs.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/bread-crumbs.hbs @@ -4,6 +4,8 @@ category=breadcrumb.category categories=breadcrumb.options tagId=tag.id + editingCategory=editingCategory + editingCategoryTab=editingCategoryTab options=(hash parentCategory=breadcrumb.parentCategory subCategory=breadcrumb.isSubcategory @@ -14,7 +16,7 @@ {{/if}} {{/each}} -{{#if siteSettings.tagging_enabled}} +{{#if showTagsSection}} {{#if additionalTags}} {{tags-intersection-chooser currentCategory=category diff --git a/app/assets/javascripts/discourse/app/templates/edit-category-tabs.hbs b/app/assets/javascripts/discourse/app/templates/edit-category-tabs.hbs index b5a7afc0cce..6837440bf17 100644 --- a/app/assets/javascripts/discourse/app/templates/edit-category-tabs.hbs +++ b/app/assets/javascripts/discourse/app/templates/edit-category-tabs.hbs @@ -1,6 +1,17 @@