mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 22:29:46 +08:00
FEATURE: Add sidebar link for admin to configure default tags (#18593)
Displays a sidebar section link to admin users when `default_sidebar_tags` site setting has not been configured for the site. Internal Ref: /t/73500
This commit is contained in:
parent
ae6549a6ea
commit
fff575ffd2
|
@ -27,5 +27,16 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<Sidebar::Common::AllTagsSectionLink />
|
<Sidebar::Common::AllTagsSectionLink />
|
||||||
|
|
||||||
|
{{#if (and this.currentUser.admin (not this.hasDefaultSidebarTags))}}
|
||||||
|
<Sidebar::SectionLink
|
||||||
|
@linkName="configure-default-sidebar-tags"
|
||||||
|
@content={{i18n "sidebar.sections.tags.configure_defaults"}}
|
||||||
|
@prefixType="icon"
|
||||||
|
@prefixValue="wrench"
|
||||||
|
@route="adminSiteSettingsCategory"
|
||||||
|
@model="sidebar"
|
||||||
|
@query={{hash filter="default_sidebar_tags"}} />
|
||||||
|
{{/if}}
|
||||||
</Sidebar::Section>
|
</Sidebar::Section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -71,13 +71,17 @@ export default class SidebarUserTagsSection extends Component {
|
||||||
* If a site has default sidebar tags configured, always display the tags section.
|
* If a site has default sidebar tags configured, always display the tags section.
|
||||||
*/
|
*/
|
||||||
get shouldDisplay() {
|
get shouldDisplay() {
|
||||||
if (this.siteSettings.default_sidebar_tags.length > 0) {
|
if (this.hasDefaultSidebarTags) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return this.currentUser.sidebarTags.length > 0;
|
return this.currentUser.sidebarTags.length > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasDefaultSidebarTags() {
|
||||||
|
return this.siteSettings.default_sidebar_tags.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
editTracked() {
|
editTracked() {
|
||||||
this.router.transitionTo("preferences.sidebar", this.currentUser);
|
this.router.transitionTo("preferences.sidebar", this.currentUser);
|
||||||
|
|
|
@ -59,6 +59,7 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
display_sidebar_tags: true,
|
display_sidebar_tags: true,
|
||||||
|
admin: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
needs.pretender((server, helper) => {
|
needs.pretender((server, helper) => {
|
||||||
|
@ -423,4 +424,23 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {
|
||||||
initialCallbackCount
|
initialCallbackCount
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("section link to admin site settings page when default sidebar tags have not been configured", async function (assert) {
|
||||||
|
updateCurrentUser({ admin: true });
|
||||||
|
|
||||||
|
await visit("/");
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
exists(".sidebar-section-link-configure-default-sidebar-tags"),
|
||||||
|
"section link to configure default sidebar tags is shown"
|
||||||
|
);
|
||||||
|
|
||||||
|
await click(".sidebar-section-link-configure-default-sidebar-tags");
|
||||||
|
|
||||||
|
assert.strictEqual(
|
||||||
|
currentURL(),
|
||||||
|
"/admin/site_settings/category/all_results?filter=default_sidebar_tags",
|
||||||
|
"it links to the admin site settings page correctly"
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ en:
|
||||||
enable_quoting: "Enable quote reply for highlighted text"
|
enable_quoting: "Enable quote reply for highlighted text"
|
||||||
enable_defer: "Enable defer to mark topics unread"
|
enable_defer: "Enable defer to mark topics unread"
|
||||||
experimental_sidebar:
|
experimental_sidebar:
|
||||||
enable: "Enable experimental sidebar"
|
enable: "Enable sidebar"
|
||||||
options: "Options"
|
options: "Options"
|
||||||
categories_section: "Categories Section"
|
categories_section: "Categories Section"
|
||||||
categories_section_instruction: "Selected categories will be displayed under Sidebar's categories section."
|
categories_section_instruction: "Selected categories will be displayed under Sidebar's categories section."
|
||||||
|
@ -4189,6 +4189,7 @@ en:
|
||||||
click_to_get_started: "Click here to get started."
|
click_to_get_started: "Click here to get started."
|
||||||
header_link_text: "Tags"
|
header_link_text: "Tags"
|
||||||
header_action_title: "edit your sidebar tags"
|
header_action_title: "edit your sidebar tags"
|
||||||
|
configure_defaults: "Configure defaults"
|
||||||
categories:
|
categories:
|
||||||
none: "You have not added any categories."
|
none: "You have not added any categories."
|
||||||
click_to_get_started: "Click here to get started."
|
click_to_get_started: "Click here to get started."
|
||||||
|
@ -5666,6 +5667,7 @@ en:
|
||||||
search: "Search"
|
search: "Search"
|
||||||
groups: "Groups"
|
groups: "Groups"
|
||||||
dashboard: "Dashboard"
|
dashboard: "Dashboard"
|
||||||
|
sidebar: "Sidebar"
|
||||||
secret_list:
|
secret_list:
|
||||||
invalid_input: "Input fields cannot be empty or contain vertical bar character."
|
invalid_input: "Input fields cannot be empty or contain vertical bar character."
|
||||||
default_categories:
|
default_categories:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user